From cd44e89d89c040a22f2bfd3baba221f91f956825 Mon Sep 17 00:00:00 2001 From: Aidan Obley Date: Mon, 21 Nov 2022 19:06:09 +0000 Subject: [PATCH] ignore dns servers from dhcp when providing nameservers Co-authored-by: Tyler Schultz Co-authored-by: Edwin Xie Co-authored-by: Christian Ang --- .../bundle/config/upstream/base.yaml | 32 ++++++++++++++++--- .../v1.5.1/cconly/base.yaml | 32 ++++++++++++++++--- 2 files changed, 56 insertions(+), 8 deletions(-) diff --git a/packages/tkg-clusterclass-vsphere/bundle/config/upstream/base.yaml b/packages/tkg-clusterclass-vsphere/bundle/config/upstream/base.yaml index 033b49251d..0da37df264 100644 --- a/packages/tkg-clusterclass-vsphere/bundle/config/upstream/base.yaml +++ b/packages/tkg-clusterclass-vsphere/bundle/config/upstream/base.yaml @@ -1087,8 +1087,20 @@ spec: - {{ . }} {{- end }} {{- end }} - {{ if list "IPv4" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} dhcp4: true {{- end }} - {{ if list "IPv6" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} dhcp6: true {{- end }} + {{ if list "IPv4" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} + dhcp4: true + {{ if .controlPlane.network.nameservers -}} + dhcp4Overrides: + useDNS: false + {{- end }} + {{- end }} + {{ if list "IPv6" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} + dhcp6: true + {{ if .controlPlane.network.nameservers -}} + dhcp6Overrides: + useDNS: false + {{- end }} + {{- end }} {{ if .network.addressesFromPools -}} addressesFromPools: {{- range .network.addressesFromPools }} @@ -1124,8 +1136,20 @@ spec: - {{ . }} {{- end }} {{- end }} - {{ if list "IPv4" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} dhcp4: true {{- end }} - {{ if list "IPv6" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} dhcp6: true {{- end }} + {{ if list "IPv4" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} + dhcp4: true + {{ if .worker.network.nameservers -}} + dhcp4Overrides: + useDNS: false + {{- end }} + {{- end }} + {{ if list "IPv6" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} + dhcp6: true + {{ if .worker.network.nameservers -}} + dhcp6Overrides: + useDNS: false + {{- end }} + {{- end }} {{ if .network.addressesFromPools -}} addressesFromPools: {{- range .network.addressesFromPools }} diff --git a/providers/infrastructure-vsphere/v1.5.1/cconly/base.yaml b/providers/infrastructure-vsphere/v1.5.1/cconly/base.yaml index 033b49251d..0da37df264 100644 --- a/providers/infrastructure-vsphere/v1.5.1/cconly/base.yaml +++ b/providers/infrastructure-vsphere/v1.5.1/cconly/base.yaml @@ -1087,8 +1087,20 @@ spec: - {{ . }} {{- end }} {{- end }} - {{ if list "IPv4" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} dhcp4: true {{- end }} - {{ if list "IPv6" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} dhcp6: true {{- end }} + {{ if list "IPv4" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} + dhcp4: true + {{ if .controlPlane.network.nameservers -}} + dhcp4Overrides: + useDNS: false + {{- end }} + {{- end }} + {{ if list "IPv6" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} + dhcp6: true + {{ if .controlPlane.network.nameservers -}} + dhcp6Overrides: + useDNS: false + {{- end }} + {{- end }} {{ if .network.addressesFromPools -}} addressesFromPools: {{- range .network.addressesFromPools }} @@ -1124,8 +1136,20 @@ spec: - {{ . }} {{- end }} {{- end }} - {{ if list "IPv4" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} dhcp4: true {{- end }} - {{ if list "IPv6" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} dhcp6: true {{- end }} + {{ if list "IPv4" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} + dhcp4: true + {{ if .worker.network.nameservers -}} + dhcp4Overrides: + useDNS: false + {{- end }} + {{- end }} + {{ if list "IPv6" "DualStack" | has .builtin.cluster.network.ipFamily | and (empty .network.addressesFromPools) -}} + dhcp6: true + {{ if .worker.network.nameservers -}} + dhcp6Overrides: + useDNS: false + {{- end }} + {{- end }} {{ if .network.addressesFromPools -}} addressesFromPools: {{- range .network.addressesFromPools }}