Passing a GKE engine version rather than relying on getLatest
Fixes:
MODIFY
gcp-py-gke/README.md
gcp-py-gke/README.md
@@ -34,6 +34,7 @@ After cloning this repo, `cd` into it and run these commands. A GKE Kubernetes c
$ pulumi config set gcp:project [your-gcp-project-here]
$ pulumi config set gcp:zone us-west1-a # any valid GCP zone here
$ pulumi config set password --secret [your-cluster-password-here]
+ $ pulumi config set master_version #any valid master version
```
By default, your cluster will have 3 nodes of type `n1-standard-1`. This is configurable, however; for instance

MODIFY
gcp-py-gke/__main__.py
gcp-py-gke/__main__.py
@@ -18,14 +18,14 @@ NODE_MACHINE_TYPE = config.get('node_machine_type') or 'n1-standard-1'
USERNAME = config.get('username') or 'admin'
# password is the password for the admin user in the cluster.
PASSWORD = config.get_secret('password') or RandomString("password", length=20, special=True).result
-
-engine_version = Output.from_input(get_engine_versions()).latest_master_version
+# master version of GKE engine
+MASTER_VERSION = config.get('master_version')
# Now, actually create the GKE cluster.
k8s_cluster = Cluster('gke-cluster',
initial_node_count=NODE_COUNT,
- node_version=engine_version,
- min_master_version=engine_version,
+ node_version=MASTER_VERSION,
+ min_master_version=MASTER_VERSION,
master_auth={ 'username': USERNAME, 'password': PASSWORD },
node_config={
'machine_type': NODE_MACHINE_TYPE,

MODIFY
gcp-ts-gke-hello-world/README.md
gcp-ts-gke-hello-world/README.md
@@ -56,6 +56,7 @@ After cloning this repo, from this working directory, run these commands:
```bash
$ pulumi config set gcp:project <YOUR_GCP_PROJECT_HERE>
$ pulumi config set gcp:zone us-west1-a // any valid GCP Zone here
+ $ pulumi config set masterVersion #any valid master version
```
1. Stand up the GKE cluster:

MODIFY
gcp-ts-gke-hello-world/index.ts
gcp-ts-gke-hello-world/index.ts
@@ -5,14 +5,14 @@ import * as gcp from "@pulumi/gcp";
const name = "helloworld";
-// Find the latest engine version.
-const engineVersion = gcp.container.getEngineVersions().then(v => v.latestMasterVersion);
+const config = new pulumi.Config();
+export const masterVersion = config.require("masterVersion");
// Create a GKE cluster
const cluster = new gcp.container.Cluster(name, {
initialNodeCount: 2,
- minMasterVersion: engineVersion,
- nodeVersion: engineVersion,
+ minMasterVersion: masterVersion,
+ nodeVersion: masterVersion,
nodeConfig: {
machineType: "n1-standard-1",
oauthScopes: [

MODIFY
gcp-ts-gke/README.md
gcp-ts-gke/README.md
@@ -34,6 +34,7 @@ After cloning this repo, `cd` into it and run these commands. A GKE Kubernetes c
$ pulumi config set gcp:project [your-gcp-project-here]
$ pulumi config set gcp:zone us-west1-a # any valid GCP zone here
$ pulumi config set password --secret [your-cluster-password-here]
+ $ pulumi config set masterVersion #any valid MasterVersion
```
By default, your cluster will have 3 nodes of type `n1-standard-1`. This is configurable, however; for instance

