diff --git a/build/README.md b/build/README.md index 8630c7b775..81f54e1558 100644 --- a/build/README.md +++ b/build/README.md @@ -195,14 +195,15 @@ variables, or by setting them within your See the table below for available customizations : -| Parameter | Description | Default | -|------------------------------------------------|-------------------------------------------------------------------------------|-----------------| -| `GCP_CLUSTER_NAME` | The name of the cluster | `test-cluster` | -| `GCP_CLUSTER_ZONE` | The name of the Google Compute Engine zone in which the cluster will resides. | `us-west1-c` | -| `GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT` | The number of nodes to create in this cluster. | `4` | -| `GCP_CLUSTER_NODEPOOL_MACHINETYPE` | The name of a Google Compute Engine machine type. | `e2-standard-4` | -| `GCP_CLUSTER_NODEPOOL_WINDOWSINITIALNODECOUNT` | The number of Windows nodes to create in this cluster. | `0` | -| `GCP_CLUSTER_NODEPOOL_WINDOWSMACHINETYPE` | The name of a Google Compute Engine machine type for Windows nodes. | `e2-standard-4` | +| Parameter | Description | Default | +|------------------------------------------------|---------------------------------------------------------------------------------------|-----------------| +| `GCP_CLUSTER_NAME` | The name of the cluster | `test-cluster` | +| `GCP_CLUSTER_ZONE` | The name of the Google Compute Engine zone in which the cluster will resides. | `us-west1-c` | +| `GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT` | The number of nodes to create in this cluster. | `4` | +| `GCP_CLUSTER_NODEPOOL_MACHINETYPE` | The name of a Google Compute Engine machine type. | `e2-standard-4` | +| `GCP_CLUSTER_NODEPOOL_ENABLEIMAGESTREAMING` | Whether or not to enable image streaming for the `"default"` node pool in the cluster | `true` | +| `GCP_CLUSTER_NODEPOOL_WINDOWSINITIALNODECOUNT` | The number of Windows nodes to create in this cluster. | `0` | +| `GCP_CLUSTER_NODEPOOL_WINDOWSMACHINETYPE` | The name of a Google Compute Engine machine type for Windows nodes. | `e2-standard-4` | This will take several minutes to complete, but once done you can go to the Google Cloud Platform console and see that a cluster is up and running! diff --git a/build/includes/google-cloud.mk b/build/includes/google-cloud.mk index c6b67c7de0..7f65bc42e8 100644 --- a/build/includes/google-cloud.mk +++ b/build/includes/google-cloud.mk @@ -26,12 +26,14 @@ gcloud-init: ensure-build-config # Creates and authenticates a small, 6 node GKE cluster to work against (2 nodes are used for agones-metrics and agones-system) gcloud-test-cluster: GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT ?= 4 gcloud-test-cluster: GCP_CLUSTER_NODEPOOL_MACHINETYPE ?= e2-standard-4 +gcloud-test-cluster: GCP_CLUSTER_NODEPOOL_ENABLEIMAGESTREAMING ?= true gcloud-test-cluster: GCP_CLUSTER_NODEPOOL_WINDOWSINITIALNODECOUNT ?= 0 gcloud-test-cluster: GCP_CLUSTER_NODEPOOL_WINDOWSMACHINETYPE ?= e2-standard-4 gcloud-test-cluster: $(ensure-build-image) $(MAKE) gcloud-terraform-cluster GCP_TF_CLUSTER_NAME="$(GCP_CLUSTER_NAME)" GCP_CLUSTER_ZONE="$(GCP_CLUSTER_ZONE)" \ GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT="$(GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT)" \ GCP_CLUSTER_NODEPOOL_MACHINETYPE="$(GCP_CLUSTER_NODEPOOL_MACHINETYPE)" \ + GCP_CLUSTER_NODEPOOL_ENABLEIMAGESTREAMING="$(GCP_CLUSTER_NODEPOOL_ENABLEIMAGESTREAMING)" \ GCP_CLUSTER_NODEPOOL_WINDOWSINITIALNODECOUNT="$(GCP_CLUSTER_NODEPOOL_WINDOWSINITIALNODECOUNT)" \ GCP_CLUSTER_NODEPOOL_WINDOWSMACHINETYPE="$(GCP_CLUSTER_NODEPOOL_WINDOWSMACHINETYPE)" $(MAKE) gcloud-auth-cluster diff --git a/build/includes/terraform.mk b/build/includes/terraform.mk index 0941f87de8..c55506f2db 100644 --- a/build/includes/terraform.mk +++ b/build/includes/terraform.mk @@ -37,6 +37,7 @@ terraform-clean: # Alpha Feature gates are disabled gcloud-terraform-cluster: GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT ?= 4 gcloud-terraform-cluster: GCP_CLUSTER_NODEPOOL_MACHINETYPE ?= e2-standard-4 +gcloud-terraform-cluster: GCP_CLUSTER_NODEPOOL_ENABLEIMAGESTREAMING ?= true gcloud-terraform-cluster: GCP_CLUSTER_NODEPOOL_WINDOWSINITIALNODECOUNT ?= 0 gcloud-terraform-cluster: GCP_CLUSTER_NODEPOOL_WINDOWSMACHINETYPE ?= e2-standard-4 gcloud-terraform-cluster: AGONES_VERSION ?= '' @@ -55,6 +56,7 @@ gcloud-terraform-cluster: -var zone="$(GCP_CLUSTER_ZONE)" -var project="$(GCP_PROJECT)" \ -var log_level="$(LOG_LEVEL)" \ -var node_count=$(GCP_CLUSTER_NODEPOOL_INITIALNODECOUNT) \ + -var enable_image_streaming=$(GCP_CLUSTER_NODEPOOL_ENABLEIMAGESTREAMING) \ -var windows_node_count=$(GCP_CLUSTER_NODEPOOL_WINDOWSINITIALNODECOUNT) \ -var windows_machine_type=$(GCP_CLUSTER_NODEPOOL_WINDOWSMACHINETYPE)' GCP_CLUSTER_NAME=$(GCP_TF_CLUSTER_NAME) $(MAKE) gcloud-auth-cluster diff --git a/build/terraform/gke/module.tf b/build/terraform/gke/module.tf index a8fe88891b..91ec7de1d4 100644 --- a/build/terraform/gke/module.tf +++ b/build/terraform/gke/module.tf @@ -107,6 +107,10 @@ variable "feature_gates" { default = "" } +variable "enable_image_streaming" { + default = "true" +} + module "gke_cluster" { source = "../../../install/terraform/modules/gke" @@ -115,6 +119,7 @@ module "gke_cluster" { "zone" = var.zone "machineType" = var.machine_type "initialNodeCount" = var.node_count + "enableImageStreaming" = var.enable_image_streaming "windowsMachineType" = var.windows_machine_type "windowsInitialNodeCount" = var.windows_node_count "project" = var.project diff --git a/examples/terraform-submodules/gke/module.tf b/examples/terraform-submodules/gke/module.tf index f926d9857e..111b5e0bda 100644 --- a/examples/terraform-submodules/gke/module.tf +++ b/examples/terraform-submodules/gke/module.tf @@ -21,7 +21,7 @@ terraform { required_providers { google = { source = "hashicorp/google" - version = "~> 3.88" + version = "~> 4.25.0" } } } @@ -48,6 +48,11 @@ variable "machine_type" { variable "node_count" { default = "4" } + +variable "enable_image_streaming" { + default = "true" +} + variable "zone" { default = "us-west1-c" description = "The GCP zone to create the cluster in" @@ -91,6 +96,7 @@ module "gke_cluster" { "zone" = var.zone "machineType" = var.machine_type "initialNodeCount" = var.node_count + "enableImageStreaming" = var.enable_image_streaming "project" = var.project "network" = var.network "subnetwork" = var.subnetwork diff --git a/install/terraform/modules/gke/cluster.tf b/install/terraform/modules/gke/cluster.tf index 994de11c40..95fad710f5 100644 --- a/install/terraform/modules/gke/cluster.tf +++ b/install/terraform/modules/gke/cluster.tf @@ -27,6 +27,7 @@ locals { name = lookup(var.cluster, "name", "test-cluster") machineType = lookup(var.cluster, "machineType", "e2-standard-4") initialNodeCount = lookup(var.cluster, "initialNodeCount", "4") + enableImageStreaming = lookup(var.cluster, "enableImageStreaming", true) network = lookup(var.cluster, "network", "default") subnetwork = lookup(var.cluster, "subnetwork", "") kubernetesVersion = lookup(var.cluster, "kubernetesVersion", "1.23") @@ -84,6 +85,10 @@ resource "google_container_cluster" "primary" { ] tags = ["game-server"] + + gcfs_config { + enabled = local.enableImageStreaming + } } } node_pool { @@ -116,6 +121,10 @@ resource "google_container_cluster" "primary" { value = "true" effect = "NO_EXECUTE" } + + gcfs_config { + enabled = true + } } } node_pool { @@ -148,6 +157,10 @@ resource "google_container_cluster" "primary" { value = "true" effect = "NO_EXECUTE" } + + gcfs_config { + enabled = true + } } } dynamic "ip_allocation_policy" { diff --git a/site/content/en/docs/Installation/Creating Cluster/gke.md b/site/content/en/docs/Installation/Creating Cluster/gke.md index 5423985217..56acb0b67a 100644 --- a/site/content/en/docs/Installation/Creating Cluster/gke.md +++ b/site/content/en/docs/Installation/Creating Cluster/gke.md @@ -87,7 +87,7 @@ gcloud container clusters create [CLUSTER_NAME] --cluster-version={{% k8s-versio --tags=game-server \ --scopes=gke-default \ --num-nodes=4 \ - --no-enable-autoupgrade \ + --no-enable-autoupgrade \{{% feature publishVersion="1.27.0" %}} --enable-image-streaming \{{% /feature %}} --machine-type=e2-standard-4 ``` @@ -101,7 +101,7 @@ Flag explanations: * tags: Defines the tags that will be attached to new nodes in the cluster. This is to grant access through ports via the firewall created in the next step. * scopes: Defines the Oauth scopes required by the nodes. * num-nodes: The number of nodes to be created in each of the cluster's zones. Default: 4. Depending on the needs of your game, this parameter should be adjusted. -* no-enable-autoupgrade: Disable automatic upgrades for nodes to reduce the likelihood of in-use games being disrupted. +* no-enable-autoupgrade: Disable automatic upgrades for nodes to reduce the likelihood of in-use games being disrupted. {{% feature publishVersion="1.27.0" %}}* enable-image-streaming: Use [Image streaming](https://cloud.google.com/kubernetes-engine/docs/how-to/image-streaming) to pull container images, which leads to significant improvements in initialization times. [Limitations](https://cloud.google.com/kubernetes-engine/docs/how-to/image-streaming#limitations) apply to enable this feature. {{% /feature %}} * machine-type: The type of machine to use for nodes. Default: e2-standard-4. Depending on the needs of your game, you may wish to [have smaller or larger machines](https://cloud.google.com/compute/docs/machine-types). ### (Optional) Creating a dedicated node pool diff --git a/site/content/en/docs/Installation/Terraform/gke.md b/site/content/en/docs/Installation/Terraform/gke.md index 53c2c051be..2b8862789c 100644 --- a/site/content/en/docs/Installation/Terraform/gke.md +++ b/site/content/en/docs/Installation/Terraform/gke.md @@ -84,7 +84,7 @@ Configurable parameters: - name - the name of the GKE cluster (default is "agones-terraform-example") - agones_version - the version of agones to install (an empty string, which is the default, is the latest version from the [Helm repository](https://agones.dev/chart/stable)) - machine_type - machine type for hosting game servers (default is "e2-standard-4") -- node_count - count of game server nodes for the default node pool (default is "4") +- node_count - count of game server nodes for the default node pool (default is "4") {{% feature publishVersion="1.27.0" %}} - enable_image_streaming - whether or not to enable image streaming for the `"default"` node pool (default is true) {{% /feature %}} - zone - the name of the [zone](https://cloud.google.com/compute/docs/regions-zones) you want your cluster to be created in (default is "us-west1-c") - network - the name of the VPC network you want your cluster and firewall rules to be connected to (default is "default")