Skip to content

Commit

Permalink
Merge pull request #1 from p2p-org/dev
Browse files Browse the repository at this point in the history
feat: add charts
  • Loading branch information
xom4ek authored Jun 13, 2024
2 parents 9db3c33 + 01b00ac commit 8c381e9
Show file tree
Hide file tree
Showing 65 changed files with 4,230 additions and 0 deletions.
Empty file added charts/.gitkeep
Empty file.
1 change: 1 addition & 0 deletions charts/aethos/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
secret.yaml
9 changes: 9 additions & 0 deletions charts/aethos/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: v2
appVersion: 0.1.0
description: A Helm chart for Kubernetes
name: aethos
type: application
version: 0.1.0
maintainers:
- name: xom4ek
email: [email protected]
146 changes: 146 additions & 0 deletions charts/aethos/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
# README

This Helm chart is used to deploy a Kubernetes application. The following documentation provides details on the configurable values and their default settings.

## Table of Contents

- [README](#readme)
- [Table of Contents](#table-of-contents)
- [Parameters](#parameters)
- [Global Parameters](#global-parameters)
- [PVC Parameters](#pvc-parameters)
- [Service Parameters](#service-parameters)
- [Ingress Parameters](#ingress-parameters)
- [Configuration Parameters](#configuration-parameters)
- [Node Container Parameters](#node-container-parameters)
- [Pod Parameters](#pod-parameters)
- [Service Account Parameters](#service-account-parameters)
- [VM Pod Scrape Parameters](#vm-pod-scrape-parameters)
- [Example](#example)
- [License](#license)

## Parameters

### Global Parameters

| Parameter | Description | Default |
|--------------------|--------------------------------------|---------|
| `nameOverride` | Optionally override the name of the chart | `""` |
| `fullnameOverride` | Optionally override the full name of the chart | `""` |
| `replicaCount` | Number of replicas to deploy | `1` |
| `labels` | Additional labels to add to resources | `{}` |
| `imagePullSecrets` | Secrets for pulling images from a private registry | `[]` |

### PVC Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------|
| `pvc.size` | Size of the persistent volume claim | `10Gi` |
| `pvc.storageClassName` | Storage class name for the PVC | `""` |
| `pvc.labels` | Labels to add to the PVC | `{}` |
| `pvc.annotations` | Annotations to add to the PVC | `{}` |

### Service Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------------|
| `service.annotations` | Annotations to add to the service | `{}` |
| `service.type` | Type of service to create | `LoadBalancer`|
| `service.ports` | List of ports to expose from the service | `[{ name: node-api, port: 8080, protocol: TCP, targetPort: 8080 }, { name: metrics, port: 9090, protocol: TCP, targetPort: 9090 }, { name: task-server, port: 9010, protocol: TCP, targetPort: 9010 }]` |

### Ingress Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------------|
| `ingress.annotations` | Annotations to add to the ingress | `{}` |
| `ingress.enabled` | Enable or disable the ingress | `false` |
| `ingress.host` | Hostname for the ingress | `example.com` |

### Configuration Parameters

| Parameter | Description | Default |
|-----------------------------|--------------------------------------|---------------|
| `configs.operator.yaml` | Configuration file for the operator | ```yaml environment: production eth_rpc_url: https://lb.drpc.org/ogrpc?network=ethereum avs_service_manager_address: 0xdE93E0dA148e1919bb7f33cd8847F96e45791210 node_eigen_api_server_host_and_port: 0.0.0.0:8080 eigen_metrics_ip_port_address: 0.0.0.0:9090 node_task_server_host_and_port: 0.0.0.0:9010 aggregator_server_ip_port_address: holesky.task.aethos.network:50051``` |

### Node Container Parameters

| Parameter | Description | Default |
|-----------------------------------|--------------------------------------|---------------|
| `node.volumeMounts` | Volume mounts for the node container | `[{ name: ecdsa-key, mountPath: /app/operator_keys/ecdsa_key.json, subPath: ecdsa_key.json, readOnly: true }, { name: aethos, mountPath: /app/data/ }]` |
| `node.image.repository` | Image registry for the node container | `ghcr.io/aethosnetwork/operator` |
| `node.image.pullPolicy` | Image pull policy for the node container | `Always` |
| `node.image.tag` | Image tag for the node container | `latest` |
| `node.ports` | Ports to expose from the node container | `[{ name: node-api, containerPort: 8080, protocol: TCP }, { name: metrics, containerPort: 9090, protocol: TCP }, { name: task-server, containerPort: 9010, protocol: TCP }]` |
| `node.resources` | Resource limits and requests for the node container | `{ limits: { cpu: 4, memory: 16Gi }, requests: { cpu: 2, memory: 8Gi } }` |
| `node.env` | Environment variables for the node container | `[{ name: AETHOS_SIGNING_PRIVATE_KEY_STORE_PATH, value: "/app/operator_keys/ecdsa_key.json" }, { name: OPERATOR_ID, value: $YOU_OPERATOR_ID }, { name: AETHOS_SIGNING_PRIVATE_KEY_PASSWORD, valueFrom: { secretKeyRef: { name: YOURSECREWITHWALLET, key: ecdsa-private-key-password } } }, { name: NODE_TASK_SERVER_HOST_AND_PORT_TO_BROADCAST, value: 127.0.0.1:9010 }, { name: ETH_RPC_URL, value: https://lb.drpc.org/ogrpc?network=holesky }]` |
| `node.args` | Arguments to pass to the node container | `["start", "--config=/app/config/operator.yaml"]` |
| `node.readinessProbe` | Readiness probe for the node container | `{ httpGet: { path: /metrics, port: 9090 }, initialDelaySeconds: 30, periodSeconds: 10, timeoutSeconds: 3, failureThreshold: 3, successThreshold: 1 }` |

### Pod Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------------|
| `nodeSelector` | Node selector for the pod | `{}` |
| `tolerations` | Tolerations for the pod | `[]` |
| `affinity` | Affinity rules for the pod | `{}` |
| `podAnnotations` | Annotations to add to the pod | `{}` |
| `podSecurityContext` | Security context for the pod | `{}` |
| `securityContext` | Security context for the container | `{}` |
| `volumes` | Volumes for the pod | `[{ name: ecdsa-key, secret: { secretName: YOURSECREWITHWALLET, items: [{ key: ecdsa-private-key, path: ecdsa_key.json }] } }, { name: aethos, persistentVolumeClaim: { claimName: aethos } }]` |

### Service Account Parameters

| Parameter | Description | Default |
|------------------------------|--------------------------------------|---------------|
| `serviceAccount.create` | Specifies whether a service account should be created | `false` |
| `serviceAccount.annotations` | Annotations to add to the service account | `{}` |
| `serviceAccount.name` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template | `aethos` |

### VM Pod Scrape Parameters

| Parameter | Description | Default |
|--------------------------|--------------------------------------|---------------|
| `vmPodScrape.enabled` | Enable or disable VM Pod Scraping | `true` |

## Example

To deploy the chart with custom values, create a `values.yaml` file:

```yaml
replicaCount: 2

service:
type: LoadBalancer
ports:
- name: http
port: 80
protocol: TCP
targetPort: 8080

ingress:
enabled: true
host: myapp.example.com

node:
image:
repository: my-registry/my-node
tag: stable
resources:
limits:
cpu: 2
memory: 2Gi
requests:
cpu: 1
memory: 1Gi
```
Then install the chart using the Helm CLI:
```sh
helm repo add p2p-avs https://p2p-org.github.io/avs-helm-charts/
helm upgrade -i aethos-release p2p-avs/aethos -f values.holesky.yaml
```

## License

This Helm chart is licensed under the MIT License. See the LICENSE file for more information.
3 changes: 3 additions & 0 deletions charts/aethos/example/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Generate keys

For generate keys read this doc https://docs.eigenlayer.xyz/eigenlayer/operator-guides/operator-installation
32 changes: 32 additions & 0 deletions charts/aethos/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/aethos/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "aethos.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 "aethos.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 "aethos.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

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

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

{{/*
Selector labels
*/}}
{{- define "aethosRegister.selectorLabels" -}}
app.kubernetes.io/name: {{ include "aethos.name" . }}-register
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
13 changes: 13 additions & 0 deletions charts/aethos/templates/configmap.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "aethos.fullname" . }}-config
labels:
{{- include "aethos.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/aethos/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 "aethos.fullname" . }}
labels:
{{- include "aethos.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 "aethos.fullname" . }}
port:
name: node-api
{{- end }}
20 changes: 20 additions & 0 deletions charts/aethos/templates/pvc.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "aethos.fullname" . }}
{{- with .Values.pvc.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "aethos.labels" . | nindent 4 }}
{{- with .Values.pvc.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
spec:
storageClassName: oci-bv
accessModes:
- ReadWriteOnce
resources:
requests:
storage: {{ .Values.pvc.size }}
27 changes: 27 additions & 0 deletions charts/aethos/templates/service.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "aethos.fullname" . }}
{{- with .Values.service.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
labels:
{{- include "aethos.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 "aethos.fullname" . }}
15 changes: 15 additions & 0 deletions charts/aethos/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 "aethos.fullname" . }}
labels:
{{- include "aethos.labels" . | nindent 4 }}
{{- with .Values.labels }}
{{- toYaml . | nindent 4 }}
{{- end}}
{{- with .Values.serviceAccount.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit 8c381e9

Please sign in to comment.