MODIFY
gcp-ts-gke/cluster.ts
gcp-ts-gke/cluster.ts
import * as gcp from "@pulumi/gcp";
import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
-import { nodeCount, nodeMachineType, password, username } from "./config";
-
-// Find the latest engine version.
-const engineVersion = gcp.container.getEngineVersions().then(v => v.latestMasterVersion);
+import {masterVersion, nodeCount, nodeMachineType, password, username} from "./config";
// Create the GKE cluster and export it.
export const k8sCluster = new gcp.container.Cluster("gke-cluster", {
initialNodeCount: nodeCount,
- nodeVersion: engineVersion,
- minMasterVersion: engineVersion,
+ nodeVersion: masterVersion,
+ minMasterVersion: masterVersion,
masterAuth: { username, password },
nodeConfig: {
machineType: nodeMachineType,

MODIFY
gcp-ts-gke/config.ts
gcp-ts-gke/config.ts
@@ -16,3 +16,6 @@ export const username = config.get("username") || "admin";
// password is the password for the admin user in the cluster.
export const password = config.require("password");
+
+// GKE master version
+export const masterVersion = config.require("masterVersion");

MODIFY
gcp-ts-k8s-ruby-on-rails-postgresql/README.md
gcp-ts-k8s-ruby-on-rails-postgresql/README.md
@@ -42,6 +42,7 @@ cluster and containerized Ruby on Rails application deployed into it, using a ho
$ pulumi config set dbPassword --secret [your-new-db-password-here]
$ pulumi config set dockerUsername [your-dockerhub-username-here]
$ pulumi config set dockerPassword --secret [your-dockerhub-password-here]
+ $ pulumi config set masterVersion # any valid master version
```
By default, your cluster will have 3 nodes of type `n1-standard-1`. This is configurable, however; for instance

MODIFY
gcp-ts-k8s-ruby-on-rails-postgresql/infra/cluster.ts
gcp-ts-k8s-ruby-on-rails-postgresql/infra/cluster.ts
@@ -5,14 +5,11 @@ import * as k8s from "@pulumi/kubernetes";
import * as pulumi from "@pulumi/pulumi";
import { clusterNodeCount, clusterNodeMachineType, clusterPassword, clusterUsername } from "./config";
-// Find the latest engine version.
-const engineVersion = gcp.container.getEngineVersions().then(v => v.latestMasterVersion);
-
// Create the GKE cluster and export it.
export const cluster = new gcp.container.Cluster("gke-cluster", {
initialNodeCount: clusterNodeCount,
- nodeVersion: engineVersion,
- minMasterVersion: engineVersion,
+ nodeVersion: masterVersion,
+ minMasterVersion: masterVersion,
masterAuth: { username: clusterUsername, password: clusterPassword },
nodeConfig: {
machineType: clusterNodeMachineType,

MODIFY
gcp-ts-k8s-ruby-on-rails-postgresql/infra/config.ts
gcp-ts-k8s-ruby-on-rails-postgresql/infra/config.ts
@@ -17,3 +17,4 @@ export const clusterNodeCount = config.getNumber("clusterNodeCount") || 3;
export const clusterNodeMachineType = config.get("clusterNodeMachineType") || "n1-standard-1";
export const clusterUsername = config.get("clusterUsername") || "admin";
export const clusterPassword = config.require("clusterPassword");
+export const masterVersion = config.require("masterVersion");

MODIFY
misc/test/examples_test.go
misc/test/examples_test.go
@@ -33,6 +33,11 @@ func TestExamples(t *testing.T) {
azureLocation = "westus"
fmt.Println("Defaulting ARM_LOCATION to 'westus'. You can override using the ARM_LOCATION variable")
}
+ gkeEngineVersion := os.Getenv("GKE_ENGINE_VERSION")
+ if gkeEngineVersion == "" {
+ gkeEngineVersion = ""
+ fmt.Println("Defaulting GKE_ENGINE_VERSION to '1.13.7-gke.8'. You can override using the GKE_ENGINE_VERSION variable")
+ }
cwd, err := os.Getwd()
if !assert.NoError(t, err, "expected a valid working directory: %v", err) {
return
@@ -655,6 +660,7 @@ func TestExamples(t *testing.T) {
"password": "S4cretPassword!$",
"node_count": "3",
"node_machine_type": "n1-standard-2",
+ "master_version": gkeEngineVersion,
},
}),
//base.With(integration.ProgramTestOptions{
@@ -691,6 +697,7 @@ func TestExamples(t *testing.T) {
"password": "S4cretPassword123!",
"nodeCount": "3",
"nodeMachineType": "n1-standard-2",
+ "masterVersion": gkeEngineVersion,
},
}),
base.With(integration.ProgramTestOptions{
@@ -698,6 +705,7 @@ func TestExamples(t *testing.T) {
Config: map[string]string{
"gcp:project": "pulumi-ci-gcp-provider",
"gcp:zone": "us-central1-a",
+ "masterVersion": gkeEngineVersion,
},
ExtraRuntimeValidation: func(t *testing.T, stack integration.RuntimeValidationStackInfo) {
endpoint := stack.Outputs["servicePublicIP"].(string)

Passing a GKE engine version rather than relying on getLatest (#360)

Fixes: #344