forked from kubernetes-sigs/node-feature-discovery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
helm: add post-delete hook that cleans up the node
This patch adds a post-delete hook to the Helm chart that runs "nfd-master --prune" in the cluster. This cleans up the node of labels, annotations, taints and extended resources that were created by NFD.
- Loading branch information
Showing
3 changed files
with
100 additions
and
1 deletion.
There are no files selected for viewing
94 changes: 94 additions & 0 deletions
94
deployment/helm/node-feature-discovery/templates/post-delete-job.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: {{ include "node-feature-discovery.master.serviceAccountName" . }}-prune | ||
namespace: {{ include "node-feature-discovery.namespace" . }} | ||
labels: | ||
{{- include "node-feature-discovery.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": post-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "node-feature-discovery.fullname" . }}-prune | ||
labels: | ||
{{- include "node-feature-discovery.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": post-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
rules: | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- nodes | ||
- nodes/status | ||
verbs: | ||
- get | ||
- patch | ||
- update | ||
- list | ||
--- | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "node-feature-discovery.fullname" . }}-prune | ||
labels: | ||
{{- include "node-feature-discovery.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": post-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "node-feature-discovery.fullname" . }}-prune | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "node-feature-discovery.fullname" . }}-prune | ||
namespace: {{ include "node-feature-discovery.namespace" . }} | ||
--- | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: {{ include "node-feature-discovery.fullname" . }}-prune | ||
namespace: {{ include "node-feature-discovery.namespace" . }} | ||
labels: | ||
{{- include "node-feature-discovery.labels" . | nindent 4 }} | ||
annotations: | ||
"helm.sh/hook": post-delete | ||
"helm.sh/hook-delete-policy": before-hook-creation,hook-succeeded | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
{{- include "node-feature-discovery.labels" . | nindent 8 }} | ||
role: prune | ||
spec: | ||
serviceAccountName: {{ include "node-feature-discovery.fullname" . }}-prune | ||
containers: | ||
- name: nfd-master | ||
securityContext: | ||
{{- toYaml .Values.master.securityContext | nindent 12 }} | ||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
command: | ||
- "nfd-master" | ||
args: | ||
- "-prune" | ||
{{- if .Values.master.instance | empty | not }} | ||
- "-instance={{ .Values.master.instance }}" | ||
{{- end }} | ||
restartPolicy: Never | ||
{{- with .Values.master.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.master.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.master.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters