fix: split env config and image pull secret into separate helm releases
Bundling these Secrets in the app helm chart caused two bugs in the scheduler-k3s plugin: a chart rollback could delete Secrets that older ReplicaSets still referenced by exact timestamped name (`env-{app}.{ts}` and `ims-{app}.{ts}`), hard-crashing pods until manual intervention; and the strategic-merge `patchMergeKey` on `imagePullSecrets` let stale entries leak into the live Deployment until the list pointed at many nonexistent Secrets. Each Secret now lives in its own helm release with a stable name (`config-{app}` and `pull-secret-{app}`), installed before the app chart on every deploy. The deployment trigger also prunes any leaked `imagePullSecrets` entries from the live Deployment so the next deploy lands on a clean list, and the rename and destroy paths uninstall the new releases (and the previously-leaked TLS release on rename) under the old app name.
This commit is contained in:
18 files changed
+1086
-56
No files matched your search
@@ -77,7 +77,7 @@ spec:
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
|
||||
name: config-{{ $.Values.global.app_name }}
|
||||
optional: true
|
||||
image: {{ $.Values.global.image.name }}
|
||||
imagePullPolicy: Always
|
||||
|
||||
@@ -74,7 +74,7 @@ spec:
|
||||
{{- end }}
|
||||
envFrom:
|
||||
- secretRef:
|
||||
name: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
|
||||
name: config-{{ $.Values.global.app_name }}
|
||||
optional: true
|
||||
image: {{ $.Values.global.image.name }}
|
||||
imagePullPolicy: Always
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
{{- if $.Values.global.image.pull_secret_base64 }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
|
||||
dokku.com/managed: "true"
|
||||
{{ include "print.annotations" (dict "config" $.Values.global "key" "secret") | indent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/instance: ims-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
|
||||
app.kubernetes.io/name: ims-{{ $.Values.global.app_name }}
|
||||
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
|
||||
{{ include "print.labels" (dict "config" $.Values.global "key" "secret") | indent 4 }}
|
||||
name: ims-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
|
||||
namespace: {{ $.Values.global.namespace }}
|
||||
data:
|
||||
.dockerconfigjson: "{{ $.Values.global.image.pull_secret_base64 }}"
|
||||
type: kubernetes.io/dockerconfigjson
|
||||
{{- end }}
|
||||
@@ -1,19 +0,0 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
annotations:
|
||||
app.kubernetes.io/version: {{ $.Values.global.deployment_id | quote }}
|
||||
dokku.com/managed: "true"
|
||||
{{ include "print.annotations" (dict "config" $.Values.global "key" "secret") | indent 4 }}
|
||||
labels:
|
||||
app.kubernetes.io/instance: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
|
||||
app.kubernetes.io/name: env-{{ $.Values.global.app_name }}
|
||||
app.kubernetes.io/part-of: {{ $.Values.global.app_name }}
|
||||
{{ include "print.labels" (dict "config" $.Values.global "key" "secret") | indent 4 }}
|
||||
name: env-{{ $.Values.global.app_name }}.{{ $.Values.global.deployment_id }}
|
||||
namespace: {{ $.Values.global.namespace }}
|
||||
{{- with .Values.global.secrets }}
|
||||
data:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: config-{{ .Values.global.app_name }}
|
||||
namespace: {{ .Values.global.namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: config-{{ .Values.global.app_name }}
|
||||
app.kubernetes.io/part-of: {{ .Values.global.app_name }}
|
||||
annotations:
|
||||
dokku.com/managed: "true"
|
||||
{{- with .Values.global.secrets }}
|
||||
data:
|
||||
{{- toYaml . | nindent 2 }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: kubernetes.io/dockerconfigjson
|
||||
metadata:
|
||||
name: pull-secret-{{ .Values.global.app_name }}
|
||||
namespace: {{ .Values.global.namespace }}
|
||||
labels:
|
||||
app.kubernetes.io/name: pull-secret-{{ .Values.global.app_name }}
|
||||
app.kubernetes.io/part-of: {{ .Values.global.app_name }}
|
||||
annotations:
|
||||
dokku.com/managed: "true"
|
||||
data:
|
||||
.dockerconfigjson: {{ .Values.global.pull_secret_base64 | quote }}
|
||||
Reference in new issue
Block a user