Skip to content

Commit 7f97984

Browse files
committed
fix: remove dns from autopilot
1 parent 375d27c commit 7f97984

File tree

14 files changed

+14
-208
lines changed

14 files changed

+14
-208
lines changed

Diff for: autogen/main/dns.tf.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
{{ autogeneration_note }}
1818

19+
{% if autopilot_cluster != true %}
1920
/******************************************
2021
Manage kube-dns configmaps
2122
*****************************************/
@@ -95,3 +96,4 @@ EOF
9596
{% endif %}
9697
]
9798
}
99+
{% endif %}

Diff for: autogen/main/main.tf.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,10 @@ locals {
7878
{% endif %}
7979

8080

81+
{% if autopilot_cluster != true %}
8182
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
8283
upstream_nameservers_config = length(var.upstream_nameservers) > 0
84+
{% endif %}
8385
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
8486
zone_count = length(var.zones)
8587
cluster_type = var.regional ? "regional" : "zonal"

Diff for: autogen/main/moved.tf.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17+
{% if autopilot_cluster != true %}
1718
# Updates for kebab to snake case, to match best practices and Google style.
1819
moved {
1920
from = kubernetes_config_map_v1_data.kube-dns
@@ -30,6 +31,7 @@ moved {
3031
from = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers-and-stub-domains
3132
to = kubernetes_config_map_v1_data.kube_dns_upstream_nameservers_and_stub_domains
3233
}
34+
{% endif %}
3335

3436
moved {
3537
from = kubernetes_config_map.ip-masq-agent

Diff for: autogen/main/variables.tf.tmpl

+2
Original file line numberDiff line numberDiff line change
@@ -357,6 +357,7 @@ variable "network_tags" {
357357
default = []
358358
}
359359

360+
{% if autopilot_cluster != true %}
360361
variable "stub_domains" {
361362
type = map(list(string))
362363
description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"
@@ -368,6 +369,7 @@ variable "upstream_nameservers" {
368369
description = "If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf"
369370
default = []
370371
}
372+
{% endif %}
371373

372374
variable "non_masquerade_cidrs" {
373375
type = list(string)

Diff for: modules/beta-autopilot-private-cluster/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,8 @@ Then perform the following commands on the root folder:
152152
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
153153
| stack\_type | The stack type to use for this cluster. Either `IPV4` or `IPV4_IPV6`. Defaults to `IPV4`. | `string` | `"IPV4"` | no |
154154
| stateful\_ha | Whether the Stateful HA Addon is enabled for this cluster. | `bool` | `false` | no |
155-
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
156155
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
157156
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
158-
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
159157
| workload\_config\_audit\_mode | (beta) Sets which mode of auditing should be used for the cluster's workloads. Accepted values are DISABLED, BASIC. | `string` | `"DISABLED"` | no |
160158
| workload\_vulnerability\_mode | (beta) Sets which mode to use for Protect workload vulnerability scanning feature. Accepted values are DISABLED, BASIC. | `string` | `""` | no |
161159
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Diff for: modules/beta-autopilot-private-cluster/dns.tf

-70
Original file line numberDiff line numberDiff line change
@@ -16,73 +16,3 @@
1616

1717
// This file was automatically generated from a template in ./autogen/main
1818

19-
/******************************************
20-
Manage kube-dns configmaps
21-
*****************************************/
22-
23-
resource "kubernetes_config_map_v1_data" "kube_dns" {
24-
count = local.custom_kube_dns_config && !local.upstream_nameservers_config ? 1 : 0
25-
26-
metadata {
27-
name = "kube-dns"
28-
namespace = "kube-system"
29-
}
30-
31-
data = {
32-
stubDomains = <<EOF
33-
${jsonencode(var.stub_domains)}
34-
EOF
35-
}
36-
37-
force = true
38-
39-
depends_on = [
40-
google_container_cluster.primary,
41-
]
42-
}
43-
44-
resource "kubernetes_config_map_v1_data" "kube_dns_upstream_nameservers" {
45-
count = !local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
46-
47-
metadata {
48-
name = "kube-dns"
49-
namespace = "kube-system"
50-
}
51-
52-
data = {
53-
upstreamNameservers = <<EOF
54-
${jsonencode(var.upstream_nameservers)}
55-
EOF
56-
}
57-
58-
force = true
59-
60-
depends_on = [
61-
google_container_cluster.primary,
62-
]
63-
}
64-
65-
resource "kubernetes_config_map_v1_data" "kube_dns_upstream_nameservers_and_stub_domains" {
66-
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
67-
68-
metadata {
69-
name = "kube-dns"
70-
namespace = "kube-system"
71-
}
72-
73-
data = {
74-
upstreamNameservers = <<EOF
75-
${jsonencode(var.upstream_nameservers)}
76-
EOF
77-
78-
stubDomains = <<EOF
79-
${jsonencode(var.stub_domains)}
80-
EOF
81-
}
82-
83-
force = true
84-
85-
depends_on = [
86-
google_container_cluster.primary,
87-
]
88-
}

Diff for: modules/beta-autopilot-private-cluster/main.tf

+3-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ locals {
5656

5757

5858

59-
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
60-
upstream_nameservers_config = length(var.upstream_nameservers) > 0
61-
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
62-
zone_count = length(var.zones)
63-
cluster_type = var.regional ? "regional" : "zonal"
59+
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
60+
zone_count = length(var.zones)
61+
cluster_type = var.regional ? "regional" : "zonal"
6462

6563
cluster_subnet_cidr = var.add_cluster_firewall_rules ? data.google_compute_subnetwork.gke_subnetwork[0].ip_cidr_range : null
6664
cluster_alias_ranges_cidr = var.add_cluster_firewall_rules ? { for range in toset(data.google_compute_subnetwork.gke_subnetwork[0].secondary_ip_range) : range.range_name => range.ip_cidr_range } : {}

Diff for: modules/beta-autopilot-private-cluster/moved.tf

-16
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
# Updates for kebab to snake case, to match best practices and Google style.
18-
moved {
19-
from = kubernetes_config_map_v1_data.kube-dns
20-
to = kubernetes_config_map_v1_data.kube_dns
21-
}
22-
23-
# Typo fix and snake case at the same time
24-
moved {
25-
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
26-
to = kubernetes_config_map_v1_data.kube_dns_upstream_nameservers
27-
}
28-
29-
moved {
30-
from = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers-and-stub-domains
31-
to = kubernetes_config_map_v1_data.kube_dns_upstream_nameservers_and_stub_domains
32-
}
3317

3418
moved {
3519
from = kubernetes_config_map.ip-masq-agent

Diff for: modules/beta-autopilot-private-cluster/variables.tf

-11
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,6 @@ variable "network_tags" {
185185
default = []
186186
}
187187

188-
variable "stub_domains" {
189-
type = map(list(string))
190-
description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"
191-
default = {}
192-
}
193-
194-
variable "upstream_nameservers" {
195-
type = list(string)
196-
description = "If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf"
197-
default = []
198-
}
199188

200189
variable "non_masquerade_cidrs" {
201190
type = list(string)

Diff for: modules/beta-autopilot-public-cluster/README.md

-2
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,8 @@ Then perform the following commands on the root folder:
140140
| shadow\_firewall\_rules\_priority | The firewall priority of GKE shadow firewall rules. The priority should be less than default firewall, which is 1000. | `number` | `999` | no |
141141
| stack\_type | The stack type to use for this cluster. Either `IPV4` or `IPV4_IPV6`. Defaults to `IPV4`. | `string` | `"IPV4"` | no |
142142
| stateful\_ha | Whether the Stateful HA Addon is enabled for this cluster. | `bool` | `false` | no |
143-
| stub\_domains | Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server | `map(list(string))` | `{}` | no |
144143
| subnetwork | The subnetwork to host the cluster in (required) | `string` | n/a | yes |
145144
| timeouts | Timeout for cluster operations. | `map(string)` | `{}` | no |
146-
| upstream\_nameservers | If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf | `list(string)` | `[]` | no |
147145
| workload\_config\_audit\_mode | (beta) Sets which mode of auditing should be used for the cluster's workloads. Accepted values are DISABLED, BASIC. | `string` | `"DISABLED"` | no |
148146
| workload\_vulnerability\_mode | (beta) Sets which mode to use for Protect workload vulnerability scanning feature. Accepted values are DISABLED, BASIC. | `string` | `""` | no |
149147
| zones | The zones to host the cluster in (optional if regional cluster / required if zonal) | `list(string)` | `[]` | no |

Diff for: modules/beta-autopilot-public-cluster/dns.tf

-70
Original file line numberDiff line numberDiff line change
@@ -16,73 +16,3 @@
1616

1717
// This file was automatically generated from a template in ./autogen/main
1818

19-
/******************************************
20-
Manage kube-dns configmaps
21-
*****************************************/
22-
23-
resource "kubernetes_config_map_v1_data" "kube_dns" {
24-
count = local.custom_kube_dns_config && !local.upstream_nameservers_config ? 1 : 0
25-
26-
metadata {
27-
name = "kube-dns"
28-
namespace = "kube-system"
29-
}
30-
31-
data = {
32-
stubDomains = <<EOF
33-
${jsonencode(var.stub_domains)}
34-
EOF
35-
}
36-
37-
force = true
38-
39-
depends_on = [
40-
google_container_cluster.primary,
41-
]
42-
}
43-
44-
resource "kubernetes_config_map_v1_data" "kube_dns_upstream_nameservers" {
45-
count = !local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
46-
47-
metadata {
48-
name = "kube-dns"
49-
namespace = "kube-system"
50-
}
51-
52-
data = {
53-
upstreamNameservers = <<EOF
54-
${jsonencode(var.upstream_nameservers)}
55-
EOF
56-
}
57-
58-
force = true
59-
60-
depends_on = [
61-
google_container_cluster.primary,
62-
]
63-
}
64-
65-
resource "kubernetes_config_map_v1_data" "kube_dns_upstream_nameservers_and_stub_domains" {
66-
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
67-
68-
metadata {
69-
name = "kube-dns"
70-
namespace = "kube-system"
71-
}
72-
73-
data = {
74-
upstreamNameservers = <<EOF
75-
${jsonencode(var.upstream_nameservers)}
76-
EOF
77-
78-
stubDomains = <<EOF
79-
${jsonencode(var.stub_domains)}
80-
EOF
81-
}
82-
83-
force = true
84-
85-
depends_on = [
86-
google_container_cluster.primary,
87-
]
88-
}

Diff for: modules/beta-autopilot-public-cluster/main.tf

+3-5
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,9 @@ locals {
5656

5757

5858

59-
custom_kube_dns_config = length(keys(var.stub_domains)) > 0
60-
upstream_nameservers_config = length(var.upstream_nameservers) > 0
61-
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
62-
zone_count = length(var.zones)
63-
cluster_type = var.regional ? "regional" : "zonal"
59+
network_project_id = var.network_project_id != "" ? var.network_project_id : var.project_id
60+
zone_count = length(var.zones)
61+
cluster_type = var.regional ? "regional" : "zonal"
6462

6563
cluster_subnet_cidr = var.add_cluster_firewall_rules ? data.google_compute_subnetwork.gke_subnetwork[0].ip_cidr_range : null
6664
cluster_alias_ranges_cidr = var.add_cluster_firewall_rules ? { for range in toset(data.google_compute_subnetwork.gke_subnetwork[0].secondary_ip_range) : range.range_name => range.ip_cidr_range } : {}

Diff for: modules/beta-autopilot-public-cluster/moved.tf

-16
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,6 @@
1414
* limitations under the License.
1515
*/
1616

17-
# Updates for kebab to snake case, to match best practices and Google style.
18-
moved {
19-
from = kubernetes_config_map_v1_data.kube-dns
20-
to = kubernetes_config_map_v1_data.kube_dns
21-
}
22-
23-
# Typo fix and snake case at the same time
24-
moved {
25-
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
26-
to = kubernetes_config_map_v1_data.kube_dns_upstream_nameservers
27-
}
28-
29-
moved {
30-
from = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers-and-stub-domains
31-
to = kubernetes_config_map_v1_data.kube_dns_upstream_nameservers_and_stub_domains
32-
}
3317

3418
moved {
3519
from = kubernetes_config_map.ip-masq-agent

Diff for: modules/beta-autopilot-public-cluster/variables.tf

-11
Original file line numberDiff line numberDiff line change
@@ -185,17 +185,6 @@ variable "network_tags" {
185185
default = []
186186
}
187187

188-
variable "stub_domains" {
189-
type = map(list(string))
190-
description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"
191-
default = {}
192-
}
193-
194-
variable "upstream_nameservers" {
195-
type = list(string)
196-
description = "If specified, the values replace the nameservers taken by default from the node’s /etc/resolv.conf"
197-
default = []
198-
}
199188

200189
variable "non_masquerade_cidrs" {
201190
type = list(string)

0 commit comments

Comments
 (0)