Skip to content

Commit

Permalink
manifests/gcp/cluster: set instance group role tag
Browse files Browse the repository at this point in the history
Sets the instance group role tag to "master" to be consistent with
the role tag expected by MAPI--rather than "apiserver" used by CAPI.
  • Loading branch information
patrickdillon committed May 2, 2024
1 parent fc594e9 commit 8c7d510
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
12 changes: 8 additions & 4 deletions pkg/asset/manifests/gcp/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ import (
"github.com/openshift/installer/pkg/types/gcp"
)

// InstanceGroupRoleTag is the tag used in the instance
// group name to maintain compatibility between MAPI & CAPI.
const InstanceGroupRoleTag = "master"

// GenerateClusterAssets generates the manifests for the cluster-api.
func GenerateClusterAssets(installConfig *installconfig.InstallConfig, clusterID *installconfig.ClusterID) (*capiutils.GenerateClusterAssetsOutput, error) {
manifests := []*asset.RuntimeFile{}

const (
description = "Created By OpenShift Installer"
)
const description = "Created By OpenShift Installer"

networkName := fmt.Sprintf("%s-network", clusterID.InfraID)
if installConfig.Config.GCP.Network != "" {
Expand Down Expand Up @@ -118,6 +119,9 @@ func GenerateClusterAssets(installConfig *installconfig.InstallConfig, clusterID
},
AdditionalLabels: labels,
FailureDomains: findFailureDomains(installConfig),
LoadBalancer: capg.LoadBalancerSpec{
APIServerInstanceGroupTagOverride: ptr.To(InstanceGroupRoleTag),
},
},
}
gcpCluster.SetGroupVersionKind(capg.GroupVersion.WithKind("GCPCluster"))
Expand Down
3 changes: 2 additions & 1 deletion pkg/infrastructure/gcp/clusterapi/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"github.com/sirupsen/logrus"
"google.golang.org/api/compute/v1"

"github.com/openshift/installer/pkg/asset/manifests/gcp"
"github.com/openshift/installer/pkg/infrastructure/clusterapi"
)

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

0 comments on commit 8c7d510

Please sign in to comment.