Skip to content

Commit

Permalink
support existing secrets
Browse files Browse the repository at this point in the history
  • Loading branch information
svenwiltink committed Oct 8, 2024
1 parent 2bab978 commit 4a38095
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion charts/playgroundbot/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.0.6
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
Expand Down
4 changes: 4 additions & 0 deletions charts/playgroundbot/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,11 @@ spec:
- name: DISCORD_TOKEN
valueFrom:
secretKeyRef:
{{- if .Values.existingSecret }}
name: "{{ .Values.existingSecret }}"
{{- else }}
name: {{ include "playgroundbot.fullname" . }}
{{- end }}
key: token
resources:
{{- toYaml .Values.resources | nindent 12 }}
Expand Down
4 changes: 3 additions & 1 deletion charts/playgroundbot/templates/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{- if not .Values.existingSecret -}}
apiVersion: v1
kind: Secret
metadata:
Expand All @@ -6,4 +7,5 @@ metadata:
{{- include "playgroundbot.labels" . | nindent 4 }}
type: Opaque
data:
token: {{ .Values.botToken | required "botToken is required" | b64enc }}
token: {{ .Values.botToken | required "botToken is required" | b64enc }}
{{- end -}}
3 changes: 3 additions & 0 deletions charts/playgroundbot/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ image:

botToken: ""

# an existing secret containing the token, otherwise one will be created
existingSecret: ""

imagePullSecrets: []
nameOverride: ""
fullnameOverride: ""
Expand Down

0 comments on commit 4a38095

Please sign in to comment.