diff --git a/charts/celo-fullnode/Chart.yaml b/charts/celo-fullnode/Chart.yaml index b2cce4fa..6f88204c 100644 --- a/charts/celo-fullnode/Chart.yaml +++ b/charts/celo-fullnode/Chart.yaml @@ -19,7 +19,7 @@ keywords: - Validator - Ethereum - Proof-of-Stake -version: 0.5.4 +version: 0.5.5 dependencies: - name: common repository: oci://us-west1-docker.pkg.dev/devopsre/clabs-public-oci diff --git a/charts/celo-fullnode/README.md b/charts/celo-fullnode/README.md index 83425329..e1f3abf7 100644 --- a/charts/celo-fullnode/README.md +++ b/charts/celo-fullnode/README.md @@ -2,7 +2,7 @@ Helm chart for deploying a Celo fullnode. More info at https://docs.celo.org -![Version: 0.5.4](https://img.shields.io/badge/Version-0.5.4-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.6.0](https://img.shields.io/badge/AppVersion-1.6.0-informational?style=flat-square) +![Version: 0.5.5](https://img.shields.io/badge/Version-0.5.5-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 1.6.0](https://img.shields.io/badge/AppVersion-1.6.0-informational?style=flat-square) - [celo-fullnode](#celo-fullnode) - [Chart requirements](#chart-requirements) @@ -34,7 +34,7 @@ To install/manage a release named `celo-mainnet-fullnode` connected to `mainnet` ```bash # Select the chart release to use -CHART_RELEASE="oci://us-west1-docker.pkg.dev/celo-testnet/clabs-public-oci/celo-fullnode --version=0.5.4" # Use remote chart and specific version +CHART_RELEASE="oci://us-west1-docker.pkg.dev/celo-testnet/clabs-public-oci/celo-fullnode --version=0.5.5" # Use remote chart and specific version CHART_RELEASE="./" # Use this local folder # (Only for local chart) Sync helm dependencies @@ -60,7 +60,8 @@ helm upgrade celo-mainnet-fullnode -f values-mainnet-node.yaml --namespace=celo |-----|------|---------|-------------| | aws | bool | `false` | Enables aws specific settings | | azure | bool | `false` | Enables azure specific settings | -| deletePodCronJob | object | `{"enabled":false,"podIndex":0,"schedule":"0 10 * * 1,4"}` | Enable a CronJob that will delete a pod of the statefulset to force flushing the data to disk | +| deletePodCronJob | object | `{"enabled":false,"extraFlags":"","podIndex":0,"schedule":"0 10 * * 1,4"}` | Enable a CronJob that will delete a pod of the statefulset to force flushing the data to disk | +| deletePodCronJob.extraFlags | string | `""` | Extra cmd flags to pass to the delete pod command | | deletePodCronJob.podIndex | int | `0` | Statefulset index to delete | | deletePodCronJob.schedule | string | `"0 10 * * 1,4"` | Cron expression for the CronJob | | extraPodLabels | object | `{}` | Labels to add to the podTemplateSpec from statefulset | diff --git a/charts/celo-fullnode/ci/test-values.yaml b/charts/celo-fullnode/ci/test-values.yaml index a8753077..6076a3f2 100644 --- a/charts/celo-fullnode/ci/test-values.yaml +++ b/charts/celo-fullnode/ci/test-values.yaml @@ -12,3 +12,6 @@ geth: memory: 500Mi cpu: 0.5 syncmode: lightest + +deletePodCronJob: + enabled: true diff --git a/charts/celo-fullnode/templates/delete-pod-cronjob.yaml b/charts/celo-fullnode/templates/delete-pod-cronjob.yaml new file mode 100644 index 00000000..198fbfbc --- /dev/null +++ b/charts/celo-fullnode/templates/delete-pod-cronjob.yaml @@ -0,0 +1,97 @@ +{{- if .Values.deletePodCronJob.enabled -}} +{{- /* +This CronJob in intended to delete regularly a geth pod +in order to force geth to flush the data to disk, so it can +be used as an snapshot +*/}} +apiVersion: batch/v1 +kind: CronJob +metadata: + labels: + {{- include "common.standard.labels" . | nindent 4 }} + component: restart-geth + name: {{ template "common.fullname" . }}-restart-geth +spec: + concurrencyPolicy: Forbid + failedJobsHistoryLimit: 1 + jobTemplate: + spec: + backoffLimit: 1 + template: + metadata: + labels: + {{- include "common.standard.labels" . | nindent 12 }} + component: restart-geth + spec: + containers: + - name: restart-geth + command: + - /bin/sh + - -c + args: + - | + extraFlags="{{ .Values.deletePodCronJob.extraFlags }}" + kubectl delete pod -n {{ .Release.Namespace }} "${extraFlags}" {{ printf "%s-%d" (include "common.fullname" .) (.Values.deletePodCronJob.podIndex | int) }} + image: bitnami/kubectl:latest + imagePullPolicy: Always + terminationMessagePath: /dev/termination-log + terminationMessagePolicy: File + dnsPolicy: ClusterFirst + restartPolicy: Never + schedulerName: default-scheduler + serviceAccountName: {{ template "common.fullname" . }}-restart-geth + terminationGracePeriodSeconds: 30 + schedule: "{{ .Values.deletePodCronJob.schedule }}" + successfulJobsHistoryLimit: 3 + suspend: true +--- +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + {{- include "common.standard.labels" . | nindent 4 }} + component: restart-geth + name: {{ template "common.fullname" . }}-restart-geth +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + {{- include "common.standard.labels" . | nindent 4 }} + component: restart-geth + name: {{ template "common.fullname" . }}-restart-geth +rules: +- apiGroups: + - "" + resources: + - namespaces + verbs: + - get +- apiGroups: + - "" + resources: + - pods + verbs: + - get + - list + - watch + - delete + - update + - patch +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + {{- include "common.standard.labels" . | nindent 4 }} + component: restart-geth + name: {{ template "common.fullname" . }}-restart-geth +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "common.fullname" . }}-restart-geth +subjects: +- kind: ServiceAccount + name: {{ template "common.fullname" . }}-restart-geth + namespace: {{ .Release.Namespace }} +{{- end }} diff --git a/charts/celo-fullnode/values.yaml b/charts/celo-fullnode/values.yaml index cda37a09..16616483 100644 --- a/charts/celo-fullnode/values.yaml +++ b/charts/celo-fullnode/values.yaml @@ -208,3 +208,5 @@ deletePodCronJob: schedule: "0 10 * * 1,4" # -- Statefulset index to delete podIndex: 0 + # -- Extra cmd flags to pass to the delete pod command + extraFlags: ""