From cdd556b9b0771194c4a71bdf7b5a3fc90244af11 Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Fri, 31 Jan 2025 09:46:02 +1000 Subject: [PATCH 1/5] feat(charts): adds panda-pulse cron --- README.md | 1 + charts/panda-pulse/.helmignore | 23 ++++++ charts/panda-pulse/Chart.yaml | 9 +++ charts/panda-pulse/README.md | 48 +++++++++++ charts/panda-pulse/templates/_helpers.tpl | 62 ++++++++++++++ charts/panda-pulse/templates/cronjob.yaml | 81 +++++++++++++++++++ charts/panda-pulse/templates/secret.yaml | 13 +++ .../panda-pulse/templates/serviceaccount.yaml | 12 +++ charts/panda-pulse/values.yaml | 44 ++++++++++ 9 files changed, 293 insertions(+) create mode 100644 charts/panda-pulse/.helmignore create mode 100644 charts/panda-pulse/Chart.yaml create mode 100644 charts/panda-pulse/README.md create mode 100644 charts/panda-pulse/templates/_helpers.tpl create mode 100644 charts/panda-pulse/templates/cronjob.yaml create mode 100644 charts/panda-pulse/templates/secret.yaml create mode 100644 charts/panda-pulse/templates/serviceaccount.yaml create mode 100644 charts/panda-pulse/values.yaml diff --git a/README.md b/README.md index bafb6c2..57250d0 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ helm search repo ethpandaops-general-helm-charts - [`cloudflare-tunnel`](charts/cloudflare-tunnel) - [`chproxy`](charts/chproxy) +- [`panda-pulse`](charts/panda-pulse) - [`raw-configmap`](charts/raw-configmap) ## Development diff --git a/charts/panda-pulse/.helmignore b/charts/panda-pulse/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/panda-pulse/.helmignore @@ -0,0 +1,23 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*.orig +*~ +# Various IDEs +.project +.idea/ +*.tmproj +.vscode/ diff --git a/charts/panda-pulse/Chart.yaml b/charts/panda-pulse/Chart.yaml new file mode 100644 index 0000000..a9ac78d --- /dev/null +++ b/charts/panda-pulse/Chart.yaml @@ -0,0 +1,9 @@ +apiVersion: v2 +name: panda-pulse +description: A Helm chart for Panda Pulse - Ethereum network monitoring and reporting tool +type: application +version: 0.0.1 +appVersion: "latest" +maintainers: + - name: matty + email: matt.evans@ethereum.org diff --git a/charts/panda-pulse/README.md b/charts/panda-pulse/README.md new file mode 100644 index 0000000..824f1f4 --- /dev/null +++ b/charts/panda-pulse/README.md @@ -0,0 +1,48 @@ +# panda-pulse + +![Version: 0.0.1](https://img.shields.io/badge/Version-0.0.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) + +A Helm chart for Panda Pulse - Ethereum network monitoring and reporting tool + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| matty | matt.evans@ethereum.org | | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| config.discordChannel | string | `""` | | +| config.ethereumCl | string | `""` | | +| config.ethereumEl | string | `""` | | +| config.grafanaBaseUrl | string | `""` | | +| config.network | string | `""` | | +| config.prometheusDatasourceId | string | `""` | | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"ethpandaops/panda-pulse"` | | +| image.tag | string | `"latest"` | | +| imagePullSecrets | list | `[]` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| podAnnotations | object | `{}` | | +| podSecurityContext | object | `{}` | | +| resources.limits.cpu | string | `"1000m"` | | +| resources.limits.memory | string | `"1Gi"` | | +| resources.requests.cpu | string | `"100m"` | | +| resources.requests.memory | string | `"128Mi"` | | +| schedule | string | `"*/2 * * * *"` | | +| secrets.discordBotToken | string | `""` | | +| secrets.grafanaServiceToken | string | `""` | | +| secrets.openrouterApiKey | string | `""` | | +| securityContext | object | `{}` | | +| serviceAccount.annotations | object | `{}` | | +| serviceAccount.create | bool | `true` | | +| serviceAccount.name | string | `""` | | +| tolerations | list | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0) diff --git a/charts/panda-pulse/templates/_helpers.tpl b/charts/panda-pulse/templates/_helpers.tpl new file mode 100644 index 0000000..d7711fa --- /dev/null +++ b/charts/panda-pulse/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "panda-pulse.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 "panda-pulse.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 "panda-pulse.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "panda-pulse.labels" -}} +helm.sh/chart: {{ include "panda-pulse.chart" . }} +{{ include "panda-pulse.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "panda-pulse.selectorLabels" -}} +app.kubernetes.io/name: {{ include "panda-pulse.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "panda-pulse.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "panda-pulse.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/panda-pulse/templates/cronjob.yaml b/charts/panda-pulse/templates/cronjob.yaml new file mode 100644 index 0000000..c8f7098 --- /dev/null +++ b/charts/panda-pulse/templates/cronjob.yaml @@ -0,0 +1,81 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ include "panda-pulse.fullname" . }} + labels: + {{- include "panda-pulse.labels" . | nindent 4 }} +spec: + schedule: {{ .Values.schedule | quote }} + concurrencyPolicy: Forbid + jobTemplate: + spec: + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 12 }} + {{- end }} + labels: + {{- include "panda-pulse.selectorLabels" . | nindent 12 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 12 }} + {{- end }} + serviceAccountName: {{ include "panda-pulse.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 12 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 16 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - --network={{ required "A valid network is required" .Values.config.network }} + - --discord-channel={{ required "A valid Discord channel ID is required" .Values.config.discordChannel }} + {{- if .Values.config.ethereumCl }} + - --ethereum-cl={{ .Values.config.ethereumCl }} + {{- end }} + {{- if .Values.config.ethereumEl }} + - --ethereum-el={{ .Values.config.ethereumEl }} + {{- end }} + {{- if .Values.config.grafanaBaseUrl }} + - --grafana-base-url={{ .Values.config.grafanaBaseUrl }} + {{- end }} + {{- if .Values.config.prometheusDatasourceId }} + - --prometheus-datasource-id={{ .Values.config.prometheusDatasourceId }} + {{- end }} + env: + - name: GRAFANA_SERVICE_TOKEN + valueFrom: + secretKeyRef: + name: {{ include "panda-pulse.fullname" . }} + key: grafana-service-token + - name: DISCORD_BOT_TOKEN + valueFrom: + secretKeyRef: + name: {{ include "panda-pulse.fullname" . }} + key: discord-bot-token + {{- if .Values.secrets.openrouterApiKey }} + - name: OPENROUTER_API_KEY + valueFrom: + secretKeyRef: + name: {{ include "panda-pulse.fullname" . }} + key: openrouter-api-key + {{- end }} + resources: + {{- toYaml .Values.resources | nindent 16 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 12 }} + {{- end }} + restartPolicy: OnFailure \ No newline at end of file diff --git a/charts/panda-pulse/templates/secret.yaml b/charts/panda-pulse/templates/secret.yaml new file mode 100644 index 0000000..e7dc579 --- /dev/null +++ b/charts/panda-pulse/templates/secret.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ include "panda-pulse.fullname" . }} + labels: + {{- include "panda-pulse.labels" . | nindent 4 }} +type: Opaque +data: + grafana-service-token: {{ required "A valid Grafana service token is required" .Values.secrets.grafanaServiceToken | b64enc }} + discord-bot-token: {{ required "A valid Discord bot token is required" .Values.secrets.discordBotToken | b64enc }} + {{- if .Values.secrets.openrouterApiKey }} + openrouter-api-key: {{ .Values.secrets.openrouterApiKey | b64enc }} + {{- end }} \ No newline at end of file diff --git a/charts/panda-pulse/templates/serviceaccount.yaml b/charts/panda-pulse/templates/serviceaccount.yaml new file mode 100644 index 0000000..529a7eb --- /dev/null +++ b/charts/panda-pulse/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "panda-pulse.serviceAccountName" . }} + labels: + {{- include "panda-pulse.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} \ No newline at end of file diff --git a/charts/panda-pulse/values.yaml b/charts/panda-pulse/values.yaml new file mode 100644 index 0000000..dbfc17a --- /dev/null +++ b/charts/panda-pulse/values.yaml @@ -0,0 +1,44 @@ +image: + repository: ethpandaops/panda-pulse + tag: latest + pullPolicy: IfNotPresent + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +schedule: "*/2 * * * *" # Run at 7am UTC daily + +config: + network: "" # required + discordChannel: "" # required + ethereumCl: "" # optional + ethereumEl: "" # optional + grafanaBaseUrl: "" # optional + prometheusDatasourceId: "" # optional + +secrets: + grafanaServiceToken: "" # required + discordBotToken: "" # required + openrouterApiKey: "" # optional + +resources: + limits: + cpu: 1000m + memory: 1Gi + requests: + cpu: 100m + memory: 128Mi + +serviceAccount: + create: true + annotations: {} + name: "" + +podAnnotations: {} +podSecurityContext: {} +securityContext: {} + +nodeSelector: {} +tolerations: [] +affinity: {} \ No newline at end of file From 083a69ea561c2708f7776e2d63e6eef0671b0975 Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Fri, 31 Jan 2025 09:51:02 +1000 Subject: [PATCH 2/5] style: update schedule format for consistency --- charts/panda-pulse/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/panda-pulse/values.yaml b/charts/panda-pulse/values.yaml index dbfc17a..36aa1c3 100644 --- a/charts/panda-pulse/values.yaml +++ b/charts/panda-pulse/values.yaml @@ -7,7 +7,7 @@ imagePullSecrets: [] nameOverride: "" fullnameOverride: "" -schedule: "*/2 * * * *" # Run at 7am UTC daily +schedule: "0 7 * * *" # Run at 7am UTC daily config: network: "" # required From 2f5bba6fe3d38ff2d9a0e4c35c29f02f39798051 Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Fri, 31 Jan 2025 10:03:24 +1000 Subject: [PATCH 3/5] build: Update Helm setup and chart testing versions --- .github/workflows/lint-test.yaml | 18 ++++++++++-------- .github/workflows/release.yaml | 6 +++--- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml index 5f25feb..ec95565 100644 --- a/.github/workflows/lint-test.yaml +++ b/.github/workflows/lint-test.yaml @@ -7,24 +7,26 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v4 with: - version: v3.7.0 + version: v3.16.2 - - uses: actions/setup-python@v2 + - uses: actions/setup-python@v5 with: - python-version: 3.7 + python-version: 3.12 - name: Run pre-commit hooks - uses: pre-commit/action@v3.0.0 + uses: pre-commit/action@v3.0.1 - name: Set up chart-testing - uses: helm/chart-testing-action@v2.1.0 + uses: helm/chart-testing-action@v2.6.1 + with: + version: "v3.11.0" - name: Run chart-testing (list-changed) id: list-changed @@ -38,7 +40,7 @@ jobs: run: ct lint --config ct.yaml - name: Create kind cluster - uses: helm/kind-action@v1.2.0 + uses: helm/kind-action@v1.10.0 if: steps.list-changed.outputs.changed == 'true' - name: Run chart-testing (install) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 72e127f..54e62ec 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,7 +12,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -22,9 +22,9 @@ jobs: git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - name: Set up Helm - uses: azure/setup-helm@v1 + uses: azure/setup-helm@v4 with: - version: v3.7.0 + version: v3.16.2 - name: Add repo dependencies run: helm repo add bitnami https://charts.bitnami.com/bitnami From 898b07004438187cb08db5340cbb1e870f752a9d Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Fri, 31 Jan 2025 10:04:03 +1000 Subject: [PATCH 4/5] feat: update cron schedule to run daily at 7 AM --- charts/panda-pulse/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/charts/panda-pulse/README.md b/charts/panda-pulse/README.md index 824f1f4..bf55077 100644 --- a/charts/panda-pulse/README.md +++ b/charts/panda-pulse/README.md @@ -34,7 +34,7 @@ A Helm chart for Panda Pulse - Ethereum network monitoring and reporting tool | resources.limits.memory | string | `"1Gi"` | | | resources.requests.cpu | string | `"100m"` | | | resources.requests.memory | string | `"128Mi"` | | -| schedule | string | `"*/2 * * * *"` | | +| schedule | string | `"0 7 * * *"` | | | secrets.discordBotToken | string | `""` | | | secrets.grafanaServiceToken | string | `""` | | | secrets.openrouterApiKey | string | `""` | | From bc5b98c14159d530d03060913261910b3e30fecb Mon Sep 17 00:00:00 2001 From: Matty Evans Date: Fri, 31 Jan 2025 10:08:29 +1000 Subject: [PATCH 5/5] style: Fix formatting inconsistencies in values.yaml --- charts/panda-pulse/Chart.yaml | 2 +- charts/panda-pulse/README.md | 8 ++++---- charts/panda-pulse/values.yaml | 10 +++++----- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/charts/panda-pulse/Chart.yaml b/charts/panda-pulse/Chart.yaml index a9ac78d..12242ef 100644 --- a/charts/panda-pulse/Chart.yaml +++ b/charts/panda-pulse/Chart.yaml @@ -3,7 +3,7 @@ name: panda-pulse description: A Helm chart for Panda Pulse - Ethereum network monitoring and reporting tool type: application version: 0.0.1 -appVersion: "latest" +appVersion: "latest" maintainers: - name: matty email: matt.evans@ethereum.org diff --git a/charts/panda-pulse/README.md b/charts/panda-pulse/README.md index bf55077..0c144d4 100644 --- a/charts/panda-pulse/README.md +++ b/charts/panda-pulse/README.md @@ -15,11 +15,11 @@ A Helm chart for Panda Pulse - Ethereum network monitoring and reporting tool | Key | Type | Default | Description | |-----|------|---------|-------------| | affinity | object | `{}` | | -| config.discordChannel | string | `""` | | +| config.discordChannel | string | `"YOUR_DISCORD_CHANNEL_ID"` | | | config.ethereumCl | string | `""` | | | config.ethereumEl | string | `""` | | | config.grafanaBaseUrl | string | `""` | | -| config.network | string | `""` | | +| config.network | string | `"YOUR_PREFERRED_NETWORK"` | | | config.prometheusDatasourceId | string | `""` | | | fullnameOverride | string | `""` | | | image.pullPolicy | string | `"IfNotPresent"` | | @@ -35,8 +35,8 @@ A Helm chart for Panda Pulse - Ethereum network monitoring and reporting tool | resources.requests.cpu | string | `"100m"` | | | resources.requests.memory | string | `"128Mi"` | | | schedule | string | `"0 7 * * *"` | | -| secrets.discordBotToken | string | `""` | | -| secrets.grafanaServiceToken | string | `""` | | +| secrets.discordBotToken | string | `"YOUR_DISCORD_BOT_TOKEN"` | | +| secrets.grafanaServiceToken | string | `"YOUR_GRAFANA_SERVICE_TOKEN"` | | | secrets.openrouterApiKey | string | `""` | | | securityContext | object | `{}` | | | serviceAccount.annotations | object | `{}` | | diff --git a/charts/panda-pulse/values.yaml b/charts/panda-pulse/values.yaml index 36aa1c3..a2a81f3 100644 --- a/charts/panda-pulse/values.yaml +++ b/charts/panda-pulse/values.yaml @@ -10,16 +10,16 @@ fullnameOverride: "" schedule: "0 7 * * *" # Run at 7am UTC daily config: - network: "" # required - discordChannel: "" # required + network: "YOUR_PREFERRED_NETWORK" # required + discordChannel: "YOUR_DISCORD_CHANNEL_ID" # required ethereumCl: "" # optional ethereumEl: "" # optional grafanaBaseUrl: "" # optional prometheusDatasourceId: "" # optional secrets: - grafanaServiceToken: "" # required - discordBotToken: "" # required + grafanaServiceToken: "YOUR_GRAFANA_SERVICE_TOKEN" # required + discordBotToken: "YOUR_DISCORD_BOT_TOKEN" # required openrouterApiKey: "" # optional resources: @@ -41,4 +41,4 @@ securityContext: {} nodeSelector: {} tolerations: [] -affinity: {} \ No newline at end of file +affinity: {}