1+ # Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved.
2+ #
3+ # Licensed under the Apache License, Version 2.0 (the "License");
4+ # you may not use this file except in compliance with the License.
5+ # You may obtain a copy of the License at
6+ #
7+ # http://www.apache.org/licenses/LICENSE-2.0
8+ #
9+ # Unless required by applicable law or agreed to in writing, software
10+ # distributed under the License is distributed on an "AS IS" BASIS,
11+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+ # See the License for the specific language governing permissions and
13+ # limitations under the License.
14+
15+ {{ if .Values.nodeConditionCleanup.enabled }}
16+ ---
17+ apiVersion : v1
18+ kind : ServiceAccount
19+ metadata :
20+ name : {{ include "nvsentinel.fullname" . }}-node-condition-cleanup
21+ namespace : {{ .Release.Namespace }}
22+ labels :
23+ {{- include "nvsentinel.labels" . | nindent 4 }}
24+ annotations :
25+ helm.sh/hook : post-upgrade
26+ helm.sh/hook-weight : " -5"
27+ helm.sh/hook-delete-policy : before-hook-creation,hook-succeeded,hook-failed
28+ argocd.argoproj.io/hook : PostSync
29+ argocd.argoproj.io/hook-delete-policy : BeforeHookCreation
30+ ---
31+ apiVersion : rbac.authorization.k8s.io/v1
32+ kind : ClusterRole
33+ metadata :
34+ name : {{ include "nvsentinel.fullname" . }}-node-condition-cleanup
35+ labels :
36+ {{- include "nvsentinel.labels" . | nindent 4 }}
37+ annotations :
38+ helm.sh/hook : post-upgrade
39+ helm.sh/hook-weight : " -5"
40+ helm.sh/hook-delete-policy : before-hook-creation,hook-succeeded,hook-failed
41+ argocd.argoproj.io/hook : PostSync
42+ argocd.argoproj.io/hook-delete-policy : BeforeHookCreation
43+ rules :
44+ - apiGroups :
45+ - " "
46+ resources :
47+ - nodes
48+ verbs :
49+ - get
50+ - list
51+ - patch
52+ - apiGroups :
53+ - " "
54+ resources :
55+ - nodes/status
56+ verbs :
57+ - get
58+ - patch
59+ - update
60+ ---
61+ apiVersion : rbac.authorization.k8s.io/v1
62+ kind : ClusterRoleBinding
63+ metadata :
64+ name : {{ include "nvsentinel.fullname" . }}-node-condition-cleanup
65+ labels :
66+ {{- include "nvsentinel.labels" . | nindent 4 }}
67+ annotations :
68+ helm.sh/hook : post-upgrade
69+ helm.sh/hook-weight : " -5"
70+ helm.sh/hook-delete-policy : before-hook-creation,hook-succeeded,hook-failed
71+ argocd.argoproj.io/hook : PostSync
72+ argocd.argoproj.io/hook-delete-policy : BeforeHookCreation
73+ roleRef :
74+ apiGroup : rbac.authorization.k8s.io
75+ kind : ClusterRole
76+ name : {{ include "nvsentinel.fullname" . }}-node-condition-cleanup
77+ subjects :
78+ - kind : ServiceAccount
79+ name : {{ include "nvsentinel.fullname" . }}-node-condition-cleanup
80+ namespace : {{ .Release.Namespace }}
81+ ---
82+ apiVersion : batch/v1
83+ kind : Job
84+ metadata :
85+ name : {{ include "nvsentinel.fullname" . }}-node-condition-cleanup
86+ namespace : {{ .Release.Namespace }}
87+ labels :
88+ {{- include "nvsentinel.labels" . | nindent 4 }}
89+ annotations :
90+ helm.sh/hook : post-upgrade
91+ helm.sh/hook-weight : " -5"
92+ helm.sh/hook-delete-policy : before-hook-creation,hook-succeeded,hook-failed
93+ argocd.argoproj.io/hook : PostSync
94+ argocd.argoproj.io/hook-delete-policy : BeforeHookCreation
95+ spec :
96+ backoffLimit : 3
97+ activeDeadlineSeconds : 300
98+ template :
99+ metadata :
100+ labels :
101+ {{- include "nvsentinel.selectorLabels" . | nindent 8 }}
102+ app.kubernetes.io/component : node-condition-cleanup
103+ spec :
104+ serviceAccountName : {{ include "nvsentinel.fullname" . }}-node-condition-cleanup
105+ restartPolicy : OnFailure
106+ {{- with .Values.global.imagePullSecrets }}
107+ imagePullSecrets :
108+ {{- toYaml . | nindent 8 }}
109+ {{- end }}
110+ {{- with .Values.nodeConditionCleanup.nodeSelector }}
111+ nodeSelector :
112+ {{- toYaml . | nindent 8 }}
113+ {{- end }}
114+ {{- with .Values.nodeConditionCleanup.tolerations }}
115+ tolerations :
116+ {{- toYaml . | nindent 8 }}
117+ {{- end }}
118+ containers :
119+ - name : cleanup
120+ image : {{ .Values.nodeConditionCleanup.image.repository }}:{{ .Values.nodeConditionCleanup.image.tag }}
121+ imagePullPolicy : {{ .Values.nodeConditionCleanup.image.pullPolicy }}
122+ env :
123+ - name : DEPRECATED_CONDITIONS
124+ value : {{ .Values.nodeConditionCleanup.deprecatedConditions | join "," | quote }}
125+ command :
126+ - /bin/bash
127+ - -c
128+ - |
129+ {{ .Files.Get "files/node-condition-cleanup.sh" | indent 10 }}
130+ resources :
131+ {{- toYaml .Values.nodeConditionCleanup.resources | nindent 10 }}
132+ securityContext :
133+ allowPrivilegeEscalation : false
134+ runAsNonRoot : true
135+ runAsUser : 65534
136+ readOnlyRootFilesystem : true
137+ capabilities :
138+ drop :
139+ - ALL
140+ seccompProfile :
141+ type : RuntimeDefault
142+ {{- end }}
0 commit comments