Skip to content

Commit

Permalink
fix secret name determination
Browse files Browse the repository at this point in the history
  • Loading branch information
jessebot committed Mar 25, 2024
1 parent 28af460 commit 3a9cf14
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 25 deletions.
47 changes: 29 additions & 18 deletions charts/netmaker/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -149,44 +149,55 @@ Database for postgresql
netmaker db secret
*/}}
{{- define "netmaker.db.secret" -}}
{{- if .Values.postgresql.auth.existingSecret }}
{{ print "%s" .Values.postgresql.auth.existingSecret }}
{{- else if .Values.externalDatabase.existingSecret }}
{{ print "%s" .Values.externalDatabase.existingSecret }}
{{- else }}
{{ print "db-secret" }}
{{- if .Values.postgresql.auth.existingSecret -}}
{{ .Values.postgresql.auth.existingSecret }}
{{- else if .Values.externalDatabase.existingSecret -}}
{{ .Values.externalDatabase.existingSecret }}
{{- else -}}
db-secret
{{- end }}
{{- end }}

{{/*
netmaker secret
*/}}
{{- define "netmaker.secret" -}}
{{- if .Values.netmaker.existingSecret }}
{{ print "%s" .Values.netmaker.existingSecret }}
{{- else }}
{{ print "netmaker-secret" }}
{{- if .Values.netmaker.existingSecret -}}
{{ .Values.netmaker.existingSecret }}
{{- else -}}
netmaker-secret
{{- end }}
{{- end }}

{{/*
mqtt (broker) secret
*/}}
{{- define "netmaker.mq.secret" -}}
{{- if .Values.mq.existingSecret -}}
{{ .Values.mq.existingSecret }}
{{- else -}}
mq-secret
{{- end }}
{{- end }}

{{/*
netmaker oauth secret
*/}}
{{- define "netmaker.oauth.secret" -}}
{{- if .Values.netmaker.oauth.existingSecret }}
{{ print "%s" .Values.netmaker.oauth.existingSecret }}
{{- else }}
{{ print "netmaker-oauth-secret" }}
{{- if .Values.netmaker.oauth.existingSecret -}}
{{ .Values.netmaker.oauth.existingSecret }}
{{- else -}}
netmaker-oauth-secret
{{- end }}
{{- end }}

{{/*
netmaker turn secret
*/}}
{{- define "netmaker.turn.secret" -}}
{{- if .Values.netmaker.turn.existingSecret }}
{{ print "%s" .Values.netmaker.turn.existingSecret }}
{{- else }}
{{ print "turn-secret" }}
{{- if .Values.netmaker.turn.existingSecret -}}
{{ .Values.netmaker.turn.existingSecret }}
{{- else -}}
turn-secret
{{- end }}
{{- end }}
20 changes: 17 additions & 3 deletions charts/netmaker/templates/mq-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,23 @@ spec:
command: ["/mosquitto/config/wait.sh"]
imagePullPolicy: Always

env:
- name: NETMAKER_SERVER_HOST
value: https://{{ required "A valid .Values.mq.ingress.host entry required!" .Values.mq.ingress.host }}
envFrom:
- configMapRef:
name: {{ include "netmaker.fullname" . }}-env
- secretRef:
name: {{ include "netmaker.secret" . }}
- secretRef:
name: {{ include "netmaker.mq.secret" . }}
- secretRef:
name: {{ include "netmaker.db.secret" . }}
{{- if .Values.netmaker.oauth.enabled }}
- secretRef:
name: {{ include "netmaker.oauth.secret" . }}
{{- end }}
{{- if .Values.turn.enabled -}}
- secretRef:
name: {{ include "netmaker.turn.secret" . }}
{{- end }}

ports:
- containerPort: 1883
Expand Down
10 changes: 6 additions & 4 deletions charts/netmaker/templates/netmaker-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ spec:
name: {{ include "netmaker.fullname" . }}-env
- secretRef:
name: {{ include "netmaker.secret" . }}
{{- if .Values.netmaker.oauth.enabled }}
- secretRef:
name: {{ include "netmaker.oauth.secret" . }}
{{- end -}}
name: {{ include "netmaker.mq.secret" . }}
- secretRef:
name: {{ include "netmaker.db.secret" . }}
{{- if .Values.netmaker.oauth.enabled }}
- secretRef:
name: {{ include "netmaker.oauth.secret" . }}
{{- end }}
{{- if .Values.turn.enabled -}}
- secretRef:
name: {{ include "netmaker.turn.secret" . }}
{{- end -}}
{{- end }}
ports:
- containerPort: {{ .Values.api.service.port }}
protocol: TCP
Expand Down

0 comments on commit 3a9cf14

Please sign in to comment.