Skip to content

Commit

Permalink
feat: rework helm-chart (#69)
Browse files Browse the repository at this point in the history
* feat: rework helm-chart

* fixes as per comments

Signed-off-by: Mehdi Bechiri <[email protected]>

* fixing missing addresses in helper

Signed-off-by: Mehdi Bechiri <[email protected]>

* remove top-level value watcher

Signed-off-by: Mehdi Bechiri <[email protected]>

* rename sa and freeze appVersion

Signed-off-by: Mehdi Bechiri <[email protected]>

---------

Signed-off-by: Mehdi Bechiri <[email protected]>
Co-authored-by: Mehdi Bechiri <[email protected]>
  • Loading branch information
rguichard and cebidhem authored Sep 21, 2023
1 parent f9933bf commit a36a9d3
Show file tree
Hide file tree
Showing 14 changed files with 299 additions and 273 deletions.
83 changes: 83 additions & 0 deletions .github/workflows/helm-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: charts::ghcr-oci

on:
push:
branches:
- main
paths:
- "charts/**"
- ".github/workflows/helm-chart.yaml"
pull_request:
branches:
- main
paths:
- "charts/**"
- ".github/workflows/helm-chart.yaml"

permissions:
id-token: write
actions: write
pull-requests: write
issues: write
contents: write
packages: write

jobs:
helm-lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up python
uses: actions/setup-python@v2
with:
python-version: 3.7

- 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 main --chart-dirs charts)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: ct lint --target-branch main --chart-dirs charts

helm-release:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs:
- helm-lint-test
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Install Helm
uses: azure/setup-helm@v3
with:
version: v3.8.0

- name: 'helm:package:create'
run: |
helm package charts/
- name: 'helm:package:get_artifcat_name'
run: |
find . -name "*.tgz"
echo "ARTIFACT_NAME=$(find . -name "*.tgz" -maxdepth 1)" >> $GITHUB_ENV
- name: 'helm:package:upload'
run: |
echo ${{ secrets.GITHUB_TOKEN }} | helm registry login ghcr.io --username kilnfi --password-stdin
helm push ${{ env.ARTIFACT_NAME }} oci://${{ env.REGISTRY }}/kilnfi/helm-charts/
env:
REGISTRY: ghcr.io
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,12 @@ Finally, this program exports the following sets of data from:
- Prometheus (you can use this Grafana dashboard to monitor your validators)
- Slack
- logs

Prometheus server is automatically exposed on port 8000.

Command line options
--------------------

