github.com/openshift/installer@v1.4.17/pkg/asset/manifests/capiutils/helpers.go (about) 1 package capiutils 2 3 import ( 4 "github.com/openshift/installer/pkg/asset/installconfig" 5 "github.com/openshift/installer/pkg/ipnet" 6 "github.com/openshift/installer/pkg/types" 7 typesazure "github.com/openshift/installer/pkg/types/azure" 8 ) 9 10 var ( 11 defaultCIDR = ipnet.MustParseCIDR("10.0.0.0/16") 12 ) 13 14 // CIDRFromInstallConfig generates the CIDR from the install config, 15 // or returns the default CIDR if none is found. 16 func CIDRFromInstallConfig(installConfig *installconfig.InstallConfig) *ipnet.IPNet { 17 if len(installConfig.Config.MachineNetwork) > 0 { 18 return &installConfig.Config.MachineNetwork[0].CIDR 19 } 20 return defaultCIDR 21 } 22 23 // IsEnabled returns true if the feature gate is enabled. 24 func IsEnabled(installConfig *installconfig.InstallConfig) bool { 25 platform := installConfig.Config.Platform.Name() 26 if azure := installConfig.Config.Platform.Azure; azure != nil && azure.CloudName == typesazure.StackCloud { 27 platform = typesazure.StackTerraformName 28 } 29 return types.ClusterAPIFeatureGateEnabled(platform, installConfig.Config.EnabledFeatureGates()) 30 } 31 32 // GenerateBoostrapMachineName generates the Cluster API Machine used for bootstrapping 33 // from the cluster ID and machine type. 34 func GenerateBoostrapMachineName(infraID string) string { 35 return infraID + "-bootstrap" 36 }