-
Notifications
You must be signed in to change notification settings - Fork 48
Expand file tree
/
Copy pathpre_delete_hook_job.yaml
More file actions
104 lines (104 loc) · 2.93 KB
/
pre_delete_hook_job.yaml
File metadata and controls
104 lines (104 loc) · 2.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
name: kruise-helm-hook-role
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "1"
rules:
- apiGroups:
- apps.kruise.io
resources:
- clonesets
verbs:
- list
- apiGroups:
- apps.kruise.io
resources:
- daemonsets
verbs:
- list
- apiGroups:
- apps.kruise.io
resources:
- statefulsets
verbs:
- list
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: kruise-helm-hook-rolebinding
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "2"
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kruise-helm-hook-role
subjects:
- kind: ServiceAccount
name: kruise-helm-hook
namespace: {{ .Values.installation.namespace }}
---
apiVersion: batch/v1
kind: Job
metadata:
name: "{{ .Release.Name }}-finalizer"
namespace: {{ .Values.installation.namespace }}
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
app.kubernetes.io/version: {{ .Chart.AppVersion }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
kruise: helm-finalizer
annotations:
# This is what defines this resource as a hook. Without this line, the
# job is considered part of the release.
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "4"
spec:
backoffLimit: 0
template:
metadata:
name: "{{ .Release.Name }}-finalizer"
labels:
app.kubernetes.io/managed-by: {{ .Release.Service | quote }}
app.kubernetes.io/instance: {{ .Release.Name | quote }}
helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
kruise: helm-finalizer
spec:
restartPolicy: Never
serviceAccountName: kruise-helm-hook
containers:
- name: pre-delete-job
image: {{ .Values.helmHooks.image.repository }}:{{ .Values.helmHooks.image.tag }}
imagePullPolicy: IfNotPresent
{{- with .Values.helmHooks.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.helmHooks.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.helmHooks.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
---
# write a service account named kruise-helm-hook:
apiVersion: v1
kind: ServiceAccount
metadata:
name: kruise-helm-hook
namespace: {{ .Values.installation.namespace }}
annotations:
"helm.sh/hook": pre-delete
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded
"helm.sh/hook-weight": "3"