From d8116604f3492bfadefafb58586204e8c0e54dee Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush <25692880+danquack@users.noreply.github.com> Date: Wed, 2 Feb 2022 16:23:09 -0500 Subject: [PATCH 1/2] allow for dnsConfig directive --- .../templates/daemonset.linux.yaml | 6 ++++++ .../templates/daemonset.windows.yaml | 6 ++++++ .../aws-node-termination-handler/templates/deployment.yaml | 6 ++++++ config/helm/aws-node-termination-handler/values.yaml | 1 + 4 files changed, 19 insertions(+) diff --git a/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml b/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml index 199879c3..e5b981a2 100644 --- a/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml +++ b/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml @@ -45,6 +45,12 @@ spec: {{- end }} hostNetwork: {{ .Values.useHostNetwork }} dnsPolicy: {{ default .Values.linuxDnsPolicy .Values.dnsPolicy }} + {{- if .Values.dnsConfig }} + dnsConfig: + {{- with .Values.dnsConfig }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} containers: - name: aws-node-termination-handler {{- with .Values.securityContext }} diff --git a/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml b/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml index ea7f8337..1af55783 100644 --- a/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml +++ b/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml @@ -45,6 +45,12 @@ spec: {{- end }} hostNetwork: false dnsPolicy: {{ default .Values.windowsDnsPolicy .Values.dnsPolicy }} + {{- if .Values.dnsConfig }} + dnsConfig: + {{- with .Values.dnsConfig }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} containers: - name: aws-node-termination-handler {{- with .Values.securityContext }} diff --git a/config/helm/aws-node-termination-handler/templates/deployment.yaml b/config/helm/aws-node-termination-handler/templates/deployment.yaml index 38c10e98..07ffe2db 100644 --- a/config/helm/aws-node-termination-handler/templates/deployment.yaml +++ b/config/helm/aws-node-termination-handler/templates/deployment.yaml @@ -42,6 +42,12 @@ spec: {{- with .Values.terminationGracePeriodSeconds }} terminationGracePeriodSeconds: {{ . }} {{- end }} + {{- if .Values.dnsConfig }} + dnsConfig: + {{- with .Values.dnsConfig }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} containers: - name: aws-node-termination-handler {{- with .Values.securityContext }} diff --git a/config/helm/aws-node-termination-handler/values.yaml b/config/helm/aws-node-termination-handler/values.yaml index a49c7d62..b6997e3e 100644 --- a/config/helm/aws-node-termination-handler/values.yaml +++ b/config/helm/aws-node-termination-handler/values.yaml @@ -219,6 +219,7 @@ useHostNetwork: true # Daemonset DNS policy dnsPolicy: "" +dnsConfig: [] linuxDnsPolicy: ClusterFirstWithHostNet windowsDnsPolicy: ClusterFirst From 4431bb77f75eed48f53c85c768ad5a75caa9241b Mon Sep 17 00:00:00 2001 From: Daniel Quackenbush <25692880+danquack@users.noreply.github.com> Date: Fri, 4 Feb 2022 13:23:41 -0500 Subject: [PATCH 2/2] :memo: readme --- config/helm/aws-node-termination-handler/README.md | 1 + .../templates/daemonset.linux.yaml | 4 +--- .../templates/daemonset.windows.yaml | 4 +--- .../aws-node-termination-handler/templates/deployment.yaml | 4 +--- config/helm/aws-node-termination-handler/values.yaml | 2 +- 5 files changed, 5 insertions(+), 10 deletions(-) diff --git a/config/helm/aws-node-termination-handler/README.md b/config/helm/aws-node-termination-handler/README.md index 48766925..3ec77ed1 100644 --- a/config/helm/aws-node-termination-handler/README.md +++ b/config/helm/aws-node-termination-handler/README.md @@ -133,6 +133,7 @@ The configuration in this table applies to AWS Node Termination Handler in IMDS | `podMonitor.sampleLimit` | Number of scraped samples accepted. | `5000` | | `useHostNetwork` | If `true`, enables `hostNetwork` for the Linux DaemonSet. NOTE: setting this to `false` may cause issues accessing IMDSv2 if your account is not configured with an IP hop count of 2 see [Metrics Endpoint Considerations](#metrics-endpoint-considerations) | `true` | | `dnsPolicy` | If specified, this overrides `linuxDnsPolicy` and `windowsDnsPolicy` with a single policy. | `""` | +| `dnsConfig` | If specified, this sets the dnsConfig: https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-dns-config | `{}` | | `linuxDnsPolicy` | DNS policy for the Linux DaemonSet. | `""` | | `windowsDnsPolicy` | DNS policy for the Windows DaemonSet. | `""` | | `daemonsetNodeSelector` | Expressions to select a node by it's labels for DaemonSet pod assignment. For backwards compatibility the `nodeSelector` value has priority over this but shouldn't be used. | `{}` | diff --git a/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml b/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml index e5b981a2..bd7ef0f4 100644 --- a/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml +++ b/config/helm/aws-node-termination-handler/templates/daemonset.linux.yaml @@ -47,9 +47,7 @@ spec: dnsPolicy: {{ default .Values.linuxDnsPolicy .Values.dnsPolicy }} {{- if .Values.dnsConfig }} dnsConfig: - {{- with .Values.dnsConfig }} - {{- toYaml . | nindent 10 }} - {{- end }} + {{- toYaml . | nindent 10 }} {{- end }} containers: - name: aws-node-termination-handler diff --git a/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml b/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml index 1af55783..dafcd8f8 100644 --- a/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml +++ b/config/helm/aws-node-termination-handler/templates/daemonset.windows.yaml @@ -47,9 +47,7 @@ spec: dnsPolicy: {{ default .Values.windowsDnsPolicy .Values.dnsPolicy }} {{- if .Values.dnsConfig }} dnsConfig: - {{- with .Values.dnsConfig }} - {{- toYaml . | nindent 10 }} - {{- end }} + {{- toYaml . | nindent 10 }} {{- end }} containers: - name: aws-node-termination-handler diff --git a/config/helm/aws-node-termination-handler/templates/deployment.yaml b/config/helm/aws-node-termination-handler/templates/deployment.yaml index 07ffe2db..0ee758bd 100644 --- a/config/helm/aws-node-termination-handler/templates/deployment.yaml +++ b/config/helm/aws-node-termination-handler/templates/deployment.yaml @@ -44,9 +44,7 @@ spec: {{- end }} {{- if .Values.dnsConfig }} dnsConfig: - {{- with .Values.dnsConfig }} - {{- toYaml . | nindent 10 }} - {{- end }} + {{- toYaml . | nindent 10 }} {{- end }} containers: - name: aws-node-termination-handler diff --git a/config/helm/aws-node-termination-handler/values.yaml b/config/helm/aws-node-termination-handler/values.yaml index b6997e3e..26536306 100644 --- a/config/helm/aws-node-termination-handler/values.yaml +++ b/config/helm/aws-node-termination-handler/values.yaml @@ -219,7 +219,7 @@ useHostNetwork: true # Daemonset DNS policy dnsPolicy: "" -dnsConfig: [] +dnsConfig: {} linuxDnsPolicy: ClusterFirstWithHostNet windowsDnsPolicy: ClusterFirst