From f6ac0e84d96698f1d153e9680205708fec8acc81 Mon Sep 17 00:00:00 2001 From: Jerad C Date: Wed, 19 Oct 2022 11:36:23 -0500 Subject: [PATCH 1/2] move Terminator CRD to 'crds' directory --- .../{templates => crds}/node.k8s.aws_terminators.yaml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename charts/aws-node-termination-handler-2/{templates => crds}/node.k8s.aws_terminators.yaml (100%) diff --git a/charts/aws-node-termination-handler-2/templates/node.k8s.aws_terminators.yaml b/charts/aws-node-termination-handler-2/crds/node.k8s.aws_terminators.yaml similarity index 100% rename from charts/aws-node-termination-handler-2/templates/node.k8s.aws_terminators.yaml rename to charts/aws-node-termination-handler-2/crds/node.k8s.aws_terminators.yaml From ef860241e89b201e2f0675d14766d72dfc6223df Mon Sep 17 00:00:00 2001 From: Jerad C Date: Wed, 19 Oct 2022 13:27:20 -0500 Subject: [PATCH 2/2] remove templating from CRD --- .../aws-node-termination-handler-2/README.md | 7 ---- .../crds/node.k8s.aws_terminators.yaml | 39 +++++++------------ .../values.yaml | 27 ------------- 3 files changed, 14 insertions(+), 59 deletions(-) diff --git a/charts/aws-node-termination-handler-2/README.md b/charts/aws-node-termination-handler-2/README.md index 9f74ca32..7b889b67 100644 --- a/charts/aws-node-termination-handler-2/README.md +++ b/charts/aws-node-termination-handler-2/README.md @@ -57,13 +57,6 @@ helm repo add eks https://aws.github.io/eks-charts/ * `serviceAccount.annotations` - Annotation names and values to add to service account. Default: `{}`. * `serviceAccount.create` - Enable creation of service account. Helm release may fail if service account already exists. Default: `true`. * `serviceAccount.name` - Name of the service account. If `serviceAccount.create` is enabled then the default will be generated from the release name and chart name. If `serviceAccount.create` is disabled then the default is `"default"`. -* `terminator.defaults.drain.force` - Default value of `Terminator`'s `spec.drain.force` property. Default: `true`. -* `terminator.defaults.drain.gracePeriodSeconds` - Default value of `Terminator`'s `spec.drain.gracePeriodSeconds` property. Default: `-1`. -* `terminator.defaults.drain.ignoreAllDaemonSets` - Default value of `Terminator`'s `spec.drain.ignoreAllDaemonSets` property. Default: `true`. -* `terminator.defaults.drain.deleteEmptyDirData` - Default value of `Terminator`'s `spec.drain.deleteEmptyDirData` property. Default: `true`. -* `terminator.defaults.drain.timeoutSeconds` - Default value of `Terminator`'s `spec.drain.timeoutSeconds` property. Default: `120`. -* `terminator.defaults.webhook.headers` - Default value of `Terminator`'s `spec.webhook.headers` property. Default: `[{"name": "Content-Type", "value": "application/json"}]`. -* `terminator.defaults.webhook.template` - Default value of `Terminator`'s `spec.webhook.template` property. Default: `'{"text":"[NTH][Instance Interruption] EventID: {{ .EventID }} - Kind: {{ .Kind }} - Instance: {{ .InstanceID }} - Node: {{ .NodeName }} - Start Time: {{ .StartTime }}"}'`. * `webhook.env` - List of environment variables to set in the webhook container. See [core/v1 Pod.spec.containers.env](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.19/#container-v1-core) Default: `[]`. * `webhook.image` - Image repository for the webhook controller. * `webhook.logLevel` - Override the global logging level for the webhook container. Default: `""`. diff --git a/charts/aws-node-termination-handler-2/crds/node.k8s.aws_terminators.yaml b/charts/aws-node-termination-handler-2/crds/node.k8s.aws_terminators.yaml index 888272f2..95bb491e 100644 --- a/charts/aws-node-termination-handler-2/crds/node.k8s.aws_terminators.yaml +++ b/charts/aws-node-termination-handler-2/crds/node.k8s.aws_terminators.yaml @@ -64,33 +64,23 @@ spec: force: description: Enable termination of pods without a controller. type: boolean - {{- with .Values.terminator.defaults.drain.force }} - default: {{ . }} - {{- end }} + default: true gracePeriodSeconds: - description: Wait time for pods to exit. If negative then the pod's configured gracetime will be used. + description: Wait time for pods to terminate. If negative then the pod's configured gracetime will be used. type: integer - {{- with .Values.terminator.defaults.drain.gracePeriodSeconds }} - default: {{ . }} - {{- end }} + default: -1 ignoreAllDaemonSets: description: Enable ignoring pods managed by a DaemonSet. type: boolean - {{- with .Values.terminator.defaults.drain.ignoreAllDaemonSets }} - default: {{ . }} - {{- end }} + default: true deleteEmptyDirData: description: Enable termination of pods with local data that will be deleted. type: boolean - {{- with .Values.terminator.defaults.drain.deleteEmptyDirData }} - default: {{ . }} - {{- end }} + default: true timeoutSeconds: - description: Wait time before failing the action. If zero, wait forever. + description: Wait time before failing the action. If zero, then wait forever. type: integer - {{- with .Values.terminator.defaults.drain.timeoutSeconds }} - default: {{ . }} - {{- end }} + default: 120 events: description: Specify what action should be taken when a particular message type is received. type: object @@ -155,17 +145,16 @@ spec: required: - name - value - {{- with .Values.terminator.defaults.webhook.headers }} default: - {{- toYaml . | nindent 22 }} - {{- end }} + - name: "Content-Type" + value: "application/json" template: - description: Used to generate the request payload. + description: | + Used to generate the request payload. Template used to generate webhook request body. + The template may reference fields EventID, Kind, InstanceID, NodeName, and StartTime. + See https://pkg.go.dev/text/template documentation for template format examples and explanation. type: string - {{- with .Values.terminator.defaults.webhook.template }} - default: | - {{ . }} - {{- end }} + default: '{"text":"[NTH][Instance Interruption] EventID: {{ .EventID }} - Kind: {{ .Kind }} - Instance: {{ .InstanceID }} - Node: {{ .NodeName }} - Start Time: {{ .StartTime }}"}' status: description: TerminatorStatus defines the observed state of Terminator type: object diff --git a/charts/aws-node-termination-handler-2/values.yaml b/charts/aws-node-termination-handler-2/values.yaml index a40f3947..b2872f91 100644 --- a/charts/aws-node-termination-handler-2/values.yaml +++ b/charts/aws-node-termination-handler-2/values.yaml @@ -138,33 +138,6 @@ serviceAccount: annotations: {} # "eks.amazonaws.com/role-arn": -terminator: - defaults: - drain: - # Terminate pods that do not have a controller. - force: true - # Duration to wait for each pod to terminate. If negative then the pod's grace period will be used. - gracePeriodSeconds: -1 - # Do not terminate pods managed by a DaemonSet. - ignoreAllDaemonSets: true - # Terminate pods that have local data that will be deleted. - deleteEmptyDirData: true - # Duration to wait before giving up. If 0, then wait forever. - timeoutSeconds: 120 - webhook: - # List of HTTP heads to include in webhook requests. - headers: - - name: Content-Type - value: application/json - # Template used to generate webhook request body. The template may reference: - # * EventID - # * Kind - # * InstanceID - # * NodeName - # * StartTime - # See https://pkg.go.dev/text/template documentation for template format examples and explanation. - template: '{"text":"[NTH][Instance Interruption] EventID: {{ .EventID }} - Kind: {{ .Kind }} - Instance: {{ .InstanceID }} - Node: {{ .NodeName }} - Start Time: {{ .StartTime }}"}' - webhook: # Environment variables. env: []