From 2147f63c20356fd02cd2d00ddededb79086b679b Mon Sep 17 00:00:00 2001 From: smuu <18609909+smuu@users.noreply.github.com> Date: Tue, 1 Oct 2024 16:26:49 +0200 Subject: [PATCH] feat: Skip Validation, Disable HostPort, and Misc Fixes (#56) * feat: possibility to skip validation Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> * feat: option to disable hostPort Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> --------- Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com> --- charts/celestia-app/templates/_helpers.tpl | 6 +++++- charts/celestia-app/values.yaml | 2 ++ charts/celestia-node/templates/_helpers.tpl | 6 +++++- .../celestia-node/templates/statefulset.yaml | 18 ++++++++++++++++++ charts/celestia-node/values.yaml | 8 ++++++++ 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/charts/celestia-app/templates/_helpers.tpl b/charts/celestia-app/templates/_helpers.tpl index b507d07..f60396d 100644 --- a/charts/celestia-app/templates/_helpers.tpl +++ b/charts/celestia-app/templates/_helpers.tpl @@ -51,6 +51,10 @@ Compile all warnings into a single message. {{- $message := join "\n" $messages -}} {{- if $message -}} -{{- printf "\nVALUES VALIDATION:\n%s" $message -}} + {{- if .Values.global.skipValidationWarnings -}} + {{- print (printf "\nVALUES VALIDATION WARNINGS:\n%s" $message) -}} + {{- else -}} + {{- fail (printf "\nVALUES VALIDATION:\n%s" $message) -}} + {{- end -}} {{- end -}} {{- end -}} diff --git a/charts/celestia-app/values.yaml b/charts/celestia-app/values.yaml index 6f30a4f..b496525 100644 --- a/charts/celestia-app/values.yaml +++ b/charts/celestia-app/values.yaml @@ -10,6 +10,7 @@ ## @param global.imageRegistry Global Docker image registry ## @param global.imagePullSecrets Global Docker registry secret names as an array ## @param global.storageClass Global StorageClass for Persistent Volume(s) +## @param global.skipValidationWarnings Skip validation warnings ## global: imageRegistry: "" @@ -19,6 +20,7 @@ global: ## imagePullSecrets: [] storageClass: "" + skipValidationWarnings: false ## Compatibility adaptations for Kubernetes platforms ## compatibility: diff --git a/charts/celestia-node/templates/_helpers.tpl b/charts/celestia-node/templates/_helpers.tpl index 654bd51..b009e35 100644 --- a/charts/celestia-node/templates/_helpers.tpl +++ b/charts/celestia-node/templates/_helpers.tpl @@ -108,6 +108,10 @@ Compile all validation messages into a single message and fail the deployment if {{- $message := join "\n" $messages -}} {{- if $message -}} -{{- fail (printf "\nVALUES VALIDATION:\n%s" $message) -}} + {{- if .Values.global.skipValidationWarnings -}} + {{- print (printf "\nVALUES VALIDATION WARNINGS:\n%s" $message) -}} + {{- else -}} + {{- fail (printf "\nVALUES VALIDATION:\n%s" $message) -}} + {{- end -}} {{- end -}} {{- end -}} diff --git a/charts/celestia-node/templates/statefulset.yaml b/charts/celestia-node/templates/statefulset.yaml index ec124b0..8f58339 100644 --- a/charts/celestia-node/templates/statefulset.yaml +++ b/charts/celestia-node/templates/statefulset.yaml @@ -123,6 +123,7 @@ spec: - name: home-dir # This is needed so that the process has permissions to create files in the home directory mountPath: /home readOnly: false + {{- if .Values.node.settings.secret.enabled }} - name: keys image: busybox command: @@ -138,11 +139,14 @@ spec: chown -R {{ .Values.node.containerSecurityContext.runAsUser }}:{{ .Values.node.containerSecurityContext.runAsGroup }} /keys-volume/ find /keys-volume/ -type f -exec chmod 0600 {} \; volumeMounts: + {{- if .Values.node.settings.secret.enabled }} - name: keys mountPath: /keys readOnly: true + {{- end }} - name: keys-volume mountPath: /keys-volume + {{- end }} {{- if .Values.node.initContainers }} {{- include "common.tplvalues.render" (dict "value" .Values.node.initContainers "context" $) | nindent 8 }} {{- end }} @@ -194,22 +198,32 @@ spec: ports: - name: p2p-tcp containerPort: {{ .Values.node.containerPorts.p2p }} + {{- if .Values.node.enableHostPort }} hostPort: {{ .Values.node.containerPorts.p2p }} + {{- end }} protocol: TCP - name: p2p-udp containerPort: {{ .Values.node.containerPorts.p2p }} + {{- if .Values.node.enableHostPort }} hostPort: {{ .Values.node.containerPorts.p2p }} + {{- end }} protocol: UDP - name: ws containerPort: {{ .Values.node.containerPorts.ws }} + {{- if .Values.node.enableHostPort }} hostPort: {{ .Values.node.containerPorts.ws }} + {{- end }} protocol: TCP - name: rest containerPort: {{ .Values.node.containerPorts.rest }} + {{- if .Values.node.enableHostPort }} hostPort: {{ .Values.node.containerPorts.rest }} + {{- end }} - name: rpc containerPort: {{ .Values.node.containerPorts.rpc }} + {{- if .Values.node.enableHostPort }} hostPort: {{ .Values.node.containerPorts.rpc }} + {{- end }} - name: profiling containerPort: {{ .Values.node.containerPorts.profiling }} - name: prometheus @@ -294,6 +308,7 @@ spec: {{- if .Values.node.extraVolumeMounts }} {{- include "common.tplvalues.render" (dict "value" .Values.node.extraVolumeMounts "context" $) | nindent 12 }} {{- end }} + {{- if .Values.node.otelAgent.enabled }} - name: otel-agent image: {{ template "node.otelAgent.image" . }} imagePullPolicy: {{ .Values.node.otelAgent.image.pullPolicy }} @@ -331,10 +346,12 @@ spec: - name: otel-agent-config mountPath: /etc/otelcol-contrib/config.yaml subPath: config.yaml + {{- end }} {{- if .Values.node.sidecars }} {{- include "common.tplvalues.render" ( dict "value" .Values.node.sidecars "context" $) | nindent 8 }} {{- end }} volumes: + {{- if .Values.node.settings.secret.enabled }} - name: keys secret: secretName: {{ .Values.node.settings.secret.name }} @@ -349,6 +366,7 @@ spec: path: uid - key: address path: address + {{- end }} - name: keys-volume emptyDir: {} - name: home-dir diff --git a/charts/celestia-node/values.yaml b/charts/celestia-node/values.yaml index b0fafc5..41626b6 100644 --- a/charts/celestia-node/values.yaml +++ b/charts/celestia-node/values.yaml @@ -10,6 +10,7 @@ ## @param global.imageRegistry Global Docker image registry ## @param global.imagePullSecrets Global Docker registry secret names as an array ## @param global.storageClass Global StorageClass for Persistent Volume(s) +## @param global.skipValidationWarnings Skip validation warnings ## global: imageRegistry: "" @@ -19,6 +20,8 @@ global: ## imagePullSecrets: [] storageClass: "" + ## Use with caution, this will skip validation warnings + skipValidationWarnings: false ## Compatibility adaptations for Kubernetes platforms ## compatibility: @@ -139,6 +142,7 @@ node: ## - key: NJ3XILLTMVRXEZLUFZVHO5A ## - key: OAZHALLLMV4Q secret: + enabled: true # -- name of the secret, it must be set name: SET_IT ws: @@ -547,6 +551,10 @@ node: profiling: 6060 # -- Prometheus container port, 8890 by default prometheus: 8890 + ## @param node.enableHostPort Enable hostPort for the node + ## + # -- Enable hostPort for the node + enableHostPort: true ## Configure extra options for node containers' liveness and readiness probes ## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-liveness-readiness-probes/#configure-probes ## @param node.livenessProbe.enabled Enable livenessProbe on node containers