Skip to content

Commit 8bf5dbe

Browse files
committed
Use custom subnets
We want to be sure the subnets are created before the clusters. So we create custom subnets and put a dependency on them for the clusters.
1 parent 13b770c commit 8bf5dbe

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

dm-setup/qwiklabs.jinja

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,19 @@ resources:
3838
- type: compute.v1.network
3939
name: {{ env['deployment'] }}-network
4040
properties:
41-
autoCreateSubnetworks: true
41+
autoCreateSubnetworks: false
42+
- type: compute.v1.subnetworks
43+
name: {{ env['deployment'] }}-us-central1
44+
properties:
45+
network: $(ref.{{ env['deployment'] }}-network.selfLink)
46+
region: us-central1
47+
ipCidrRange: 10.128.0.0/20
48+
- type: compute.v1.subnetworks
49+
name: {{ env['deployment'] }}-us-east4
50+
properties:
51+
network: $(ref.{{ env['deployment'] }}-network.selfLink)
52+
region: us-east4
53+
ipCidrRange: 10.132.0.0/20
4254
- type: compute.v1.route
4355
name: {{ env["deployment"] }}-default-route
4456
properties:
@@ -51,7 +63,7 @@ resources:
5163
properties:
5264
location: us-central1-f
5365
network: {{ env['deployment'] }}-network
54-
subnetwork: {{ env['deployment'] }}-network
66+
subnetwork: {{ env['deployment'] }}-us-central1
5567
purpose: workloads
5668
apiVersion: v1beta1
5769
kubernetesVersion: "1.10.4"
@@ -60,32 +72,32 @@ resources:
6072
sockShop: "installed"
6173
metadata:
6274
dependsOn:
63-
- {{ env['deployment'] }}-network
75+
- {{ env['deployment'] }}-us-central1
6476
- name: east
6577
type: cluster.jinja
6678
properties:
6779
location: us-east4-b
6880
network: {{ env['deployment'] }}-network
69-
subnetwork: {{ env['deployment'] }}-network
81+
subnetwork: {{ env['deployment'] }}-us-east4
7082
purpose: workloads
7183
apiVersion: v1beta1
7284
kubernetesVersion: "1.10.4"
7385
monitoringService: monitoring.googleapis.com/kubernetes
7486
loggingService: logging.googleapis.com/kubernetes
7587
metadata:
7688
dependsOn:
77-
- {{ env['deployment'] }}-network
89+
- {{ env['deployment'] }}-us-east4
7890
- name: spinnaker
7991
type: cluster.jinja
8092
properties:
8193
network: {{ env['deployment'] }}-network
82-
subnetwork: {{ env['deployment'] }}-network
83-
location: us-central1-f
94+
subnetwork: {{ env['deployment'] }}-us-central1
95+
zone: us-central1-f
8496
purpose: spinnaker
8597
kubernetesVersion: "1.10.4"
8698
metadata:
8799
dependsOn:
88-
- {{ env['deployment'] }}-network
100+
- {{ env['deployment'] }}-us-central1
89101
- type: compute.v1.firewall
90102
name: {{ env['deployment'] }}-student-ssh
91103
properties:
@@ -103,13 +115,14 @@ resources:
103115
metadata:
104116
dependsOn:
105117
- iam
106-
- {{ env['deployment'] }}-network
118+
- {{ env['deployment'] }}-us-central1
107119
- east
108120
- central
109121
- spinnaker
110122
properties:
111123
zone: us-central1-f
112124
network: $(ref.{{ env['deployment'] }}-network.selfLink)
125+
subnetwork: $(ref.{{ env['deployment'] }}-us-central1.selfLink)
113126
- name: student-vm-waiter
114127
type: waiter.jinja
115128
properties:

dm-setup/student-vm.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ resources:
3232
sourceImage: https://www.googleapis.com/compute/v1/projects/debian-cloud/global/images/family/debian-9
3333
networkInterfaces:
3434
- network: {{ properties["network"] }}
35+
subnetwork: {{ properties["subnetwork"] }}
3536
# Access Config required to give the instance a public IP address
3637
accessConfigs:
3738
- name: External NAT

0 commit comments

Comments
 (0)