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: add charts #1

Merged
merged 3 commits into from
Jun 13, 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
39 changes: 39 additions & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Lint and Test Charts

on: pull_request

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # v3.5
with:
version: v3.13.0

# Python is required because `ct lint` runs Yamale (https://github.com/23andMe/Yamale) and
# yamllint (https://github.com/adrienverge/yamllint) which require Python
- name: Set up Python
uses: actions/setup-python@65d7f2d534ac1bc67fcd62888c5f4f3d2cb2b236 # v4.7.1
with:
python-version: 3.x

- name: Set up chart-testing
uses: helm/[email protected]

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }})
if [[ -n "$changed" ]]; then
echo "changed=true" >> "$GITHUB_OUTPUT"
fi

- name: Run chart-testing (lint)
if: steps.list-changed.outputs.changed == 'true'
run: ct lint --target-branch ${{ github.event.repository.default_branch }}
15 changes: 15 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Release Chart
on:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Publish Helm charts
uses: stefanprodan/helm-gh-pages@master
with:
token: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
52 changes: 52 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<p align="center">
<img width="400px" height=auto src="https://raw.githubusercontent.com/p2p-org/eigenlayer-operator/main/logo.png" />
</p>

<p align="center">
<a href="https://x.com/P2Pvalidator"><img src="https://badgen.net/badge/twitter/@P2Pvalidator/1DA1F2?icon&label" /></a>
<a href="https://github.com/p2p-org/avs-helm-charts"><img src="https://badgen.net/github/stars/p2p-org/avs-helm-charts?icon=github" /></a>
<a href="https://github.com/p2p-org/avs-helm-charts"><img src="https://badgen.net/github/forks/p2p-org/avs-helm-charts?icon=github" /></a>
</p>

## P2P Helm Charts for Kubernetes

This repository offers a selection of carefully curated P2P Helm charts, which are stored in individual folders. Each chart has its own `values.yaml` file defining the configuration parameters.

## Getting Started

To use these Helm charts, you first need to add the P2P repository to your local Helm client:

```bash
helm repo add p2p-avs https://p2p-org.github.io/avs-helm-charts/
```

Once the repository is added, you can deploy a specific chart with the following command:

```bash
helm install my-release p2p-avs/<chart-name>
```

**Note:** Make sure to replace `<chart-name>` with the name of the actual chart you intend to install.

## Requirements

Before you can use these Helm charts, ensure you have the following:

* Kubernetes 1.20 or higher
* Helm 3
* PV provisioner support in the underlying infrastructure (required for some charts)

## Using Helm

After installing the Helm client and adding the P2P repository, Helm is your tool of choice to manage packages on your Kubernetes cluster. For detailed guidance on using Helm, see the [official documentation](https://helm.sh/docs/intro/using_helm/).

Here's a selection of helpful Helm commands to kickstart your journey:

* Install a chart: `helm install my-release p2p-avs/<chart-name>`
* Upgrade your application: `helm upgrade my-release p2p-avs/<chart-name>`

## Contribute

We welcome contributions to improve our Helm charts. If you discover any bugs, have issues, or ideas for enhancements, feel free to open an issue or submit a pull request. Every feedback, bug report, or feature request is invaluable to us, and we appreciate the community's involvement in making P2P's Helm charts better.

Feel free to explore the repository and experiment with the Helm charts to suit your specific needs. P2P's Helm charts aim to make application deployment on Kubernetes an effortless experience.
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 }}
Loading
Loading