Skip to content

Commit 2bbdd74

Browse files
committed
fix: remove dns from autopilot
1 parent bbc47f8 commit 2bbdd74

File tree

11 files changed

+12
-188
lines changed

11 files changed

+12
-188
lines changed

autogen/main/dns.tf.tmpl

Lines changed: 2 additions & 0 deletions
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
*****************************************/
@@ -101,3 +102,4 @@ EOF
101102
{% endif %}
102103
]
103104
}
105+
{% endif %}

autogen/main/main.tf.tmpl

Lines changed: 2 additions & 0 deletions
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"

autogen/main/variables.tf.tmpl

Lines changed: 2 additions & 0 deletions
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)

modules/beta-autopilot-private-cluster/README.md

Lines changed: 0 additions & 2 deletions
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 |

modules/beta-autopilot-private-cluster/dns.tf

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -16,79 +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-
# Fix the name typo in the previous ConfigMap creation call
66-
moved {
67-
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
68-
to = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers
69-
}
70-
71-
resource "kubernetes_config_map_v1_data" "kube-dns-upstream-nameservers-and-stub-domains" {
72-
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
73-
74-
metadata {
75-
name = "kube-dns"
76-
namespace = "kube-system"
77-
}
78-
79-
data = {
80-
upstreamNameservers = <<EOF
81-
${jsonencode(var.upstream_nameservers)}
82-
EOF
83-
84-
stubDomains = <<EOF
85-
${jsonencode(var.stub_domains)}
86-
EOF
87-
}
88-
89-
force = true
90-
91-
depends_on = [
92-
google_container_cluster.primary,
93-
]
94-
}

modules/beta-autopilot-private-cluster/main.tf

Lines changed: 3 additions & 5 deletions
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 } : {}

modules/beta-autopilot-private-cluster/variables.tf

Lines changed: 0 additions & 11 deletions
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)

modules/beta-autopilot-public-cluster/README.md

Lines changed: 0 additions & 2 deletions
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 |

modules/beta-autopilot-public-cluster/dns.tf

Lines changed: 0 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -16,79 +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-
# Fix the name typo in the previous ConfigMap creation call
66-
moved {
67-
from = kubernetes_config_map_v1_data.kube-dns-upstream-namservers
68-
to = kubernetes_config_map_v1_data.kube-dns-upstream-nameservers
69-
}
70-
71-
resource "kubernetes_config_map_v1_data" "kube-dns-upstream-nameservers-and-stub-domains" {
72-
count = local.custom_kube_dns_config && local.upstream_nameservers_config ? 1 : 0
73-
74-
metadata {
75-
name = "kube-dns"
76-
namespace = "kube-system"
77-
}
78-
79-
data = {
80-
upstreamNameservers = <<EOF
81-
${jsonencode(var.upstream_nameservers)}
82-
EOF
83-
84-
stubDomains = <<EOF
85-
${jsonencode(var.stub_domains)}
86-
EOF
87-
}
88-
89-
force = true
90-
91-
depends_on = [
92-
google_container_cluster.primary,
93-
]
94-
}

modules/beta-autopilot-public-cluster/main.tf

Lines changed: 3 additions & 5 deletions
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 } : {}

0 commit comments

Comments
 (0)