Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Abandon removed resources but don't delete them on upgrade #40

Merged
merged 1 commit into from
Mar 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions templates/abandon-resources-hook.yaml
Original file line number Diff line number Diff line change
@@ -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
11 changes: 0 additions & 11 deletions templates/kotsadm-config.yaml

This file was deleted.

Loading