forked from spotify/terraform-gke-kubeflow-cluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
kube-dns.tf
38 lines (32 loc) · 1.23 KB
/
kube-dns.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# this is taken from https://github.com/terraform-google-modules/terraform-google-kubernetes-engine/blob/d8e78504c51b194ce30e736f7a3a4240b9dbcd9d/dns.tf
# but modified to set upstreamResolvers instead of stubDomains
/******************************************
Delete default kube-dns configmap
*****************************************/
resource "null_resource" "delete_default_kube_dns_configmap" {
provisioner "local-exec" {
command = "${path.module}/scripts/kubectl_wrapper.sh https://${local.cluster_endpoint} ${data.google_client_config.default.access_token} ${local.cluster_ca_certificate} ${path.module}/scripts/delete-default-resource.sh kube-system configmap kube-dns"
}
depends_on = [
"data.google_client_config.default",
"google_container_cluster.kubeflow_cluster",
]
}
/******************************************
Create kube-dns confimap
*****************************************/
resource "kubernetes_config_map" "kube-dns" {
metadata {
name = "kube-dns"
namespace = "kube-system"
}
data = {
upstreamNameservers = <<EOF
${jsonencode(var.upstream_nameservers)}
EOF
}
depends_on = [
"null_resource.delete_default_kube_dns_configmap",
"google_container_cluster.kubeflow_cluster",
]
}