Skip to content

Commit

Permalink
create mail secret when upgrading / add hooks for other secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
bbkz committed Jan 31, 2025
1 parent 6029f4b commit 515d680
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 7 deletions.
12 changes: 8 additions & 4 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
## 0.2.2

* Every helm upgrade will restart the deployments
* Create/Update secrets in pre-* hooks

### Mail settings

* Creates a secret for the mail password
* Values to setup the mail configuration
* Creates a new secret for the mail password
* Manually created secrets can be used with:
```yaml
secret:
name: yoursecret
key: yourkey
app:
mail:
secret:
name: yoursecret
key: yourkey
```
## 0.2.1
Expand Down
3 changes: 3 additions & 0 deletions charts/wger/templates/secret-django.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ kind: Secret
metadata:
name: {{ .Values.app.django.secret.name | default "django" }}
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-install,pre-upgrade,pre-rollback
helm.sh/hook-weight: "-5"
stringData:
{{ if .Values.app.django.secret.key }}
secret-key: {{ .Values.app.django.secret.key | quote }}
Expand Down
3 changes: 3 additions & 0 deletions charts/wger/templates/secret-flower.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ kind: Secret
metadata:
name: {{ .Values.celery.flower.secret.name | default "flower" }}
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-install,pre-upgrade,pre-rollback
helm.sh/hook-weight: "-5"
stringData:
{{ if .Values.celery.flower.secret.password }}
password: {{ .Values.celery.flower.secret.password | quote }}
Expand Down
3 changes: 3 additions & 0 deletions charts/wger/templates/secret-jwt.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ kind: Secret
metadata:
name: {{ .Values.app.jwt.secret.name | default "jwt" }}
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/hook: pre-install,pre-upgrade,pre-rollback
helm.sh/hook-weight: "-5"
stringData:
{{ if .Values.app.jwt.secret.key }}
signing-key: {{ .Values.app.jwt.secret.key | quote }}
Expand Down
2 changes: 2 additions & 0 deletions charts/wger/templates/secret-mail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ metadata:
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: keep
helm.sh/hook: pre-install,pre-upgrade,pre-rollback
helm.sh/hook-weight: "-5"
data:
{{ .Values.app.mail.secret.key }}: {{ .Values.app.mail.secret.password | b64enc | quote }}
{{- end }}
Expand Down
15 changes: 12 additions & 3 deletions charts/wger/templates/secret-redis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,24 @@ kind: Secret
metadata:
name: redis
namespace: {{ .Release.Namespace }}
annotations:
helm.sh/resource-policy: keep
helm.sh/hook: pre-install,pre-upgrade,pre-rollback
helm.sh/hook-weight: "-5"
data:
{{- if .Values.redis.auth.password }}
{{- if .Values.redis.auth.password }}
redis-password: {{ .Values.redis.auth.password | b64enc | quote }}
{{ else }}
{{ else }}
{{- if .Release.IsUpgrade }}
{{- if (lookup "v1" "Secret" .Release.Namespace "redis") }}
redis-password: {{ index (lookup "v1" "Secret" .Release.Namespace "redis").data "redis-password" | quote }}
{{- else }}
redis-password: {{ randAlphaNum 25 | b64enc | quote }}
{{- end }}
{{ else }}
redis-password: {{ randAlphaNum 25 | b64enc | quote }}
{{- end }}
{{- end }}
{{- end }}
---
{{- end }}
{{- end }}

0 comments on commit 515d680

Please sign in to comment.