Skip to content

Commit 090781d

Browse files
authored
feat: add enable_k8s_beta_apis support (#2387)
1 parent e084b48 commit 090781d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+214
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ Then perform the following commands on the root folder:
175175
| enable\_gcfs | Enable image streaming on cluster level. | `bool` | `false` | no |
176176
| enable\_identity\_service | (Optional) Enable the Identity Service component, which allows customers to use external identity providers with the K8S API. NOTE: Starting on July 1, 2025, new Google Cloud organizations that you create won't support Identity Service for GKE. | `bool` | `false` | no |
177177
| enable\_intranode\_visibility | Whether Intra-node visibility is enabled for this cluster. This makes same node pod to pod traffic visible for VPC network | `bool` | `false` | no |
178+
| enable\_k8s\_beta\_apis | (Optional) - List of Kubernetes Beta APIs to enable in cluster. | `list(string)` | `[]` | no |
178179
| enable\_kubernetes\_alpha | Whether to enable Kubernetes Alpha features for this cluster. Note that when this option is enabled, the cluster cannot be upgraded and will be automatically deleted after 30 days. | `bool` | `false` | no |
179180
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
180181
| enable\_mesh\_certificates | Controls the issuance of workload mTLS certificates. When enabled the GKE Workload Identity Certificates controller and node agent will be deployed in the cluster. Requires Workload Identity. | `bool` | `false` | no |

autogen/main/cluster.tf.tmpl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ resource "google_container_cluster" "primary" {
3737
network = "projects/${local.network_project_id}/global/networks/${var.network}"
3838
deletion_protection = var.deletion_protection
3939

40+
dynamic "enable_k8s_beta_apis" {
41+
for_each = length(var.enable_k8s_beta_apis) > 0 ? [1] : []
42+
content {
43+
enabled_apis = var.enable_k8s_beta_apis
44+
}
45+
}
46+
4047
{% if autopilot_cluster != true %}
4148
dynamic "network_policy" {
4249
for_each = local.cluster_network_policy

autogen/main/variables.tf.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,12 @@ variable "network_tags" {
399399
default = []
400400
}
401401

402+
variable "enable_k8s_beta_apis" {
403+
description = "(Optional) - List of Kubernetes Beta APIs to enable in cluster."
404+
type = list(string)
405+
default = []
406+
}
407+
402408
{% if autopilot_cluster != true %}
403409
variable "stub_domains" {
404410
type = map(list(string))

cluster.tf

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ resource "google_container_cluster" "primary" {
3333
network = "projects/${local.network_project_id}/global/networks/${var.network}"
3434
deletion_protection = var.deletion_protection
3535

36+
dynamic "enable_k8s_beta_apis" {
37+
for_each = length(var.enable_k8s_beta_apis) > 0 ? [1] : []
38+
content {
39+
enabled_apis = var.enable_k8s_beta_apis
40+
}
41+
}
42+
3643
dynamic "network_policy" {
3744
for_each = local.cluster_network_policy
3845

examples/simple_regional_private/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ This example illustrates how to create a simple private cluster.
99
|------|-------------|------|---------|:--------:|
1010
| cluster\_name\_suffix | A suffix to append to the default cluster name | `string` | `""` | no |
1111
| compute\_engine\_service\_account | Service account to associate to the nodes in the cluster | `any` | n/a | yes |
12+
| enable\_k8s\_beta\_apis | K8S beta apis to enable within the cluster | `any` | n/a | yes |
1213
| ip\_range\_pods | The secondary ip range to use for pods | `any` | n/a | yes |
1314
| network | The VPC network to host the cluster in | `any` | n/a | yes |
1415
| project\_id | The project ID to host the cluster in | `any` | n/a | yes |

examples/simple_regional_private/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ module "gke" {
5151
default_max_pods_per_node = 20
5252
remove_default_node_pool = true
5353
deletion_protection = false
54+
enable_k8s_beta_apis = var.enable_k8s_beta_apis
5455

5556
node_pools = [
5657
{

examples/simple_regional_private/variables.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ variable "compute_engine_service_account" {
4343
description = "Service account to associate to the nodes in the cluster"
4444
}
4545

46+
variable "enable_k8s_beta_apis" {
47+
description = "K8S beta apis to enable within the cluster"
48+
}

metadata.display.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ spec:
132132
enable_intranode_visibility:
133133
name: enable_intranode_visibility
134134
title: Enable Intranode Visibility
135+
enable_k8s_beta_apis:
136+
name: enable_k8s_beta_apis
137+
title: Enable K8s Beta Apis
135138
enable_kubernetes_alpha:
136139
name: enable_kubernetes_alpha
137140
title: Enable Kubernetes Alpha

metadata.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -403,6 +403,10 @@ spec:
403403
description: (Optional) - List of network tags applied to auto-provisioned node pools.
404404
varType: list(string)
405405
defaultValue: []
406+
- name: enable_k8s_beta_apis
407+
description: (Optional) - List of Kubernetes Beta APIs to enable in cluster.
408+
varType: list(string)
409+
defaultValue: []
406410
- name: stub_domains
407411
description: Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server
408412
varType: map(list(string))

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ Then perform the following commands on the root folder:
9696
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
9797
| enable\_cost\_allocation | Enables Cost Allocation Feature and the cluster name and namespace of your GKE workloads appear in the labels field of the billing export to BigQuery | `bool` | `false` | no |
9898
| enable\_fqdn\_network\_policy | Enable FQDN Network Policies on the cluster | `bool` | `null` | no |
99+
| enable\_k8s\_beta\_apis | (Optional) - List of Kubernetes Beta APIs to enable in cluster. | `list(string)` | `[]` | no |
99100
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
100101
| enable\_multi\_networking | Whether multi-networking is enabled for this cluster | `bool` | `null` | no |
101102
| enable\_network\_egress\_export | Whether to enable network egress metering for this cluster. If enabled, a daemonset will be created in the cluster to meter network egress traffic. | `bool` | `false` | no |

0 commit comments

Comments
 (0)