Skip to content

Commit

Permalink
Support custom labels (#529)
Browse files Browse the repository at this point in the history
* Add: support custom labels

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>

* Fix: do not add custom labels

Signed-off-by: Nicolas Lamirault <nicolas.lamirault@gmail.com>
  • Loading branch information
nlamirault authored Dec 15, 2021
1 parent ffd6a1c commit ceadee9
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,17 @@ Name will not exceed 63 characters.
Common labels
*/}}
{{- define "aws-node-termination-handler.labels" -}}
helm.sh/chart: {{ include "aws-node-termination-handler.chart" . }}
{{ include "aws-node-termination-handler.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/component: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Release.Name }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
helm.sh/chart: {{ include "aws-node-termination-handler.chart" . }}
{{- if .Values.customLabels }}
{{ toYaml .Values.customLabels }}
{{- end }}
{{- end -}}

{{/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "aws-node-termination-handler.fullname" . }}
labels:
{{- include "aws-node-termination-handler.labels" . | nindent 4 }}
rules:
- apiGroups:
- ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
name: {{ include "aws-node-termination-handler.fullname" . }}
labels:
{{- include "aws-node-termination-handler.labels" . | nindent 4 }}
subjects:
- kind: ServiceAccount
name: {{ template "aws-node-termination-handler.serviceAccountName" . }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
{{- end }}
{{- end }}
labels:
{{- include "aws-node-termination-handler.selectorLabels" . | nindent 8 }}
{{- include "aws-node-termination-handler.labels" . | nindent 8 }}
k8s-app: aws-node-termination-handler
{{ include "aws-node-termination-handler.nodeSelectorTermsOs" . }}: linux
{{- range $key, $value := (mergeOverwrite (dict) .Values.podLabels .Values.linuxPodLabels) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ spec:
{{- end }}
{{- end }}
labels:
{{- include "aws-node-termination-handler.selectorLabels" . | nindent 8 }}
{{- include "aws-node-termination-handler.labels" . | nindent 8 }}
k8s-app: aws-node-termination-handler
{{ include "aws-node-termination-handler.nodeSelectorTermsOs" . }}: windows
{{- range $key, $value := (mergeOverwrite (dict) .Values.podLabels .Values.windowsPodLabels) }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ spec:
{{ $key }}: {{ $value | quote }}
{{- end }}
labels:
{{- include "aws-node-termination-handler.selectorLabels" . | nindent 8 }}
{{- include "aws-node-termination-handler.labels" . | nindent 8 }}
k8s-app: aws-node-termination-handler
{{ include "aws-node-termination-handler.nodeSelectorTermsOs" . }}: linux
{{- range $key, $value := .Values.podLabels }}
Expand Down
4 changes: 4 additions & 0 deletions config/helm/aws-node-termination-handler/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ image:
pullPolicy: IfNotPresent
pullSecrets: []

# -- Custom labels to add into metadata
customLabels: {}
# app: aws-node-termination-handler

securityContext:
runAsUserID: 1000
runAsGroupID: 1000
Expand Down

0 comments on commit ceadee9

Please sign in to comment.