```
╭─ Options ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ * --beacon-url TEXT URL of beacon node [required] │
Expand Down
3 changes: 2 additions & 1 deletion charts/eth-validator-watcher/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ apiVersion: v2
description: A Helm chart for running eth-validator-watcher
name: eth-validator-watcher
type: application
version: 1.0.0
version: 1.1.0
appVersion: v0.4.2
maintainers:
- name: Alluvial
email: [email protected]
Expand Down
63 changes: 33 additions & 30 deletions charts/eth-validator-watcher/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# eth-validator-watcher

![Version: 1.0.0](https://img.shields.io/badge/Version-1.0.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 1.1.0](https://img.shields.io/badge/Version-1.1.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: v0.4.2](https://img.shields.io/badge/AppVersion-v0.4.2-informational?style=flat-square)

A Helm chart for running eth-validator-watcher

Expand All @@ -15,48 +15,51 @@ A Helm chart for running eth-validator-watcher
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | |
| args | list | `[]` | Specifies the arguments to the command line Please refer to https://github.com/kilnfi/eth-validator-watcher/blob/main/README.md#description |
| env | object | `{}` | |
| envFrom | object | `{}` | |
| config.beaconType | string | `"other"` | |
| config.beaconUrl | string | `"http://localhost:5052"` | |
| config.watchedKeys | list | `[]` | List of public keys to watch. See https://github.com/kilnfi/eth-validator-watcher/blob/main/README.md#command-lines-examples |
| extraArgs | list | `[]` | |
| extraInitContainers | list | `[]` | |
| fullnameOverride | string | `""` | |
| image.pullPolicy | string | `"IfNotPresent"` | |
| image.repository | string | `"ghcr.io/kilnfi/eth-validator-watcher"` | |
| image.tag | string | `"latest"` | |
| image.tag | string | `""` | |
| imagePullSecrets | list | `[]` | |
| livenessProbe.exec.command[0] | string | `"/usr/bin/python3.9"` | |
| livenessProbe.exec.command[1] | string | `"/usr/local/bin/liveness_check.py"` | |
| livenessProbe.exec.command[2] | string | `"/tmp/liveness"` | |
| livenessProbe.failureThreshold | int | `10` | |
| livenessProbe.initialDelaySeconds | int | `120` | |
| livenessProbe.failureThreshold | int | `1` | |
| livenessProbe.initialDelaySeconds | int | `60` | |
| livenessProbe.periodSeconds | int | `60` | |
| livenessProbe.successThreshold | int | `1` | |
| livenessProbe.timeoutSeconds | int | `1` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| podAnnotations | object | `{}` | |
| podLabels | object | `{}` | |
| podMonitor.additionalLabels | object | `{}` | |
| podMonitor.enabled | bool | `false` | |
| podMonitor.interval | string | `"12s"` | |
| podMonitor.relabelings | list | `[]` | |
| podMonitor.scheme | string | `"http"` | |
| podMonitor.tlsConfig | object | `{}` | |
| podSecurityContext | object | `{}` | |
| readinessProbe.exec.command[0] | string | `"/usr/bin/python3.9"` | |
| readinessProbe.exec.command[1] | string | `"/usr/local/bin/liveness_check.py"` | |
| readinessProbe.exec.command[2] | string | `"/tmp/liveness"` | |
| readinessProbe.failureThreshold | int | `10` | |
| readinessProbe.initialDelaySeconds | int | `30` | |
| readinessProbe.failureThreshold | int | `1` | |
| readinessProbe.initialDelaySeconds | int | `60` | |
| readinessProbe.periodSeconds | int | `60` | |
| readinessProbe.successThreshold | int | `1` | |
| readinessProbe.timeoutSeconds | int | `1` | |
| replicaCount | int | `1` | |
| resources | object | `{}` | |
| resources.limits.memory | string | `"2400Mi"` | |
| resources.requests.cpu | string | `"100m"` | |
| resources.requests.memory | string | `"1200Mi"` | |
| securityContext | object | `{}` | |
| serviceAccount.annotations | object | `{}` | Annotations to add to the service account |
| serviceAccount.create | bool | `true` | Specifies whether a service account should be created |
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template |
| serviceMonitor.additionalLabels | object | `{}` | |
| serviceMonitor.enabled | bool | `false` | |
| serviceMonitor.metricRelabelings | list | `[]` | |
| serviceMonitor.namespace | string | `""` | |
| serviceMonitor.namespaceSelector | object | `{}` | |
| serviceMonitor.scrapeInterval | string | `"60s"` | |
| serviceMonitor.targetLabels | list | `[]` | |
| startupProbe | object | `{}` | |
| service.port | int | `80` | |
| service.type | string | `"ClusterIP"` | |
| serviceAccount.annotations | object | `{}` | |
| serviceAccount.create | bool | `true` | |
| serviceAccount.labels | object | `{}` | |
| serviceAccount.name | string | `""` | |
| tolerations | list | `[]` | |
| volumeMounts | list | `[]` | |
| volumes | list | `[]` | |
| watchedKeys | list | `[]` | List of public keys to watch. See https://github.com/kilnfi/eth-validator-watcher/blob/main/README.md#command-lines-examples |
| volumeMounts | object | `{}` | |
| volumes | object | `{}` | |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0)
46 changes: 24 additions & 22 deletions charts/eth-validator-watcher/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "eth-validator-watcher.name" -}}
{{- define "ethereum-validator-watcher.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

Expand All @@ -10,7 +10,7 @@ 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 "eth-validator-watcher.fullname" -}}
{{- define "ethereum-validator-watcher.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
Expand All @@ -26,37 +26,39 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "eth-validator-watcher.chart" -}}
{{- define "ethereum-validator-watcher.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
Create the name of the service account to use
*/}}
{{- define "eth-validator-watcher.labels" -}}
helm.sh/chart: {{ include "eth-validator-watcher.chart" . }}
{{ include "eth-validator-watcher.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- define "ethereum-validator-watcher.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ethereum-validator-watcher.fullname" .) .Values.serviceAccount.name }}
{{- else }}

{{- default "default" .Values.serviceAccount.name }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
Common labels
*/}}
{{- define "eth-validator-watcher.selectorLabels" -}}
app.kubernetes.io/name: {{ include "eth-validator-watcher.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- define "ethereum-validator-watcher.labels" -}}
app.kubernetes.io/name: {{ include "ethereum-validator-watcher.name" . }}
helm.sh/chart: {{ include "ethereum-validator-watcher.chart" . }}
app.kubernetes.io/instance: ethereum-validator-watcher
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
{{- end -}}

{{/*
Create the name of the service account to use
Selector labels
*/}}
{{- define "eth-validator-watcher.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "eth-validator-watcher.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
{{- define "ethereum-validator-watcher.matchLabels" -}}
app.kubernetes.io/name: {{ include "ethereum-validator-watcher.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end -}}
9 changes: 4 additions & 5 deletions charts/eth-validator-watcher/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
{{- if .Values.watchedKeys }}
---
{{- if .Values.config.watchedKeys }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "eth-validator-watcher.fullname" . }}
name: {{ include "ethereum-validator-watcher.fullname" . }}
labels:
{{- include "eth-validator-watcher.labels" . | nindent 4 }}
{{- include "ethereum-validator-watcher.labels" . | nindent 4 }}
data:
watched-keys.txt: |
{{- range .Values.watchedKeys }}
{{- range .Values.config.watchedKeys }}
{{- . | nindent 4 }}
{{- end }}
{{- end }}
Loading

0 comments on commit a36a9d3

Please sign in to comment.