Skip to content

Commit

Permalink
Support upgrade (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
nsainaney authored Nov 17, 2023
1 parent c7e0edf commit 54e30bb
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 3 deletions.
13 changes: 12 additions & 1 deletion charts/codezero/templates/configmap.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@

{{- define "codezero.spaceID" -}}
{{- $existingCM := lookup "v1" "ConfigMap" .Release.Namespace (include "codezero.name" .) -}}
{{- if $existingCM -}}
{{ $existingCM.data | toYaml }}
{{- else -}}
spaceID: ""
{{- end -}}
{{- end -}}


apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "codezero.name" . }}
data:
spaceID: ""
{{ include "codezero.spaceID" . | indent 2 -}}
1 change: 1 addition & 0 deletions charts/codezero/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# I'm not sure why this is safe for both install and
apiVersion: v1
kind: Secret
metadata:
Expand Down
15 changes: 13 additions & 2 deletions charts/codezero/templates/system/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
{{- if eq .Values.space.token "" }}
{{- if and (eq .Values.space.token "") (.Release.IsInstall) }}
{{- fail "A Values.token is required" }}
{{- end }}


{{- define "codezero.spaceToken" -}}
{{- $existingSecret := lookup "v1" "Secret" .Release.Namespace (include "system.name" .) -}}
{{- if $existingSecret -}}
{{ $existingSecret.data | toYaml }}
{{- else -}}
CZ_HUB_SPACE_TOKEN: {{ .Values.space.token | b64enc }}
{{- end -}}
{{- end -}}


apiVersion: v1
kind: Secret
metadata:
name: {{ include "system.name" . }}
data:
CZ_HUB_SPACE_TOKEN: {{ .Values.space.token | b64enc }}
{{ include "codezero.spaceToken" . | indent 2 -}}

0 comments on commit 54e30bb

Please sign in to comment.