github.com/openshift/installer@v1.4.17/pkg/asset/cluster/gcp/gcp.go (about) 1 // Package gcp extracts GCP metadata from install configurations. 2 package gcp 3 4 import ( 5 "fmt" 6 7 "github.com/openshift/installer/pkg/types" 8 "github.com/openshift/installer/pkg/types/gcp" 9 ) 10 11 // Metadata converts an install configuration to GCP metadata. 12 func Metadata(config *types.InstallConfig) *gcp.Metadata { 13 // leave the private zone domain blank when not using a pre-created private zone 14 privateZoneDomain := fmt.Sprintf("%s.", config.ClusterDomain()) 15 if config.GCP.Network == "" || config.GCP.NetworkProjectID == "" { 16 privateZoneDomain = "" 17 } 18 19 return &gcp.Metadata{ 20 Region: config.Platform.GCP.Region, 21 ProjectID: config.Platform.GCP.ProjectID, 22 NetworkProjectID: config.Platform.GCP.NetworkProjectID, 23 PrivateZoneDomain: privateZoneDomain, 24 } 25 }