Skip to content

Commit

Permalink
Merge branch 'master' into gpu
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody authored Apr 11, 2024
2 parents 325f2c5 + da0476a commit 20af8cd
Show file tree
Hide file tree
Showing 46 changed files with 690 additions and 59 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ Then perform the following commands on the root folder:
| enable\_confidential\_nodes | An optional flag to enable confidential node config. | `bool` | `false` | no |
| 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 |
| 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 |
| enable\_l4\_ilb\_subsetting | Enable L4 ILB Subsetting on the cluster | `bool` | `false` | no |
| 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 |
| 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 |
| enable\_resource\_consumption\_export | Whether to enable resource consumption metering on this cluster. When enabled, a table will be created in the resource export BigQuery dataset to store resource consumption data. The resulting table can be joined with the resource usage table or with BigQuery billing export. | `bool` | `true` | no |
Expand Down Expand Up @@ -192,14 +193,15 @@ Then perform the following commands on the root folder:
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | `[]` | no |
| monitoring\_enable\_managed\_prometheus | Configuration for Managed Service for Prometheus. Whether or not the managed collection is enabled. | `bool` | `false` | no |
| monitoring\_enable\_observability\_metrics | Whether or not the advanced datapath metrics are enabled. | `bool` | `false` | no |
| monitoring\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS (provider version >= 3.89.0). Empty list is default GKE configuration. | `list(string)` | `[]` | no |
| monitoring\_enabled\_components | List of services to monitor: SYSTEM\_COMPONENTS, WORKLOADS. Empty list is default GKE configuration. | `list(string)` | `[]` | no |
| monitoring\_observability\_metrics\_relay\_mode | Mode used to make advanced datapath metrics relay available. | `string` | `null` | no |
| monitoring\_service | The monitoring service that the cluster should write metrics to. Automatically send metrics from pods in the cluster to the Google Cloud Monitoring API. VM metrics will be collected by Google Compute Engine regardless of this setting Available options include monitoring.googleapis.com, monitoring.googleapis.com/kubernetes (beta) and none | `string` | `"monitoring.googleapis.com/kubernetes"` | no |
| name | The name of the cluster (required) | `string` | n/a | yes |
| network | The VPC network to host the cluster in (required) | `string` | n/a | yes |
| network\_policy | Enable network policy addon | `bool` | `false` | no |
| network\_policy\_provider | The network policy provider. | `string` | `"CALICO"` | no |
| network\_project\_id | The project ID of the shared VPC's host (for shared vpc support) | `string` | `""` | no |
| network\_tags | (Optional) - List of network tags applied to auto-provisioned node pools. | `list(string)` | `[]` | no |
| node\_metadata | Specifies how node metadata is exposed to the workload running on the node | `string` | `"GKE_METADATA"` | no |
| node\_pools | List of maps containing node pools | `list(map(any))` | <pre>[<br> {<br> "name": "default-node-pool"<br> }<br>]</pre> | no |
| node\_pools\_labels | Map of maps containing node labels by node-pool name | `map(map(string))` | <pre>{<br> "all": {},<br> "default-node-pool": {}<br>}</pre> | no |
Expand Down
13 changes: 12 additions & 1 deletion autogen/main/cluster.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,10 @@ resource "google_container_cluster" "primary" {
enabled = identity_service_config.value
}
}
{% endif %}

enable_l4_ilb_subsetting = var.enable_l4_ilb_subsetting
{% endif %}
{% endif %}
{% if beta_cluster %}
enable_fqdn_network_policy = var.enable_fqdn_network_policy
{% endif %}
Expand Down Expand Up @@ -239,6 +239,17 @@ resource "google_container_cluster" "primary" {
}
{% endif %}

{% if autopilot_cluster != true %}
dynamic "node_pool_auto_config" {
for_each = var.cluster_autoscaling.enabled && length(var.network_tags) > 0 ? [1] : []
content {
network_tags {
tags = var.network_tags
}
}
}
{% endif %}

