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

Add Terraform example for GKE custom VPC deployment #1697

Merged
merged 8 commits into from
Aug 31, 2020
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions examples/terraform-submodules/gke/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.tfvars
moesy marked this conversation as resolved.
Show resolved Hide resolved
14 changes: 10 additions & 4 deletions examples/terraform-submodules/gke/module.tf
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ variable "network" {
description = "The name of the VPC network to attach the cluster and firewall rule to"
}

variable "subnetwork" {
default = ""
description = "The subnetwork to host the cluster in. Required field if network value isn't 'default'."
}

variable "log_level" {
default = "info"
}
Expand All @@ -66,8 +71,8 @@ variable "feature_gates" {

module "gke_cluster" {
// ***************************************************************************************************
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.3.0 corresponds
// to Agones version 1.3.0
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.7.0 corresponds
// to Agones version 1.7.0
// ***************************************************************************************************
source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/gke/?ref=master"

Expand All @@ -78,13 +83,14 @@ module "gke_cluster" {
"initialNodeCount" = var.node_count
"project" = var.project
"network" = var.network
"subnetwork" = var.subnetwork
}
}

module "helm_agones" {
// ***************************************************************************************************
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.3.0 corresponds
// to Agones version 1.3.0
// Update ?ref= to the agones release you are installing. For example, ?ref=release-1.7.0 corresponds
// to Agones version 1.7.0
// ***************************************************************************************************
source = "git::https://github.com/googleforgames/agones.git//install/terraform/modules/helm3/?ref=master"

Expand Down
23 changes: 21 additions & 2 deletions site/content/en/docs/Installation/Terraform/gke.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,29 @@ Next, make sure that you can authenticate using gcloud:
gcloud auth application-default login
```

Now you can create your GKE cluster (optionally specifying the version of Agones you want to use):

#### Creating the cluster in the default VPC

To create your GKE cluster in the default VPC just specify the project variable.

(optionally you can specify the version of Agones you want to use):

```
terraform apply -var project="<YOUR_GCP_ProjectID>" [-var agones_version="1.7.0"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@markmandel - should we add this variable to the release checklist so that it stays up to date?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @roberthbailey , updated!

```
terraform apply -var project="<YOUR_GCP_ProjectID>" [-var agones_version="1.0.0"]

{{% feature publishVersion="1.7.0" %}}
moesy marked this conversation as resolved.
Show resolved Hide resolved
moesy marked this conversation as resolved.
Show resolved Hide resolved
#### Option 2: Creating the cluster in a custom VPC

To create the cluster in a custom VPC you must specify the project flag as well as the network and subnetwork variable.
moesy marked this conversation as resolved.
Show resolved Hide resolved

(optionally you can specify the version of Agones you want to use):
```
terraform apply -var project="<YOUR_GCP_ProjectID>" project="<YOUR_GCP_ProjectID>" -var network="<YOUR_NETWORK_NAME>" -var subnetwork="<YOUR_SUBNETWORK_NAME>"[-var agones_version="1.7.0"]
moesy marked this conversation as resolved.
Show resolved Hide resolved
moesy marked this conversation as resolved.
Show resolved Hide resolved
```
{{% /feature %}}

### Verifying the Cluster

To verify that the cluster was created successfully, set up your kubectl credentials:
```
Expand Down