Skip to content

Commit

Permalink
fix: correct use args and extraArgs (#22)
Browse files Browse the repository at this point in the history
* fix: correct use args and extraArgs

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

* feat: bump version

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>

---------

Signed-off-by: Smuu <18609909+Smuu@users.noreply.github.com>
  • Loading branch information
smuu authored Aug 7, 2024
1 parent 6762f3a commit 3051511
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 13 deletions.
2 changes: 1 addition & 1 deletion charts/celestia-node/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ maintainers:
name: celestia-node
sources:
- https://github.com/celestiaorg/celestia-node
version: 0.1.3
version: 0.1.4
8 changes: 6 additions & 2 deletions charts/celestia-node/templates/NOTES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,9 @@ In order to replicate the container startup scripts execute this command:

{{- end }}

{{- include "common.warnings.rollingTag" .Values.node.image }}
{{- include "node.validateValues" . }}
{{- "\n" -}}
{{- include "common.warnings.rollingTag" .Values.node.image -}}
{{- "\n" -}}
{{- include "node.deprecationWarnings" . -}}
{{- "\n" -}}
{{- include "node.validateValues" . -}}
37 changes: 28 additions & 9 deletions charts/celestia-node/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,18 @@ Generate the args for the node container based on the nodeType setting
*/}}
{{- define "node.containerArgs" -}}
{{- if .Values.node.args -}}
{{- .Values.node.args -}}
{{- .Values.node.args | toYaml -}}
{{- else -}}
{{- $nodeType := .Values.node.settings.nodeType | default "bridge" -}}
{{- $args := list $nodeType -}}
{{- $args := append $args "start" -}}
{{- $args := list (printf "%s" $nodeType) -}}
{{- $args := append $args (printf "start") -}}
{{- $args := append $args (printf "--node.store=$(CELESTIA_HOME)") -}}
{{- if .Values.node.extraArgs -}}
{{- $args := append $args .Values.node.extraArgs -}}
{{- range .Values.node.extraArgs -}}
{{- $args = append $args (printf "%s" .) -}}
{{- end -}}
{{- end -}}
{{- $args -}}
{{- $args | toYaml -}}
{{- end -}}
{{- end -}}

Expand All @@ -64,17 +66,34 @@ Node type is not set. Must be one of 'bridge', 'full', or 'light'.
{{- else if and (ne .Values.node.settings.nodeType "bridge") (ne .Values.node.settings.nodeType "full") (ne .Values.node.settings.nodeType "light") -}}
Invalid node type: {{ .Values.node.settings.nodeType }}. Must be one of 'bridge', 'full', or 'light'.
{{- else if (hasKey .Values.node "args") -}}
DEPRECATION WARNING: The use of node.args is deprecated. Please configure container args using node.settings.nodeType and node.extraArgs.
{{- if not (eq .Values.node.settings.nodeType (first .Values.node.args)) -}}
The nodeType value ({{ .Values.node.settings.nodeType }}) does not match the first argument in args ({{ first .Values.node.args }}).
{{- if .Values.node.args -}}
{{- if not (eq .Values.node.settings.nodeType (first .Values.node.args)) -}}
The nodeType value ({{ .Values.node.settings.nodeType }}) does not match the first argument in args ({{ first .Values.node.args }}).
{{- end -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Compile all deprecation warnings into a single message.
*/}}
{{- define "node.deprecationWarnings" -}}
{{- $warnings := list -}}
{{- if .Values.node.args -}}
DEPRECATION WARNING: The use of node.args is deprecated. Please configure container args using node.settings.nodeType and node.extraArgs.
{{- end -}}
{{- $warnings := without $warnings "" -}}
{{- $warning := join "\n" $warnings -}}

{{- if $warning -}}
{{- $warning -}}
{{- end -}}
{{- end -}}

# TODO: add validations for values
# Remember to add the validation message to NOTES.txt at the end ({{- include "node.validateValues" . }})
{{/*
Compile all warnings into a single message and fail the deployment if there are any.
Compile all validation messages into a single message and fail the deployment if there are any.
*/}}
{{- define "node.validateValues" -}}
{{- $messages := list -}}
Expand Down
2 changes: 1 addition & 1 deletion charts/celestia-node/templates/statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ spec:
{{- if .Values.diagnosticMode.enabled }}
args: {{- include "common.tplvalues.render" (dict "value" .Values.diagnosticMode.args "context" $) | nindent 12 }}
{{- else }}
args: {{ include "node.containerArgs" . | toYaml | nindent 12 }}
args: {{ include "node.containerArgs" . | nindent 12 }}
{{- end }}
env:
- name: CELESTIA_HOME
Expand Down

0 comments on commit 3051511

Please sign in to comment.