Skip to content

Commit 493149d

Browse files
feat: Add support for configuring allow_net_admin in autopilot clusters (terraform-google-modules#1768)
1 parent 29d79b1 commit 493149d

File tree

8 files changed

+27
-0
lines changed

8 files changed

+27
-0
lines changed

autogen/main/cluster.tf.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,10 @@ resource "google_container_cluster" "primary" {
326326
}
327327
{% endif %}
328328
}
329+
{% if autopilot_cluster %}
330+
331+
allow_net_admin = var.allow_net_admin
332+
{% endif %}
329333
{% if autopilot_cluster != true %}
330334

331335
datapath_provider = var.datapath_provider

autogen/main/variables.tf.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -849,3 +849,10 @@ variable "enable_gcfs" {
849849
}
850850
{% endif %}
851851
{% endif %}
852+
{% if autopilot_cluster %}
853+
variable "allow_net_admin" {
854+
description = "(Optional) Enable NET_ADMIN for the cluster."
855+
type = bool
856+
default = null
857+
}
858+
{% endif %}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ Then perform the following commands on the root folder:
7575
| add\_master\_webhook\_firewall\_rules | Create master\_webhook firewall rules for ports defined in `firewall_inbound_ports` | `bool` | `false` | no |
7676
| add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no |
7777
| additional\_ip\_range\_pods | List of _names_ of the additional secondary subnet ip ranges to use for pods | `list(string)` | `[]` | no |
78+
| allow\_net\_admin | (Optional) Enable NET\_ADMIN for the cluster. | `bool` | `null` | no |
7879
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected] | `string` | `null` | no |
7980
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `string` | `null` | no |
8081
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ resource "google_container_cluster" "primary" {
130130

131131
}
132132

133+
allow_net_admin = var.allow_net_admin
134+
133135
networking_mode = "VPC_NATIVE"
134136

135137
protect_config {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -448,3 +448,8 @@ variable "timeouts" {
448448
}
449449
}
450450

451+
variable "allow_net_admin" {
452+
description = "(Optional) Enable NET_ADMIN for the cluster."
453+
type = bool
454+
default = null
455+
}

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ Then perform the following commands on the root folder:
6969
| add\_master\_webhook\_firewall\_rules | Create master\_webhook firewall rules for ports defined in `firewall_inbound_ports` | `bool` | `false` | no |
7070
| add\_shadow\_firewall\_rules | Create GKE shadow firewall (the same as default firewall rules with firewall logs enabled). | `bool` | `false` | no |
7171
| additional\_ip\_range\_pods | List of _names_ of the additional secondary subnet ip ranges to use for pods | `list(string)` | `[]` | no |
72+
| allow\_net\_admin | (Optional) Enable NET\_ADMIN for the cluster. | `bool` | `null` | no |
7273
| authenticator\_security\_group | The name of the RBAC security group for use with Google security groups in Kubernetes RBAC. Group name must be in format [email protected] | `string` | `null` | no |
7374
| cluster\_ipv4\_cidr | The IP address range of the kubernetes pods in this cluster. Default is an automatically assigned CIDR. | `string` | `null` | no |
7475
| cluster\_resource\_labels | The GCE resource labels (a map of key/value pairs) to be applied to the cluster | `map(string)` | `{}` | no |

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ resource "google_container_cluster" "primary" {
130130

131131
}
132132

133+
allow_net_admin = var.allow_net_admin
134+
133135
networking_mode = "VPC_NATIVE"
134136

135137
protect_config {

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,3 +418,8 @@ variable "timeouts" {
418418
}
419419
}
420420

421+
variable "allow_net_admin" {
422+
description = "(Optional) Enable NET_ADMIN for the cluster."
423+
type = bool
424+
default = null
425+
}

0 commit comments

Comments
 (0)