From 68785b0468a799c5166f1338e801f095533a5053 Mon Sep 17 00:00:00 2001 From: Andrew Davis <1709934+Savid@users.noreply.github.com> Date: Wed, 28 Aug 2024 17:45:12 +1000 Subject: [PATCH] feat(charts/tracoor-single): default to postgre (#335) * feat(charts/tracoor-single): default to postgres --- charts/tracoor-single/Chart.lock | 6 ++++ charts/tracoor-single/Chart.yaml | 7 +++- charts/tracoor-single/README.md | 25 +++++++++++++-- .../tracoor-single/templates/configmap.yaml | 7 +++- charts/tracoor-single/values.yaml | 32 ++++++++++++++++--- 5 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 charts/tracoor-single/Chart.lock diff --git a/charts/tracoor-single/Chart.lock b/charts/tracoor-single/Chart.lock new file mode 100644 index 00000000..ccc1bce4 --- /dev/null +++ b/charts/tracoor-single/Chart.lock @@ -0,0 +1,6 @@ +dependencies: +- name: postgresql + repository: https://charts.bitnami.com/bitnami + version: 15.5.23 +digest: sha256:a73e983312ae193a283a720706a0b231907bfce54513b459c830704497640bb4 +generated: "2024-08-23T11:54:16.007074244+10:00" diff --git a/charts/tracoor-single/Chart.yaml b/charts/tracoor-single/Chart.yaml index 7afe65ee..b0c2c265 100644 --- a/charts/tracoor-single/Chart.yaml +++ b/charts/tracoor-single/Chart.yaml @@ -3,9 +3,14 @@ name: tracoor-single description: Ethereum debug data capture and indexer home: https://github.com/ethpandaops/tracoor type: application -version: 0.0.3 +version: 0.0.4 maintainers: - name: samcm email: sam.calder-mason@ethereum.org - name: savid email: andrew.davis@ethereum.org +dependencies: + - name: postgresql + version: "15.x.x" + repository: "https://charts.bitnami.com/bitnami" + condition: postgresql.enabled diff --git a/charts/tracoor-single/README.md b/charts/tracoor-single/README.md index 7b692a29..1638933c 100644 --- a/charts/tracoor-single/README.md +++ b/charts/tracoor-single/README.md @@ -1,12 +1,18 @@ # tracoor-single -![Version: 0.0.3](https://img.shields.io/badge/Version-0.0.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) +![Version: 0.0.4](https://img.shields.io/badge/Version-0.0.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) Ethereum debug data capture and indexer **Homepage:** +## Requirements + +| Repository | Name | Version | +|------------|------|---------| +| https://charts.bitnami.com/bitnami | postgresql | 15.x.x | + ## Values | Key | Type | Default | Description | @@ -28,8 +34,7 @@ Ethereum debug data capture and indexer | config.server.addr | string | `":8081"` | | | config.server.gatewayAddr | string | `":8080"` | | | config.server.ntpServer | string | `"time.google.com"` | | -| config.server.persistence.driver_name | string | `"sqlite"` | | -| config.server.persistence.dsn | string | `"file:/data/tracoor.db"` | | +| config.server.persistence | object | `{}` | | | config.server.pprofAddr | string | `":6060"` | | | config.server.preStopSleepSeconds | int | `1` | | | config.server.services.indexer.retention.beaconBlocks | string | `"30m"` | | @@ -79,6 +84,20 @@ Ethereum debug data capture and indexer | podAnnotations | object | `{}` | Pod annotations | | podDisruptionBudget | object | `{}` | Define the PodDisruptionBudget spec If not set then a PodDisruptionBudget will not be created | | podLabels | object | `{}` | Pod labels | +| postgresql.auth.database | string | `"tracoor"` | | +| postgresql.auth.enablePostgresUser | bool | `true` | | +| postgresql.auth.password | string | `"postgres"` | | +| postgresql.auth.postgresPassword | string | `"postgres"` | | +| postgresql.auth.username | string | `"postgres"` | | +| postgresql.enabled | bool | `true` | | +| postgresql.image.registry | string | `"docker.io"` | | +| postgresql.image.repository | string | `"bitnami/postgresql"` | | +| postgresql.image.tag | string | `"16.4.0-debian-12-r2"` | | +| postgresql.name | string | `"{{ .Release.Name }}-postgresql"` | If enabled a postgres chart will be deployed as a dependency | +| postgresql.persistence.enabled | bool | `true` | | +| postgresql.persistence.size | string | `"8Gi"` | | +| postgresql.primary.extendedConfiguration | string | `"max_connections = 1024\n"` | | +| postgresql.pullPolicy | string | `"IfNotPresent"` | | | priorityClassName | string | `nil` | Pod priority class | | readinessProbe | object | See `values.yaml` | Readiness probe | | replicas | int | `1` | Number of replicas | diff --git a/charts/tracoor-single/templates/configmap.yaml b/charts/tracoor-single/templates/configmap.yaml index 8c4c9b34..15d468dd 100644 --- a/charts/tracoor-single/templates/configmap.yaml +++ b/charts/tracoor-single/templates/configmap.yaml @@ -6,4 +6,9 @@ metadata: {{- include "tracoor-single.labels" . | nindent 4 }} data: config.yaml: |- - {{ toYaml .Values.config | nindent 4 }} + {{- $config := deepCopy .Values.config -}} + {{- if .Values.postgresql.enabled -}} + {{- $_ := set $config.server.persistence "dsn" (printf "postgres://%s:%s@%s:5432/%s?sslmode=disable" .Values.postgresql.auth.username .Values.postgresql.auth.password (tpl .Values.postgresql.name $) .Values.postgresql.auth.database) -}} + {{- $_ := set $config.server.persistence "driver_name" "postgres" -}} + {{- end -}} + {{ toYaml $config | nindent 4 }} diff --git a/charts/tracoor-single/values.yaml b/charts/tracoor-single/values.yaml index f660b91a..5636fde3 100644 --- a/charts/tracoor-single/values.yaml +++ b/charts/tracoor-single/values.yaml @@ -48,11 +48,11 @@ config: pprofAddr: ":6060" preStopSleepSeconds: 1 ntpServer: time.google.com - - persistence: - dsn: "file:/data/tracoor.db" - driver_name: sqlite - + persistence: {} + # If postgres.enabled = true, this block will be overwritten. + # Example sqlite: + # dsn: "file:/data/tracoor.db" + # driver_name: sqlite services: indexer: retention: @@ -303,3 +303,25 @@ serviceMonitor: scrapeTimeout: 30s # -- ServiceMonitor relabelings relabelings: [] + +postgresql: + # -- If enabled a postgres chart will be deployed as a dependency + name: "{{ .Release.Name }}-postgresql" + enabled: true + image: + registry: docker.io + repository: bitnami/postgresql + tag: 16.4.0-debian-12-r2 + pullPolicy: IfNotPresent + auth: + enablePostgresUser: true + postgresPassword: postgres + database: tracoor + username: postgres + password: postgres + primary: + extendedConfiguration: | + max_connections = 1024 + persistence: + enabled: true + size: 8Gi