Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(radius): add first try #6

Merged
merged 5 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions charts/radius/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
secret.yaml
10 changes: 10 additions & 0 deletions charts/radius/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: v2
appVersion: "0.4"
description: A Helm chart for Kubernetes
name: radius
type: application
version: 0.1.0
maintainers:
- name: xom4ek
email: [email protected]
icon: https://avatars.githubusercontent.com/u/98524494?s=200&v=4
74 changes: 74 additions & 0 deletions charts/radius/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# radius Helm Chart

## Introduction
This repository contains a Helm chart for Kubernetes, specifically for the AVS named "radius".
More information about radius you can find here `https://docs.radius-labs.com/introduction/tech-documentation/operator-onboarding`

## Table of Contents
- [radius Helm Chart](#radius-helm-chart)
- [Introduction](#introduction)
- [Table of Contents](#table-of-contents)
- [Steps to Follow:](#steps-to-follow)
- [Configuration](#configuration)
- [Dependencies](#dependencies)
- [Troubleshooting](#troubleshooting)
- [Contributors](#contributors)
- [License](#license)

## Steps to Follow:

1. Generate keys via the following URLs:
- [Eigenlayer Operator Installation Guide](https://docs.eigenlayer.xyz/eigenlayer/operator-guides/operator-installation)
- [TheRadius](https://atlantic-walker-f10.notion.site/Operator-Guide-5077a0f8377447689a85fb1030e68df9)
- [Depository](https://github.com/radiusxyz/depository/tree/main)

2. -Create a secret in Kubernetes for any workflow you want. Example you can find in `./examples`-
> Dont use secret in open way, try to figure out with [vault](https://github.com/hashicorp/vault) / [sealed-secrets](https://github.com/bitnami-labs/sealed-secrets) / [sops](https://github.com/getsops/sops)
3. Fill the placeholders in your `values.yaml` file:
- YOUR_WALLET_KEY
- YOUR_PUBLIC_DOMAIN

4. Run the following command to upgrade and install the chart:
```sh
helm upgrade -i radius p2p-avs/radius -f values.$NETWORK.yaml
```

## Configuration
The following table lists the configurable parameters of the radius chart and their default values.

| Parameter | Description | Default |
|-----------------------------|---------------------------------------------------------------|------------------------------|
| `replicaCount` | Number of replicas | `1` |
| `service.type` | Type of Kubernetes service | `ClusterIP` |
| `service.ports` | Service ports | `{...}` |
| `ingress.enabled` | Enable ingress | `false` |
| `ingress.host` | Ingress host | `example.com` |
| `node.image.repository` | Node image repository | `theradius/loggia` |
| `node.image.tag` | Node image tag | `latest` |
| `node.image.pullPolicy` | Image pull policy | `Always` |
| `node.resources.requests` | CPU/Memory resource requests | `2 CPU / 8Gi Memory` |
| `node.resources.limits` | CPU/Memory resource limits | `4 CPU / 16Gi Memory` |
| `serviceAccount.create` | Specifies whether a service account should be created | `true` |
| `serviceAccount.name` | Name of the service account | `""` |
| `vmPodScrape.enabled` | Enable VM Pod scraping | `true` |
| `register.enabled` | Enable register functionality | `true` |
| `register.image.repository` | Register image repository | `theradius/loggia` |
| `register.image.tag` | Register image tag | `latest` |
| `register.image.pullPolicy` | Register image pull policy | `Always` |
| `configs.operator.yaml` | Operator configuration | `empty` |

## Dependencies
This chart depends on several Kubernetes resources and should be used in a Kubernetes cluster. Ensure that you have Kubernetes and Helm installed and configured in your environment.

## Troubleshooting
If you encounter any issues during installation or usage, check the following:

- Ensure that all required Kubernetes resources are available.
- Validate your `values.yaml` file against the provided `values.schema.json`.
- Check the logs of the Helm deployment for any errors.

## Contributors
- xom4ek (Aleksei Lazarev) - [email protected]

## License
This project is licensed under the MIT License. See the LICENSE file for details.
5 changes: 5 additions & 0 deletions charts/radius/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Generate keys

For generate keys read this doc https://docs.eigenlayer.xyz/eigenlayer/operator-guides/operator-installation

> Dont use secret in open way, try to figure out with [vault](https://github.com/hashicorp/vault) / [sealed-secrets](https://github.com/bitnami-labs/sealed-secrets) / [sops](https://github.com/getsops/sops)
32 changes: 32 additions & 0 deletions charts/radius/example/wallet-secret.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: v1
stringData:

ecdsa-private-key: |

{
"address": "sadflkasmdflkamsldfas;df",
"crypto": {
"cipher": "aes-128-ctr",
"ciphertext": "as;dmflaskmdflasmdlfkmalsdf",
"cipherparams": {
"iv": "lakmdslfkmalsdmflkasdmfl"
},
"kdf": "scrypt",
"kdfparams": {
"dklen": 123,
"n": 123123,
"p": 12,
"r": 823,
"salt": "daslkfmklasdmfklmasdlkfmlakdsf"
},
"mac": "alsdkmflkamsdlfkmasldfmlaksdmlf"
},
"id": "alsdfmlkasmdlfkmasldf",
"version": 3
}

ecdsa-private-key-password: anlNASLdnfaljksdnLANSDlnalsdkjnASLKJDNlwnqlo21n3lkASLDndalsd
kind: Secret
metadata:
name: YOURSECREWITHWALLET
type: Opaque
68 changes: 68 additions & 0 deletions charts/radius/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "radius.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "radius.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "radius.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "radius.labels" -}}
helm.sh/chart: {{ include "radius.chart" . }}
{{ include "radius.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{- define "radiusRegister.labels" -}}
helm.sh/chart: {{ include "radius.chart" . }}
{{ include "radiusRegister.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "radius.selectorLabels" -}}
app.kubernetes.io/name: {{ include "radius.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "radiusRegister.selectorLabels" -}}
app.kubernetes.io/name: {{ include "radius.name" . }}-register
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/radius/templates/configmap.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "radius.fullname" . }}-config
labels:
{{- include "radius.labels" . | nindent 4 }}
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
data:
{{- if .Values.configs }}
{{- toYaml .Values.configs | nindent 2 }}
{{- end }}
28 changes: 28 additions & 0 deletions charts/radius/templates/ingress.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "radius.fullname" . }}
labels:
{{- include "radius.labels" . | nindent 4 }}
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
spec:
ingressClassName: nginx
rules:
- host: {{ .Values.ingress.host }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "radius.fullname" . }}
port:
name: node-api
{{- end }}
20 changes: 20 additions & 0 deletions charts/radius/templates/pvc.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "radius.fullname" . }}
{{- with .Values.pvc.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "radius.labels" . | nindent 4 }}
{{- with .Values.pvc.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
spec:
storageClassName: {{.Values.pvc.storageClassName }}
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.pvc.size }}
30 changes: 30 additions & 0 deletions charts/radius/templates/register.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{{- if .Values.register.enabled }}
apiVersion: batch/v1
kind: Job
metadata:
name: {{ include "radius.fullname" . }}-register-job
labels:
{{- include "radiusRegister.labels" . | nindent 4 }}
annotations:
"helm.sh/hook": "post-install"
spec:
template:
metadata:
labels:
{{- include "radiusRegister.labels" . | nindent 8 }}
spec:
containers:
- name: register
image: "{{ .Values.register.image.repository }}:{{ .Values.register.image.tag | default .Chart.AppVersion }}"
imagePullPolicy: {{ .Values.register.image.pullPolicy }}
args:
{{- toYaml .Values.register.args | nindent 12 }}
env:
{{- toYaml .Values.node.env | nindent 12 }}
volumeMounts:
{{- toYaml .Values.node.volumeMounts | nindent 12 }}
restartPolicy: Never
volumes:
{{- toYaml .Values.volumes | nindent 8 }}
backoffLimit: 2
{{- end }}
27 changes: 27 additions & 0 deletions charts/radius/templates/service.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "radius.fullname" . }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "radius.labels" . | nindent 4 }}
{{- with .Values.service.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
spec:
type: {{ .Values.service.type }}
ports:
{{- range .Values.service.ports }}
- name: {{ .name }}
port: {{ .port }}
protocol: {{ .protocol }}
targetPort: {{ .targetPort }}
{{- end }}
selector:
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
app: {{ include "radius.fullname" . }}
15 changes: 15 additions & 0 deletions charts/radius/templates/serviceaccount.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{{- if .Values.serviceAccount.create -}}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "radius.fullname" . }}
labels:
{{- include "radius.labels" . | nindent 4 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading
Loading