Skip to content

Commit

Permalink
helm: Allow secrets to be used for environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
RyanConnell committed Mar 17, 2024
1 parent 66f21eb commit f098ffc
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
18 changes: 16 additions & 2 deletions helm/templates/cron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,23 @@ spec:
- /bin/concert-watcher scan --api-key $TICKETMASTER_API_KEY --artist-file /config/artists --discord-webhook-url $DISCORD_WEBHOOK_URL --ticketmaster-config /config/ticketmaster.yaml --diff --diff-file /data/previous-ids --include-partial-match
env:
- name: "TICKETMASTER_API_KEY"
value: "{{ .Values.ticketmaster.apiKey }}"
{{- if .Values.ticketmaster.apiKey.secret }}
valueFrom:
secretKeyRef:
name: "{{ .Values.ticketmaster.apiKey.secret.name }}"
key: "{{ .Values.ticketmaster.apiKey.secret.key }}"
{{- else }}
value: "{{ .Values.ticketmaster.apiKey.value }}"
{{- end }}
- name: "DISCORD_WEBHOOK_URL"
value: "{{ .Values.discord.webhookURL }}"
{{- if .Values.discord.webhookURL.secret }}
valueFrom:
secretKeyRef:
name: "{{ .Values.discord.webhookURL.secret.name }}"
key: "{{ .Values.discord.webhookURL.secret.key }}"
{{- else }}
value: "{{ .Values.discord.webhookURL.value }}"
{{- end }}
volumeMounts:
- name: config-map
mountPath: /config
Expand Down
16 changes: 14 additions & 2 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,22 @@ image:

discord:
# Add a webhook URL to enable discord notifications.
webhookURL: ""
webhookURL:
# If 'secret' is provided we will use that to populate DISCORD_WEBHOOK_URL.
secret:
name: concert-watcher
key: discord-webhook-url
# If 'secret' is not provided we can use 'value' instead.
value: "{DISCORD_API_KEY_GOES_HERE}"

ticketmaster:
apiKey: "{TICKETMASTER_API_KEY_GOES_HERE}"
apiKey:
# If 'secret' is provided we will use that to populate TICKETMASTER_API_KEY.
secret:
name: concert-watcher
key: ticketmaster-api-key
# If 'secret' is not provided we can use 'value' instead.
value: "{TICKETMASTER_API_KEY_GOES_HERE}"

storage:
className: nfs-client
Expand Down

0 comments on commit f098ffc

Please sign in to comment.