Skip to content

Commit

Permalink
Support external-secrets conditionally to push-proxy (#465)
Browse files Browse the repository at this point in the history
Signed-off-by: Stavros Foteinopoulos <[email protected]>
  • Loading branch information
stafot authored Aug 6, 2024
1 parent 47470ec commit 52d1c09
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 7 deletions.
2 changes: 1 addition & 1 deletion charts/mattermost-push-proxy/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
description: Mattermost Push Proxy server
name: mattermost-push-proxy
type: application
version: 0.11.3
version: 0.12.0
appVersion: 6.1.0
keywords:
- mattermost
Expand Down
22 changes: 22 additions & 0 deletions charts/mattermost-push-proxy/templates/external_secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.externalSecrets.enabled -}}
apiVersion: external-secrets.io/v1beta1
kind: ExternalSecret
metadata:
name: {{ include "mattermost-push-proxy.name" . }}-aws-secret
labels:
app.kubernetes.io/name: {{ include "mattermost-push-proxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "mattermost-push-proxy.chart" . }}
spec:
refreshInterval: {{ .Values.externalSecrets.refreshInterval }}
secretStoreRef:
name: {{ .Values.externalSecrets.secretStoreName }}
kind: {{ .Values.externalSecrets.secretStoreKind }}
target:
name: {{ include "mattermost-push-proxy.name" . }}-secret
creationPolicy: Owner
data:
{{- with .Values.externalSecrets.data }}
{{- toYaml $.Values.externalSecrets.data | nindent 2 }}
{{- end }}
19 changes: 13 additions & 6 deletions charts/mattermost-push-proxy/templates/secrets.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Conditionally create the Apple certs secret if externalSecrets are not enabled
{{- if not .Values.externalSecrets.enabled }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -8,11 +10,15 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "mattermost-push-proxy.chart" . }}
data:
apple_auth_key: {{ default "" .Values.applePushSettings.authKey | b64enc | quote }}
apple_cert: {{ default "" .Values.applePushSettings.apple.privateCert | b64enc | quote }}
apple_rn_cert: {{ default "" .Values.applePushSettings.apple_rn.privateCert | b64enc | quote }}
apple_rnbeta_cert: {{ default "" .Values.applePushSettings.apple_rnbeta.privateCert | b64enc | quote }}
apple_auth_key: {{ .Values.applePushSettings.authKey | default "" | b64enc | quote }}
apple_cert: {{ .Values.applePushSettings.apple.privateCert | default "" | b64enc | quote }}
apple_rn_cert: {{ .Values.applePushSettings.apple_rn.privateCert | default "" | b64enc | quote }}
apple_rnbeta_cert: {{ .Values.applePushSettings.apple_rnbeta.privateCert | default "" | b64enc | quote }}
---
{{- end }}

# Conditionally create the Android service files secret if externalSecrets are not enabled
{{- if not .Values.externalSecrets.enabled }}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -23,5 +29,6 @@ metadata:
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "mattermost-push-proxy.chart" . }}
data:
android_serviceFile: {{ default "" .Values.androidPushSettings.android.serviceFile | toJson | b64enc | quote }}
android_rn_serviceFile: {{ default "" .Values.androidPushSettings.android_rn.serviceFile | toJson | b64enc | quote }}
android_serviceFile: {{ .Values.androidPushSettings.android.serviceFile | default "" | toJson | b64enc | quote }}
android_rn_serviceFile: {{ .Values.androidPushSettings.android_rn.serviceFile | default "" | toJson | b64enc | quote }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/mattermost-push-proxy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,10 @@ androidPushSettings:
# When setting serviceFileLocation both serviceFile and serviceFileName needs to be set
serviceFileLocation: ""
serviceFileName: ""
externalSecrets:
enabled: false
refreshInterval: 1h
secretStoreName: ""
secretStoreKind: ClusterSecretStore
# Data with base64 encoded format
data: {}

0 comments on commit 52d1c09

Please sign in to comment.