Skip to content

Commit f5bb9f8

Browse files
authored
Merge pull request #187 from chrislovecnm/ip-masq
Creation of new variable configure_ip_masq controlling ip masq install
2 parents 075e9c2 + 9510969 commit f5bb9f8

File tree

16 files changed

+36
-25
lines changed

16 files changed

+36
-25
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
117117
| basic\_auth\_password | The password to be used with Basic Authentication. | string | `""` | no |
118118
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | string | `""` | no |
119119
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | string | `""` | no |
120+
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | string | `"false"` | no |
120121
| description | The description of the cluster | string | `""` | no |
121122
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | string | `"true"` | no |
122123
| horizontal\_pod\_autoscaling | Enable horizontal pod autoscaling addon | string | `"true"` | no |

autogen/masq.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Create ip-masq-agent confimap
2121
*****************************************/
2222
resource "kubernetes_config_map" "ip-masq-agent" {
23-
count = "${var.network_policy ? 1 : 0}"
23+
count = "${var.configure_ip_masq ? 1 : 0}"
2424

2525
metadata {
2626
name = "ip-masq-agent"

autogen/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,11 @@ variable "ip_masq_link_local" {
237237
default = "false"
238238
}
239239

240+
variable "configure_ip_masq" {
241+
description = "Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server."
242+
default = "false"
243+
}
244+
240245
variable "logging_service" {
241246
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
242247
default = "logging.googleapis.com"

examples/stub_domains/main.tf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ module "gke" {
4040
network_policy = true
4141
service_account = "${var.compute_engine_service_account}"
4242

43+
configure_ip_masq = true
44+
4345
stub_domains {
4446
"example.com" = [
4547
"10.254.154.11",

masq.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Create ip-masq-agent confimap
2121
*****************************************/
2222
resource "kubernetes_config_map" "ip-masq-agent" {
23-
count = "${var.network_policy ? 1 : 0}"
23+
count = "${var.configure_ip_masq ? 1 : 0}"
2424

2525
metadata {
2626
name = "ip-masq-agent"

modules/beta-private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
125125
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | string | `""` | no |
126126
| cloudrun | (Beta) Enable CloudRun addon | string | `"false"` | no |
127127
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | string | `""` | no |
128+
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | string | `"false"` | no |
128129
| database\_encryption | Application-layer Secrets Encryption settings. Example: database_encryption = [{ state = "ENCRYPTED", key_name = "projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key" }] | list | `<list>` | no |
129130
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | string | `"false"` | no |
130131
| description | The description of the cluster | string | `""` | no |

modules/beta-private-cluster/masq.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Create ip-masq-agent confimap
2121
*****************************************/
2222
resource "kubernetes_config_map" "ip-masq-agent" {
23-
count = "${var.network_policy ? 1 : 0}"
23+
count = "${var.configure_ip_masq ? 1 : 0}"
2424

2525
metadata {
2626
name = "ip-masq-agent"

modules/beta-private-cluster/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ variable "ip_masq_link_local" {
235235
default = "false"
236236
}
237237

238+
variable "configure_ip_masq" {
239+
description = "Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server."
240+
default = "false"
241+
}
242+
238243
variable "logging_service" {
239244
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
240245
default = "logging.googleapis.com"

modules/beta-public-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
120120
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | string | `""` | no |
121121
| cloudrun | (Beta) Enable CloudRun addon | string | `"false"` | no |
122122
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | string | `""` | no |
123+
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | string | `"false"` | no |
123124
| database\_encryption | Application-layer Secrets Encryption settings. Example: database_encryption = [{ state = "ENCRYPTED", key_name = "projects/my-project/locations/global/keyRings/my-ring/cryptoKeys/my-key" }] | list | `<list>` | no |
124125
| description | The description of the cluster | string | `""` | no |
125126
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | string | `"true"` | no |

modules/beta-public-cluster/masq.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Create ip-masq-agent confimap
2121
*****************************************/
2222
resource "kubernetes_config_map" "ip-masq-agent" {
23-
count = "${var.network_policy ? 1 : 0}"
23+
count = "${var.configure_ip_masq ? 1 : 0}"
2424

2525
metadata {
2626
name = "ip-masq-agent"

modules/beta-public-cluster/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ variable "ip_masq_link_local" {
222222
default = "false"
223223
}
224224

225+
variable "configure_ip_masq" {
226+
description = "Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server."
227+
default = "false"
228+
}
229+
225230
variable "logging_service" {
226231
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
227232
default = "logging.googleapis.com"

modules/private-cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ In either case, upgrading to module version `v1.0.0` will trigger a recreation o
122122
| basic\_auth\_password | The password to be used with Basic Authentication. | string | `""` | no |
123123
| basic\_auth\_username | The username to be used with Basic Authentication. An empty value will disable Basic Authentication, which is the recommended configuration. | string | `""` | no |
124124
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | string | `""` | no |
125+
| configure\_ip\_masq | Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server. | string | `"false"` | no |
125126
| deploy\_using\_private\_endpoint | (Beta) A toggle for Terraform and kubectl to connect to the master's internal IP address during deployment. | string | `"false"` | no |
126127
| description | The description of the cluster | string | `""` | no |
127128
| disable\_legacy\_metadata\_endpoints | Disable the /0.1/ and /v1beta1/ metadata server endpoints on the node. Changing this value will cause all node pools to be recreated. | string | `"true"` | no |

modules/private-cluster/masq.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
Create ip-masq-agent confimap
2121
*****************************************/
2222
resource "kubernetes_config_map" "ip-masq-agent" {
23-
count = "${var.network_policy ? 1 : 0}"
23+
count = "${var.configure_ip_masq ? 1 : 0}"
2424

2525
metadata {
2626
name = "ip-masq-agent"

modules/private-cluster/variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,11 @@ variable "ip_masq_link_local" {
235235
default = "false"
236236
}
237237

238+
variable "configure_ip_masq" {
239+
description = "Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server."
240+
default = "false"
241+
}
242+
238243
variable "logging_service" {
239244
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
240245
default = "logging.googleapis.com"

test/integration/stub_domains_private/controls/kubectl.rb

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -59,26 +59,6 @@
5959
})
6060
end
6161
end
62-
63-
describe "ipmasq" do
64-
let(:ipmasq_configmap) { client.get_config_map("ip-masq-agent", "kube-system") }
65-
66-
it "is created by Terraform" do
67-
expect(ipmasq_configmap.metadata.labels.maintained_by).to eq "terraform"
68-
end
69-
70-
it "is configured properly" do
71-
expect(YAML.load(ipmasq_configmap.data.config)).to eq({
72-
"nonMasqueradeCIDRs" => [
73-
"10.0.0.0/8",
74-
"172.16.0.0/12",
75-
"192.168.0.0/16",
76-
],
77-
"resyncInterval" => "60s",
78-
"masqLinkLocal" => false,
79-
})
80-
end
81-
end
8262
end
8363
end
8464
end

variables.tf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,11 @@ variable "ip_masq_link_local" {
222222
default = "false"
223223
}
224224

225+
variable "configure_ip_masq" {
226+
description = "Enables the installation of ip masquerading, which is usually no longer required when using aliasied IP addresses. IP masquerading uses a kubectl call, so when you have a private cluster, you will need access to the API server."
227+
default = "false"
228+
}
229+
225230
variable "logging_service" {
226231
description = "The logging service that the cluster should write logs to. Available options include logging.googleapis.com, logging.googleapis.com/kubernetes (beta), and none"
227232
default = "logging.googleapis.com"

0 commit comments

Comments
 (0)