Skip to content

Commit bb8b059

Browse files
committed
manifests/gcp/cluster: set instance group role tag
Sets the instance group role tag to "master" to be consistent with the role tag expected by MAPI--rather than "apiserver" used by CAPI.
1 parent dc0b1f4 commit bb8b059

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

pkg/asset/manifests/gcp/cluster.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,14 @@ import (
1919
"github.com/openshift/installer/pkg/types/gcp"
2020
)
2121

22+
// InstanceGroupRoleTag is the tag used in the instance
23+
// group name to maintain compatibility between MAPI & CAPI.
24+
const InstanceGroupRoleTag = "master"
25+
2226
// GenerateClusterAssets generates the manifests for the cluster-api.
2327
func GenerateClusterAssets(installConfig *installconfig.InstallConfig, clusterID *installconfig.ClusterID) (*capiutils.GenerateClusterAssetsOutput, error) {
2428
manifests := []*asset.RuntimeFile{}
25-
26-
const (
27-
description = "Created By OpenShift Installer"
28-
)
29+
const description = "Created By OpenShift Installer"
2930

3031
networkName := fmt.Sprintf("%s-network", clusterID.InfraID)
3132
if installConfig.Config.GCP.Network != "" {
@@ -118,6 +119,9 @@ func GenerateClusterAssets(installConfig *installconfig.InstallConfig, clusterID
118119
},
119120
AdditionalLabels: labels,
120121
FailureDomains: findFailureDomains(installConfig),
122+
LoadBalancer: capg.LoadBalancerSpec{
123+
APIServerInstanceGroupTagOverride: ptr.To(InstanceGroupRoleTag),
124+
},
121125
},
122126
}
123127
gcpCluster.SetGroupVersionKind(capg.GroupVersion.WithKind("GCPCluster"))

pkg/infrastructure/gcp/clusterapi/network.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/sirupsen/logrus"
99
"google.golang.org/api/compute/v1"
1010

11+
"github.com/openshift/installer/pkg/asset/manifests/gcp"
1112
"github.com/openshift/installer/pkg/infrastructure/clusterapi"
1213
)
1314

@@ -130,7 +131,7 @@ func createInternalLB(ctx context.Context, in clusterapi.InfraReadyInput, subnet
130131
}
131132
backends := []*compute.Backend{}
132133
for _, zone := range zones {
133-
igName := fmt.Sprintf("%s-apiserver-%s", in.InfraID, *zone)
134+
igName := fmt.Sprintf("%s-%s-%s", in.InfraID, gcp.InstanceGroupRoleTag, *zone)
134135
ig, err := service.InstanceGroups.Get(projectID, *zone, igName).Context(ctx).Do()
135136
if err != nil {
136137
return "", fmt.Errorf("error getting instance group %s in zone %s: %w", igName, *zone, err)

0 commit comments

Comments
 (0)