Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support custom labels #529

Merged
merged 2 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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: {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add this to the helm readme under the general config section with a description?

# app: aws-node-termination-handler

securityContext:
runAsUserID: 1000
runAsGroupID: 1000
Expand Down