github.com/openshift/installer@v1.4.17/pkg/infrastructure/gcp/clusterapi/network.go (about)

     1  package clusterapi
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  )
     7  
     8  func getAPIAddressName(infraID string) string {
     9  	return fmt.Sprintf("%s-api-internal", infraID)
    10  }
    11  
    12  func getInternalLBAddress(ctx context.Context, project, region, name string) (string, error) {
    13  	service, err := NewComputeService()
    14  	if err != nil {
    15  		return "", err
    16  	}
    17  
    18  	addrOutput, err := service.Addresses.Get(project, region, name).Context(ctx).Do()
    19  	if err != nil {
    20  		return "", fmt.Errorf("failed to get compute address %s: %w", name, err)
    21  	}
    22  	return addrOutput.Address, nil
    23  }