Skip to content

Commit

Permalink
fix: use pre-install helm hook to prepare rancher for turtles
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Salas <carlos.salas@suse.com>
  • Loading branch information
salasberryfin committed Oct 4, 2023
1 parent e2c2adb commit 618938e
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions charts/rancher-turtles/templates/pre-install-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
---
apiVersion: management.cattle.io/v3
kind: Feature
metadata:
name: embedded-cluster-api
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
spec:
value: false
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: pre-install-job
namespace: rancher-turtles-system
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: pre-install-job-delete-webhooks
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
rules:
- apiGroups:
- admissionregistration.k8s.io
resources:
- validatingwebhookconfigurations
- mutatingwebhookconfigurations
verbs:
- delete
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: pre-install-job-webhook-cleanup
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "1"
subjects:
- kind: ServiceAccount
name: pre-install-job
namespace: rancher-turtles-system
roleRef:
kind: ClusterRole
name: pre-install-job-delete-webhooks
apiGroup: rbac.authorization.k8s.io
---
apiVersion: batch/v1
kind: Job
metadata:
name: rancher-webhook-cleanup
annotations:
"helm.sh/hook": pre-install
"helm.sh/hook-weight": "2"
spec:
ttlSecondsAfterFinished: 300
template:
spec:
serviceAccountName: pre-install-job
containers:
- name: rancher-webhook-cleanup
image: bitnami/kubectl
command: ["/bin/bash", "-c"]
args:
- |
kubectl delete mutatingwebhookconfigurations.admissionregistration.k8s.io mutating-webhook-configuration --ignore-not-found=true
kubectl delete validatingwebhookconfigurations.admissionregistration.k8s.io validating-webhook-configuration --ignore-not-found=true
restartPolicy: Never

0 comments on commit 618938e

Please sign in to comment.