diff --git a/templates/abandon-resources-hook.yaml b/templates/abandon-resources-hook.yaml new file mode 100644 index 0000000..68fbfe6 --- /dev/null +++ b/templates/abandon-resources-hook.yaml @@ -0,0 +1,36 @@ +# This job is used to stop Helm from managing resources without deleting them. +apiVersion: batch/v1 +kind: Job +metadata: + name: kotsadm-abandon-resources + annotations: + helm.sh/hook: pre-upgrade + helm.sh/hook-weight: "2" + labels: + {{- include "admin-console.labels" . | nindent 4 }} +spec: + template: + metadata: + labels: + {{- include "admin-console.labels" . | nindent 8 }} + spec: + containers: + - command: + - /bin/sh + - -c + - | + if kubectl get configmap kotsadm-confg -n {{ .Release.Namespace }} -o jsonpath='{.metadata.labels.app\.kubernetes\.io/managed-by}' | grep -q "Helm"; then + kubectl annotate configmap kotsadm-confg -n {{ .Release.Namespace }} helm.sh/resource-policy=keep + fi + if kubectl get configmap kotsadm-application-metadata -n {{ .Release.Namespace }} -o jsonpath='{.metadata.labels.app\.kubernetes\.io/managed-by}' | grep -q "Helm"; then + kubectl annotate configmap kotsadm-application-metadata -n {{ .Release.Namespace }} helm.sh/resource-policy=keep + fi + image: {{ .Values.images.kotsadm }} + imagePullPolicy: IfNotPresent + name: abandon-resources + resources: + requests: + cpu: 100m + memory: 100Mi + restartPolicy: OnFailure + serviceAccountName: kotsadm diff --git a/templates/kotsadm-config.yaml b/templates/kotsadm-config.yaml deleted file mode 100644 index 9cc0ad1..0000000 --- a/templates/kotsadm-config.yaml +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: ConfigMap -metadata: - labels: - {{- include "admin-console.labels" . | nindent 4 }} - name: kotsadm-confg -data: - initial-app-images-pushed: "false" - minio-enabled-snapshots: "false" - registry-is-read-only: "false" - with-minio: "false"