master_auth {
client_certificate_config {
issue_client_certificate = var.issue_client_certificate
Expand Down
19 changes: 9 additions & 10 deletions autogen/main/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -306,13 +306,12 @@ variable "node_pools_oauth_scopes" {
}
{% endif %}

{% if autopilot_cluster %}
variable "network_tags" {
description = "(Optional, Beta) - List of network tags applied to auto-provisioned node pools."
description = "(Optional) - List of network tags applied to auto-provisioned node pools."
type = list(string)
default = []
}
{% endif %}

variable "stub_domains" {
type = map(list(string))
description = "Map of stub domains and their resolvers to forward DNS queries for a certain domain to an external DNS server"
Expand Down Expand Up @@ -762,7 +761,7 @@ variable "monitoring_observability_metrics_relay_mode" {

variable "monitoring_enabled_components" {
type = list(string)
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS (provider version >= 3.89.0). Empty list is default GKE configuration."
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS. Empty list is default GKE configuration."
default = []
}

Expand All @@ -783,6 +782,12 @@ variable "config_connector" {
description = "Whether ConfigConnector is enabled for this cluster."
default = false
}

variable "enable_l4_ilb_subsetting" {
type = bool
description = "Enable L4 ILB Subsetting on the cluster"
default = false
}
{% endif %}
{% if beta_cluster %}
{% if autopilot_cluster != true %}
Expand Down Expand Up @@ -823,12 +828,6 @@ variable "enable_pod_security_policy" {
default = false
}

variable "enable_l4_ilb_subsetting" {
type = bool
description = "Enable L4 ILB Subsetting on the cluster"
default = false
}

variable "sandbox_enabled" {
type = bool
description = "(Beta) Enable GKE Sandbox (Do not forget to set `image_type` = `COS_CONTAINERD` to use it)."
Expand Down
1 change: 1 addition & 0 deletions autogen/safer-cluster/main.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ module "gke" {
monitoring_service = var.monitoring_service

monitoring_enable_managed_prometheus = var.monitoring_enable_managed_prometheus
monitoring_enabled_components = var.monitoring_enabled_components

// We never use the default service account for the cluster. The default
// project/editor permissions can create problems if nodes were to be ever
Expand Down
6 changes: 6 additions & 0 deletions autogen/safer-cluster/variables.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,12 @@ variable "monitoring_enable_managed_prometheus" {
default = false
}

variable "monitoring_enabled_components" {
type = list(string)
description = "List of services to monitor: SYSTEM_COMPONENTS, WORKLOADS. Empty list is default GKE configuration."
default = []
}

variable "grant_registry_access" {
type = bool
description = "Grants created cluster-specific service account storage.objectViewer role."
Expand Down
11 changes: 11 additions & 0 deletions cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ resource "google_container_cluster" "primary" {

enable_kubernetes_alpha = var.enable_kubernetes_alpha
enable_tpu = var.enable_tpu

enable_l4_ilb_subsetting = var.enable_l4_ilb_subsetting
dynamic "master_authorized_networks_config" {
for_each = local.master_authorized_networks_config
content {
Expand All @@ -160,6 +162,15 @@ resource "google_container_cluster" "primary" {
}
}

dynamic "node_pool_auto_config" {
for_each = var.cluster_autoscaling.enabled && length(var.network_tags) > 0 ? [1] : []
content {
network_tags {
tags = var.network_tags
}
}
}

master_auth {
client_certificate_config {
issue_client_certificate = var.issue_client_certificate
Expand Down
38 changes: 38 additions & 0 deletions examples/island_cluster_with_vm_router/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# GKE island cluster using VM as router

This example provisions a cluster in an island VPC allowing reuse of the IP address space for multiple clusters in the same project.

1. An appliance(VM as router) with multiple NICs is used to establish connectivity between the island VPC and the existing network.
1. Outbound connections will go through the router.
1. For inbound connections, use Private Service Connect.

## Deploy

1. Update `project_id`, `cluster_name` and `primary_subnet` values in `terraform.tfvars`, and update other variables as needed.
1. Run `terraform apply`.

<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
## Inputs

| Name | Description | Type | Default | Required |
|------|-------------|------|---------|:--------:|
| cluster\_name | n/a | `string` | n/a | yes |
| master\_authorized\_networks | List of master authorized networks. If none are provided, disallow external access (except the cluster node IPs, which GKE automatically whitelists). | `list(object({ cidr_block = string, display_name = string }))` | n/a | yes |
| node\_locations | n/a | `list(string)` | n/a | yes |
| primary\_net\_cidrs | n/a | `list(string)` | n/a | yes |
| primary\_subnet | n/a | `string` | n/a | yes |
| project\_id | n/a | `string` | n/a | yes |
| proxy\_subnet\_cidr | n/a | `string` | n/a | yes |
| psc\_subnet\_cidr | n/a | `string` | n/a | yes |
| region | n/a | `string` | n/a | yes |
| router\_machine\_type | n/a | `string` | n/a | yes |
| secondary\_ranges | n/a | `map(string)` | n/a | yes |
| subnet\_cidr | n/a | `string` | n/a | yes |

## Outputs

| Name | Description |
|------|-------------|
| cluster\_id | n/a |

<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
Loading

0 comments on commit 20af8cd

Please sign in to comment.