Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable image streaming everywhere by default #2756

Merged
merged 3 commits into from
Oct 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down
2 changes: 2 additions & 0 deletions build/includes/google-cloud.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions build/includes/terraform.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?= ''
Expand All @@ -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
Expand Down
5 changes: 5 additions & 0 deletions build/terraform/gke/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,10 @@ variable "feature_gates" {
default = ""
}

variable "enable_image_streaming" {
default = "true"
}

module "gke_cluster" {
source = "../../../install/terraform/modules/gke"

Expand All @@ -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
Expand Down
8 changes: 7 additions & 1 deletion examples/terraform-submodules/gke/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.88"
version = "~> 4.25.0"
}
}
}
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand Down
13 changes: 13 additions & 0 deletions install/terraform/modules/gke/cluster.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -84,6 +85,10 @@ resource "google_container_cluster" "primary" {
]

tags = ["game-server"]

gcfs_config {
enabled = local.enableImageStreaming
}
}
}
node_pool {
Expand Down Expand Up @@ -116,6 +121,10 @@ resource "google_container_cluster" "primary" {
value = "true"
effect = "NO_EXECUTE"
}

gcfs_config {
enabled = true
}
}
}
node_pool {
Expand Down Expand Up @@ -148,6 +157,10 @@ resource "google_container_cluster" "primary" {
value = "true"
effect = "NO_EXECUTE"
}

gcfs_config {
enabled = true
}
}
}
dynamic "ip_allocation_policy" {
Expand Down
4 changes: 2 additions & 2 deletions site/content/en/docs/Installation/Creating Cluster/gke.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion site/content/en/docs/Installation/Terraform/gke.md
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down