Skip to content

Commit 99217c4

Browse files
decobotclaude
andcommitted
feat(chart): support github.existingSecret for GITHUB_TOKEN
Reads token from a K8s Secret (via ExternalSecret) instead of hardcoding in values. Falls back to github.token if set. Safe: if github key is absent in values, no change to deployment. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 52a7f54 commit 99217c4

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

hack/helm-generator/main.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,15 @@ func addEnvVarsToDeployment(templatesDir string) error {
188188
contentStr := string(content)
189189

190190
// Find the image line and add env vars after it
191-
envBlock := ` {{- if or .Values.github.token (and .Values.valkey (get .Values.valkey "sentinelUrls")) }}
191+
envBlock := ` {{- if or (and .Values.github (or .Values.github.token .Values.github.existingSecret)) (and .Values.valkey (get .Values.valkey "sentinelUrls")) }}
192192
env:
193-
{{- if .Values.github.token }}
193+
{{- if and .Values.github .Values.github.existingSecret }}
194+
- name: GITHUB_TOKEN
195+
valueFrom:
196+
secretKeyRef:
197+
name: {{ .Values.github.existingSecret | quote }}
198+
key: {{ .Values.github.existingSecretKey | default "token" | quote }}
199+
{{- else if and .Values.github .Values.github.token }}
194200
- name: GITHUB_TOKEN
195201
value: {{ .Values.github.token | quote }}
196202
{{- end }}

0 commit comments

Comments
 (0)