2022-01-28 16:22:12 +00:00
|
|
|
{{- if and (not .Values.enableSqsTerminationDraining) (lower .Values.targetNodeOs | contains "linux") -}}
|
2021-12-01 15:43:42 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: DaemonSet
|
|
|
|
metadata:
|
|
|
|
name: {{ include "aws-node-termination-handler.fullname" . }}
|
2022-04-08 15:10:17 +00:00
|
|
|
namespace: {{ .Release.Namespace }}
|
2021-12-01 15:43:42 +00:00
|
|
|
labels:
|
2022-05-16 08:14:02 +00:00
|
|
|
{{- include "aws-node-termination-handler.labelsDaemonset" . | nindent 4 }}
|
2021-12-01 15:43:42 +00:00
|
|
|
spec:
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- with .Values.updateStrategy }}
|
2021-12-01 15:43:42 +00:00
|
|
|
updateStrategy:
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- toYaml . | nindent 4 }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end }}
|
|
|
|
selector:
|
|
|
|
matchLabels:
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- include "aws-node-termination-handler.selectorLabelsDaemonset" . | nindent 6 }}
|
|
|
|
kubernetes.io/os: linux
|
2021-12-01 15:43:42 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- include "aws-node-termination-handler.selectorLabelsDaemonset" . | nindent 8 }}
|
|
|
|
kubernetes.io/os: linux
|
2021-12-01 15:43:42 +00:00
|
|
|
k8s-app: aws-node-termination-handler
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- with (mergeOverwrite (dict) .Values.podLabels .Values.linuxPodLabels) }}
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if or .Values.podAnnotations .Values.linuxPodAnnotations }}
|
|
|
|
annotations:
|
|
|
|
{{- toYaml (mergeOverwrite (dict) .Values.podAnnotations .Values.linuxPodAnnotations) | nindent 8 }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end }}
|
|
|
|
spec:
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- with .Values.image.pullSecrets }}
|
|
|
|
imagePullSecrets:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
serviceAccountName: {{ include "aws-node-termination-handler.serviceAccountName" . }}
|
|
|
|
{{- with .Values.podSecurityContext }}
|
|
|
|
securityContext:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.daemonsetPriorityClassName }}
|
|
|
|
priorityClassName: {{ . }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.terminationGracePeriodSeconds }}
|
|
|
|
terminationGracePeriodSeconds: {{ . }}
|
|
|
|
{{- end }}
|
2021-12-01 15:43:42 +00:00
|
|
|
hostNetwork: {{ .Values.useHostNetwork }}
|
2022-01-28 16:22:12 +00:00
|
|
|
dnsPolicy: {{ default .Values.linuxDnsPolicy .Values.dnsPolicy }}
|
2022-04-08 15:10:17 +00:00
|
|
|
{{- with .Values.dnsConfig }}
|
|
|
|
dnsConfig:
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
2021-12-01 15:43:42 +00:00
|
|
|
containers:
|
2022-01-28 16:22:12 +00:00
|
|
|
- name: aws-node-termination-handler
|
|
|
|
{{- with .Values.securityContext }}
|
2021-12-01 15:43:42 +00:00
|
|
|
securityContext:
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- toYaml . | nindent 12 }}
|
|
|
|
{{- end }}
|
|
|
|
image: {{ include "aws-node-termination-handler.image" . }}
|
|
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
|
|
env:
|
|
|
|
- name: NODE_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: spec.nodeName
|
|
|
|
- name: POD_NAME
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.name
|
|
|
|
- name: NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
|
|
|
- name: ENABLE_PROBES_SERVER
|
|
|
|
value: {{ .Values.enableProbesServer | quote }}
|
|
|
|
- name: PROBES_SERVER_PORT
|
|
|
|
value: {{ .Values.probes.httpGet.port | quote }}
|
|
|
|
- name: PROBES_SERVER_ENDPOINT
|
|
|
|
value: {{ .Values.probes.httpGet.path | quote }}
|
|
|
|
- name: LOG_LEVEL
|
|
|
|
value: {{ .Values.logLevel | quote }}
|
|
|
|
- name: JSON_LOGGING
|
|
|
|
value: {{ .Values.jsonLogging | quote }}
|
2022-12-06 15:56:25 +00:00
|
|
|
- name: LOG_FORMAT_VERSION
|
|
|
|
value: {{ .Values.logFormatVersion | quote }}
|
2022-01-28 16:22:12 +00:00
|
|
|
- name: ENABLE_PROMETHEUS_SERVER
|
|
|
|
value: {{ .Values.enablePrometheusServer | quote }}
|
|
|
|
- name: PROMETHEUS_SERVER_PORT
|
|
|
|
value: {{ .Values.prometheusServerPort | quote }}
|
|
|
|
{{- with .Values.instanceMetadataURL }}
|
|
|
|
- name: INSTANCE_METADATA_URL
|
|
|
|
value: {{ . | quote }}
|
|
|
|
{{- end }}
|
|
|
|
- name: METADATA_TRIES
|
|
|
|
value: {{ .Values.metadataTries | quote }}
|
|
|
|
- name: DRY_RUN
|
|
|
|
value: {{ .Values.dryRun | quote }}
|
|
|
|
- name: CORDON_ONLY
|
|
|
|
value: {{ .Values.cordonOnly | quote }}
|
|
|
|
- name: TAINT_NODE
|
|
|
|
value: {{ .Values.taintNode | quote }}
|
2022-04-08 15:10:17 +00:00
|
|
|
- name: EXCLUDE_FROM_LOAD_BALANCERS
|
|
|
|
value: {{ .Values.excludeFromLoadBalancers | quote }}
|
2022-01-28 16:22:12 +00:00
|
|
|
- name: DELETE_LOCAL_DATA
|
|
|
|
value: {{ .Values.deleteLocalData | quote }}
|
|
|
|
- name: IGNORE_DAEMON_SETS
|
|
|
|
value: {{ .Values.ignoreDaemonSets | quote }}
|
|
|
|
- name: POD_TERMINATION_GRACE_PERIOD
|
|
|
|
value: {{ .Values.podTerminationGracePeriod | quote }}
|
|
|
|
- name: NODE_TERMINATION_GRACE_PERIOD
|
|
|
|
value: {{ .Values.nodeTerminationGracePeriod | quote }}
|
|
|
|
- name: EMIT_KUBERNETES_EVENTS
|
|
|
|
value: {{ .Values.emitKubernetesEvents | quote }}
|
|
|
|
{{- with .Values.kubernetesEventsExtraAnnotations }}
|
|
|
|
- name: KUBERNETES_EVENTS_EXTRA_ANNOTATIONS
|
|
|
|
value: {{ . | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if or .Values.webhookURL .Values.webhookURLSecretName }}
|
|
|
|
- name: WEBHOOK_URL
|
|
|
|
{{- if .Values.webhookURLSecretName }}
|
|
|
|
valueFrom:
|
|
|
|
secretKeyRef:
|
|
|
|
name: {{ .Values.webhookURLSecretName }}
|
|
|
|
key: webhookurl
|
|
|
|
{{- else }}
|
|
|
|
value: {{ .Values.webhookURL | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.webhookHeaders }}
|
|
|
|
- name: WEBHOOK_HEADERS
|
|
|
|
value: {{ . | quote }}
|
|
|
|
{{- end }}
|
|
|
|
{{- with .Values.webhookProxy }}
|
|
|
|
- name: WEBHOOK_PROXY
|
|
|
|
value: {{ . | quote }}
|
|
|
|
{{- end }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- if and .Values.webhookTemplateConfigMapName .Values.webhookTemplateConfigMapKey }}
|
2022-01-28 16:22:12 +00:00
|
|
|
- name: WEBHOOK_TEMPLATE_FILE
|
|
|
|
value: {{ print "/config/" .Values.webhookTemplateConfigMapKey | quote }}
|
|
|
|
{{- else if .Values.webhookTemplate }}
|
|
|
|
- name: WEBHOOK_TEMPLATE
|
|
|
|
value: {{ .Values.webhookTemplate | quote }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end }}
|
2022-01-28 16:22:12 +00:00
|
|
|
- name: ENABLE_SPOT_INTERRUPTION_DRAINING
|
|
|
|
value: {{ .Values.enableSpotInterruptionDraining | quote }}
|
|
|
|
- name: ENABLE_SCHEDULED_EVENT_DRAINING
|
|
|
|
value: {{ .Values.enableScheduledEventDraining | quote }}
|
|
|
|
- name: ENABLE_REBALANCE_MONITORING
|
|
|
|
value: {{ .Values.enableRebalanceMonitoring | quote }}
|
|
|
|
- name: ENABLE_REBALANCE_DRAINING
|
|
|
|
value: {{ .Values.enableRebalanceDraining | quote }}
|
|
|
|
- name: ENABLE_SQS_TERMINATION_DRAINING
|
|
|
|
value: "false"
|
|
|
|
- name: UPTIME_FROM_FILE
|
|
|
|
value: {{ .Values.procUptimeFile | quote }}
|
2022-11-11 14:59:18 +00:00
|
|
|
{{- with .Values.extraEnv }}
|
|
|
|
{{- toYaml . | nindent 12 }}
|
|
|
|
{{- end }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- if or .Values.enablePrometheusServer .Values.enableProbesServer }}
|
|
|
|
ports:
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- if .Values.enableProbesServer }}
|
|
|
|
- name: liveness-probe
|
|
|
|
protocol: TCP
|
|
|
|
containerPort: {{ .Values.probes.httpGet.port }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.enablePrometheusServer }}
|
2022-04-08 15:10:17 +00:00
|
|
|
- name: http-metrics
|
|
|
|
protocol: TCP
|
|
|
|
containerPort: {{ .Values.prometheusServerPort }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
|
|
|
{{- if .Values.enableProbesServer }}
|
|
|
|
livenessProbe:
|
|
|
|
{{- toYaml .Values.probes | nindent 12 }}
|
|
|
|
{{- end }}
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- with .Values.resources }}
|
|
|
|
resources:
|
|
|
|
{{- toYaml . | nindent 12 }}
|
|
|
|
{{- end }}
|
|
|
|
volumeMounts:
|
|
|
|
- name: uptime
|
|
|
|
mountPath: {{ .Values.procUptimeFile }}
|
|
|
|
readOnly: true
|
|
|
|
{{- if and .Values.webhookTemplateConfigMapName .Values.webhookTemplateConfigMapKey }}
|
|
|
|
- name: webhook-template
|
|
|
|
mountPath: /config/
|
|
|
|
{{- end }}
|
|
|
|
volumes:
|
|
|
|
- name: uptime
|
|
|
|
hostPath:
|
|
|
|
path: {{ .Values.procUptimeFile | default "/proc/uptime" }}
|
|
|
|
{{- if and .Values.webhookTemplateConfigMapName .Values.webhookTemplateConfigMapKey }}
|
|
|
|
- name: webhook-template
|
|
|
|
configMap:
|
|
|
|
name: {{ .Values.webhookTemplateConfigMapName }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end }}
|
2022-01-28 16:22:12 +00:00
|
|
|
nodeSelector:
|
|
|
|
kubernetes.io/os: linux
|
|
|
|
{{- with default .Values.daemonsetNodeSelector (default .Values.nodeSelector .Values.linuxNodeSelector) }}
|
|
|
|
{{- toYaml . | nindent 8 }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end }}
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- if or .Values.daemonsetAffinity (or .Values.affinity .Values.linuxAffinity) }}
|
|
|
|
affinity:
|
|
|
|
{{- toYaml (default .Values.daemonsetAffinity (default .Values.affinity .Values.linuxAffinity)) | nindent 8 }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end }}
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- if or .Values.daemonsetTolerations (or .Values.tolerations .Values.linuxTolerations) }}
|
2021-12-01 15:43:42 +00:00
|
|
|
tolerations:
|
2022-01-28 16:22:12 +00:00
|
|
|
{{- toYaml (default .Values.daemonsetTolerations (default .Values.tolerations .Values.linuxTolerations )) | nindent 8 }}
|
|
|
|
{{- end }}
|
2021-12-01 15:43:42 +00:00
|
|
|
{{- end -}}
|