Skip to content

Commit cdbabdf

Browse files
committed
Update control plane tags to match CAPI networks
1 parent 482875d commit cdbabdf

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

pkg/asset/machines/gcp/machines.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ func provider(clusterID string, platform *gcp.Platform, mpool *gcp.MachinePool,
197197
Email: serviceAccountEmail,
198198
Scopes: []string{"https://www.googleapis.com/auth/cloud-platform"},
199199
}},
200-
Tags: append(mpool.Tags, []string{fmt.Sprintf("%s-%s", clusterID, role)}...),
200+
Tags: append(mpool.Tags, getTags(clusterID, role)...),
201201
MachineType: mpool.InstanceType,
202202
Region: platform.Region,
203203
Zone: az,
@@ -243,3 +243,14 @@ func getNetworks(platform *gcp.Platform, clusterID, role string) (string, string
243243
return "", "", fmt.Errorf("unrecognized machine role %s", role)
244244
}
245245
}
246+
247+
func getTags(clusterID, role string) []string {
248+
switch role {
249+
case "worker":
250+
return []string{fmt.Sprintf("%s-%s", clusterID, role)}
251+
case "master":
252+
return []string{fmt.Sprintf("%s-%s", clusterID, "control-plane"), clusterID}
253+
default:
254+
panic(fmt.Sprintf("unrecognized machine role %s", role))
255+
}
256+
}

0 commit comments

Comments
 (0)