github.com/openshift/installer@v1.4.17/pkg/types/installconfig.go (about)

     1  package types
     2  
     3  import (
     4  	"fmt"
     5  	"strings"
     6  
     7  	"github.com/sirupsen/logrus"
     8  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     9  	"k8s.io/apimachinery/pkg/util/sets"
    10  
    11  	configv1 "github.com/openshift/api/config/v1"
    12  	features "github.com/openshift/api/features"
    13  	"github.com/openshift/installer/pkg/ipnet"
    14  	"github.com/openshift/installer/pkg/types/aws"
    15  	"github.com/openshift/installer/pkg/types/azure"
    16  	"github.com/openshift/installer/pkg/types/baremetal"
    17  	"github.com/openshift/installer/pkg/types/external"
    18  	"github.com/openshift/installer/pkg/types/featuregates"
    19  	"github.com/openshift/installer/pkg/types/gcp"
    20  	"github.com/openshift/installer/pkg/types/ibmcloud"
    21  	"github.com/openshift/installer/pkg/types/none"
    22  	"github.com/openshift/installer/pkg/types/nutanix"
    23  	"github.com/openshift/installer/pkg/types/openstack"
    24  	"github.com/openshift/installer/pkg/types/ovirt"
    25  	"github.com/openshift/installer/pkg/types/powervs"
    26  	"github.com/openshift/installer/pkg/types/vsphere"
    27  )
    28  
    29  const (
    30  	// InstallConfigVersion is the version supported by this package.
    31  	// If you bump this, you must also update the list of convertable values in
    32  	// pkg/types/conversion/installconfig.go
    33  	InstallConfigVersion = "v1"
    34  )
    35  
    36  var (
    37  	// PlatformNames is a slice with all the visibly-supported
    38  	// platform names in alphabetical order. This is the list of
    39  	// platforms presented to the user in the interactive wizard.
    40  	PlatformNames = []string{
    41  		aws.Name,
    42  		azure.Name,
    43  		baremetal.Name,
    44  		gcp.Name,
    45  		ibmcloud.Name,
    46  		nutanix.Name,
    47  		openstack.Name,
    48  		powervs.Name,
    49  		vsphere.Name,
    50  	}
    51  	// HiddenPlatformNames is a slice with all the
    52  	// hidden-but-supported platform names. This list isn't presented
    53  	// to the user in the interactive wizard.
    54  	HiddenPlatformNames = []string{
    55  		external.Name,
    56  		none.Name,
    57  	}
    58  
    59  	// FCOS is a setting to enable Fedora CoreOS-only modifications
    60  	FCOS = false
    61  	// SCOS is a setting to enable CentOS Stream CoreOS-only modifications
    62  	SCOS = false
    63  )
    64  
    65  // PublishingStrategy is a strategy for how various endpoints for the cluster are exposed.
    66  // +kubebuilder:validation:Enum="";External;Internal
    67  type PublishingStrategy string
    68  
    69  const (
    70  	// ExternalPublishingStrategy exposes endpoints for the cluster to the Internet.
    71  	ExternalPublishingStrategy PublishingStrategy = "External"
    72  	// InternalPublishingStrategy exposes the endpoints for the cluster to the private network only.
    73  	InternalPublishingStrategy PublishingStrategy = "Internal"
    74  	// MixedPublishingStrategy allows for the api server and the ingress to be configured individually for exposure to
    75  	// private network or Internet.
    76  	MixedPublishingStrategy PublishingStrategy = "Mixed"
    77  )
    78  
    79  // PolicyType is for usage polices that are applied to additionalTrustBundle.
    80  // +kubebuilder:validation:Enum="";Proxyonly;Always
    81  type PolicyType string
    82  
    83  const (
    84  	// PolicyProxyOnly  enables use of AdditionalTrustBundle when http/https proxy is configured.
    85  	PolicyProxyOnly PolicyType = "Proxyonly"
    86  	// PolicyAlways ignores all conditions and uses AdditionalTrustBundle.
    87  	PolicyAlways PolicyType = "Always"
    88  )
    89  
    90  //go:generate go run ../../vendor/sigs.k8s.io/controller-tools/cmd/controller-gen crd:crdVersions=v1 paths=. output:dir=../../data/data/
    91  
    92  // InstallConfig is the configuration for an OpenShift install.
    93  type InstallConfig struct {
    94  	// +optional
    95  	metav1.TypeMeta `json:",inline"`
    96  
    97  	metav1.ObjectMeta `json:"metadata"`
    98  
    99  	// AdditionalTrustBundle is a PEM-encoded X.509 certificate bundle
   100  	// that will be added to the nodes' trusted certificate store.
   101  	//
   102  	// +optional
   103  	AdditionalTrustBundle string `json:"additionalTrustBundle,omitempty"`
   104  
   105  	// AdditionalTrustBundlePolicy determines when to add the AdditionalTrustBundle
   106  	// to the nodes' trusted certificate store. "Proxyonly" is the default.
   107  	// The field can be set to following specified values.
   108  	// "Proxyonly" : adds the AdditionalTrustBundle to nodes when http/https proxy is configured.
   109  	// "Always" : always adds AdditionalTrustBundle.
   110  	AdditionalTrustBundlePolicy PolicyType `json:"additionalTrustBundlePolicy,omitempty"`
   111  
   112  	// SSHKey is the public Secure Shell (SSH) key to provide access to instances.
   113  	// +optional
   114  	SSHKey string `json:"sshKey,omitempty"`
   115  
   116  	// BaseDomain is the base domain to which the cluster should belong.
   117  	BaseDomain string `json:"baseDomain"`
   118  
   119  	// Networking is the configuration for the pod network provider in
   120  	// the cluster.
   121  	*Networking `json:"networking,omitempty"`
   122  
   123  	// ControlPlane is the configuration for the machines that comprise the
   124  	// control plane.
   125  	// +optional
   126  	ControlPlane *MachinePool `json:"controlPlane,omitempty"`
   127  
   128  	// Compute is the configuration for the machines that comprise the
   129  	// compute nodes.
   130  	// +optional
   131  	Compute []MachinePool `json:"compute,omitempty"`
   132  
   133  	// Platform is the configuration for the specific platform upon which to
   134  	// perform the installation.
   135  	Platform `json:"platform"`
   136  
   137  	// PullSecret is the secret to use when pulling images.
   138  	PullSecret string `json:"pullSecret"`
   139  
   140  	// Proxy defines the proxy settings for the cluster.
   141  	// If unset, the cluster will not be configured to use a proxy.
   142  	// +optional
   143  	Proxy *Proxy `json:"proxy,omitempty"`
   144  
   145  	// ImageContentSources lists sources/repositories for the release-image content.
   146  	// The field is deprecated. Please use imageDigestSources.
   147  	// +optional
   148  	DeprecatedImageContentSources []ImageContentSource `json:"imageContentSources,omitempty"`
   149  
   150  	// ImageDigestSources lists sources/repositories for the release-image content.
   151  	// +optional
   152  	ImageDigestSources []ImageDigestSource `json:"imageDigestSources,omitempty"`
   153  
   154  	// Publish controls how the user facing endpoints of the cluster like the Kubernetes API, OpenShift routes etc. are exposed.
   155  	// When no strategy is specified, the strategy is "External".
   156  	//
   157  	// +kubebuilder:default=External
   158  	// +optional
   159  	Publish PublishingStrategy `json:"publish,omitempty"`
   160  
   161  	// OperatorPublishingStrategy controls the visibility of ingress and apiserver. Defaults to public.
   162  	OperatorPublishingStrategy *OperatorPublishingStrategy `json:"operatorPublishingStrategy,omitempty"`
   163  
   164  	// FIPS configures https://www.nist.gov/itl/fips-general-information
   165  	//
   166  	// +kubebuilder:default=false
   167  	// +optional
   168  	FIPS bool `json:"fips,omitempty"`
   169  
   170  	// CPUPartitioning determines if a cluster should be setup for CPU workload partitioning at install time.
   171  	// When this field is set the cluster will be flagged for CPU Partitioning allowing users to segregate workloads to
   172  	// specific CPU Sets. This does not make any decisions on workloads it only configures the nodes to allow CPU Partitioning.
   173  	// The "AllNodes" value will setup all nodes for CPU Partitioning, the default is "None".
   174  	//
   175  	// +kubebuilder:default="None"
   176  	// +optional
   177  	CPUPartitioning CPUPartitioningMode `json:"cpuPartitioningMode,omitempty"`
   178  
   179  	// CredentialsMode is used to explicitly set the mode with which CredentialRequests are satisfied.
   180  	//
   181  	// If this field is set, then the installer will not attempt to query the cloud permissions before attempting
   182  	// installation. If the field is not set or empty, then the installer will perform its normal verification that the
   183  	// credentials provided are sufficient to perform an installation.
   184  	//
   185  	// There are three possible values for this field, but the valid values are dependent upon the platform being used.
   186  	// "Mint": create new credentials with a subset of the overall permissions for each CredentialsRequest
   187  	// "Passthrough": copy the credentials with all of the overall permissions for each CredentialsRequest
   188  	// "Manual": CredentialsRequests must be handled manually by the user
   189  	//
   190  	// For each of the following platforms, the field can set to the specified values. For all other platforms, the
   191  	// field must not be set.
   192  	// AWS: "Mint", "Passthrough", "Manual"
   193  	// Azure: "Passthrough", "Manual"
   194  	// AzureStack: "Manual"
   195  	// GCP: "Mint", "Passthrough", "Manual"
   196  	// IBMCloud: "Manual"
   197  	// PowerVS: "Manual"
   198  	// Nutanix: "Manual"
   199  	// +optional
   200  	CredentialsMode CredentialsMode `json:"credentialsMode,omitempty"`
   201  
   202  	// BootstrapInPlace is the configuration for installing a single node
   203  	// with bootstrap in place installation.
   204  	BootstrapInPlace *BootstrapInPlace `json:"bootstrapInPlace,omitempty"`
   205  
   206  	// Capabilities configures the installation of optional core cluster components.
   207  	// +optional
   208  	Capabilities *Capabilities `json:"capabilities,omitempty"`
   209  
   210  	// FeatureSet enables features that are not part of the default feature set.
   211  	// Valid values are "Default", "TechPreviewNoUpgrade" and "CustomNoUpgrade".
   212  	// When omitted, the "Default" feature set is used.
   213  	// +optional
   214  	FeatureSet configv1.FeatureSet `json:"featureSet,omitempty"`
   215  
   216  	// FeatureGates enables a set of custom feature gates.
   217  	// May only be used in conjunction with FeatureSet "CustomNoUpgrade".
   218  	// Features may be enabled or disabled by providing a true or false value for the feature gate.
   219  	// E.g. "featureGates": ["FeatureGate1=true", "FeatureGate2=false"].
   220  	// +optional
   221  	FeatureGates []string `json:"featureGates,omitempty"`
   222  }
   223  
   224  // ClusterDomain returns the DNS domain that all records for a cluster must belong to.
   225  func (c *InstallConfig) ClusterDomain() string {
   226  	return fmt.Sprintf("%s.%s", c.ObjectMeta.Name, strings.TrimSuffix(c.BaseDomain, "."))
   227  }
   228  
   229  // IsFCOS returns true if Fedora CoreOS-only modifications are enabled
   230  func (c *InstallConfig) IsFCOS() bool {
   231  	return FCOS
   232  }
   233  
   234  // IsSCOS returns true if CentOs Stream CoreOS-only modifications are enabled
   235  func (c *InstallConfig) IsSCOS() bool {
   236  	return SCOS
   237  }
   238  
   239  // IsOKD returns true if community-only modifications are enabled
   240  func (c *InstallConfig) IsOKD() bool {
   241  	return c.IsFCOS() || c.IsSCOS()
   242  }
   243  
   244  // IsSingleNodeOpenShift returns true if the install-config has been configured for
   245  // bootstrapInPlace
   246  func (c *InstallConfig) IsSingleNodeOpenShift() bool {
   247  	return c.BootstrapInPlace != nil
   248  }
   249  
   250  // CPUPartitioningMode defines how the nodes should be setup for partitioning the CPU Sets.
   251  // +kubebuilder:validation:Enum=None;AllNodes
   252  type CPUPartitioningMode string
   253  
   254  const (
   255  	// CPUPartitioningNone means that no CPU Partitioning is on in this cluster infrastructure.
   256  	CPUPartitioningNone CPUPartitioningMode = "None"
   257  	// CPUPartitioningAllNodes means that all nodes are configured with CPU Partitioning in this cluster.
   258  	CPUPartitioningAllNodes CPUPartitioningMode = "AllNodes"
   259  )
   260  
   261  // Platform is the configuration for the specific platform upon which to perform
   262  // the installation. Only one of the platform configuration should be set.
   263  type Platform struct {
   264  	// AWS is the configuration used when installing on AWS.
   265  	// +optional
   266  	AWS *aws.Platform `json:"aws,omitempty"`
   267  
   268  	// Azure is the configuration used when installing on Azure.
   269  	// +optional
   270  	Azure *azure.Platform `json:"azure,omitempty"`
   271  
   272  	// BareMetal is the configuration used when installing on bare metal.
   273  	// +optional
   274  	BareMetal *baremetal.Platform `json:"baremetal,omitempty"`
   275  
   276  	// GCP is the configuration used when installing on Google Cloud Platform.
   277  	// +optional
   278  	GCP *gcp.Platform `json:"gcp,omitempty"`
   279  
   280  	// IBMCloud is the configuration used when installing on IBM Cloud.
   281  	// +optional
   282  	IBMCloud *ibmcloud.Platform `json:"ibmcloud,omitempty"`
   283  
   284  	// None is the empty configuration used when installing on an unsupported
   285  	// platform.
   286  	None *none.Platform `json:"none,omitempty"`
   287  
   288  	// External is the configuration used when installing on
   289  	// an external cloud provider.
   290  	External *external.Platform `json:"external,omitempty"`
   291  
   292  	// OpenStack is the configuration used when installing on OpenStack.
   293  	// +optional
   294  	OpenStack *openstack.Platform `json:"openstack,omitempty"`
   295  
   296  	// PowerVS is the configuration used when installing on Power VS.
   297  	// +optional
   298  	PowerVS *powervs.Platform `json:"powervs,omitempty"`
   299  
   300  	// VSphere is the configuration used when installing on vSphere.
   301  	// +optional
   302  	VSphere *vsphere.Platform `json:"vsphere,omitempty"`
   303  
   304  	// Ovirt is the configuration used when installing on oVirt.
   305  	// +optional
   306  	Ovirt *ovirt.Platform `json:"ovirt,omitempty"`
   307  
   308  	// Nutanix is the configuration used when installing on Nutanix.
   309  	// +optional
   310  	Nutanix *nutanix.Platform `json:"nutanix,omitempty"`
   311  }
   312  
   313  // OperatorPublishingStrategy is used to control the visibility of the components which can be used to have a mix of public
   314  // and private resources.
   315  type OperatorPublishingStrategy struct {
   316  	// Ingress sets the visibility of the created dns resources.
   317  	// +kubebuilder:validation:Enum="";External;Internal
   318  	// +kubebuilder:default=External
   319  	// +optional
   320  	Ingress string `json:"ingress,omitempty"`
   321  
   322  	// APIServer sets the visibility of the load balancers servicing the APIserver.
   323  	// +kubebuilder:validation:Enum="";External;Internal
   324  	// +kubebuilder:default=External
   325  	// +optional
   326  	APIServer string `json:"apiserver,omitempty"`
   327  }
   328  
   329  // Name returns a string representation of the platform (e.g. "aws" if
   330  // AWS is non-nil).  It returns an empty string if no platform is
   331  // configured.
   332  func (p *Platform) Name() string {
   333  	switch {
   334  	case p == nil:
   335  		return ""
   336  	case p.AWS != nil:
   337  		return aws.Name
   338  	case p.Azure != nil:
   339  		return azure.Name
   340  	case p.BareMetal != nil:
   341  		return baremetal.Name
   342  	case p.GCP != nil:
   343  		return gcp.Name
   344  	case p.IBMCloud != nil:
   345  		return ibmcloud.Name
   346  	case p.None != nil:
   347  		return none.Name
   348  	case p.External != nil:
   349  		return external.Name
   350  	case p.OpenStack != nil:
   351  		return openstack.Name
   352  	case p.VSphere != nil:
   353  		return vsphere.Name
   354  	case p.Ovirt != nil:
   355  		return ovirt.Name
   356  	case p.PowerVS != nil:
   357  		return powervs.Name
   358  	case p.Nutanix != nil:
   359  		return nutanix.Name
   360  	default:
   361  		return ""
   362  	}
   363  }
   364  
   365  // Networking defines the pod network provider in the cluster.
   366  type Networking struct {
   367  	// NetworkType is the type of network to install.
   368  	// The default value is OVNKubernetes.
   369  	//
   370  	// +kubebuilder:default=OVNKubernetes
   371  	// +optional
   372  	NetworkType string `json:"networkType,omitempty"`
   373  
   374  	// MachineNetwork is the list of IP address pools for machines.
   375  	// This field replaces MachineCIDR, and if set MachineCIDR must
   376  	// be empty or match the first entry in the list.
   377  	// Default is 10.0.0.0/16 for all platforms other than Power VS.
   378  	// For Power VS, the default is 192.168.0.0/24.
   379  	//
   380  	// +optional
   381  	MachineNetwork []MachineNetworkEntry `json:"machineNetwork,omitempty"`
   382  
   383  	// ClusterNetwork is the list of IP address pools for pods.
   384  	// Default is 10.128.0.0/14 and a host prefix of /23.
   385  	//
   386  	// +optional
   387  	ClusterNetwork []ClusterNetworkEntry `json:"clusterNetwork,omitempty"`
   388  
   389  	// ServiceNetwork is the list of IP address pools for services.
   390  	// Default is 172.30.0.0/16.
   391  	// NOTE: currently only one entry is supported.
   392  	//
   393  	// +kubebuilder:validation:MaxItems=1
   394  	// +optional
   395  	ServiceNetwork []ipnet.IPNet `json:"serviceNetwork,omitempty"`
   396  
   397  	// ClusterNetworkMTU is the Maximum Transmit (MTU) Unit size in bytes to allocate to the cluster network.
   398  	// For example, 1200 would set the MTU of the entire overlay network. If the deployment does
   399  	// not require changes in the network plugin, leave it unset and the MTU will be calculated
   400  	// automatically based on the host network MTU.
   401  	// +optional
   402  	ClusterNetworkMTU uint32 `json:"clusterNetworkMTU,omitempty"`
   403  
   404  	// Deprecated types, scheduled to be removed
   405  
   406  	// Deprecated way to configure an IP address pool for machines.
   407  	// Replaced by MachineNetwork which allows for multiple pools.
   408  	// +optional
   409  	DeprecatedMachineCIDR *ipnet.IPNet `json:"machineCIDR,omitempty"`
   410  
   411  	// Deprecated name for NetworkType
   412  	// +optional
   413  	DeprecatedType string `json:"type,omitempty"`
   414  
   415  	// Deprecated way to configure an IP address pool for services.
   416  	// Replaced by ServiceNetwork which allows for multiple pools.
   417  	// +optional
   418  	DeprecatedServiceCIDR *ipnet.IPNet `json:"serviceCIDR,omitempty"`
   419  
   420  	// Deprecated name for ClusterNetwork
   421  	// +optional
   422  	DeprecatedClusterNetworks []ClusterNetworkEntry `json:"clusterNetworks,omitempty"`
   423  }
   424  
   425  // MachineNetworkEntry is a single IP address block for node IP blocks.
   426  type MachineNetworkEntry struct {
   427  	// CIDR is the IP block address pool for machines within the cluster.
   428  	CIDR ipnet.IPNet `json:"cidr"`
   429  }
   430  
   431  // ClusterNetworkEntry is a single IP address block for pod IP blocks. IP blocks
   432  // are allocated with size 2^HostSubnetLength.
   433  type ClusterNetworkEntry struct {
   434  	// CIDR is the IP block address pool.
   435  	CIDR ipnet.IPNet `json:"cidr"`
   436  
   437  	// HostPrefix is the prefix size to allocate to each node from the CIDR.
   438  	// For example, 24 would allocate 2^8=256 adresses to each node. If this
   439  	// field is not used by the plugin, it can be left unset.
   440  	// +optional
   441  	HostPrefix int32 `json:"hostPrefix,omitempty"`
   442  
   443  	// The size of blocks to allocate from the larger pool.
   444  	// This is the length in bits - so a 9 here will allocate a /23.
   445  	// +optional
   446  	DeprecatedHostSubnetLength int32 `json:"hostSubnetLength,omitempty"`
   447  }
   448  
   449  // Proxy defines the proxy settings for the cluster.
   450  // At least one of HTTPProxy or HTTPSProxy is required.
   451  type Proxy struct {
   452  	// HTTPProxy is the URL of the proxy for HTTP requests.
   453  	// +optional
   454  	HTTPProxy string `json:"httpProxy,omitempty"`
   455  
   456  	// HTTPSProxy is the URL of the proxy for HTTPS requests.
   457  	// +optional
   458  	HTTPSProxy string `json:"httpsProxy,omitempty"`
   459  
   460  	// NoProxy is a comma-separated list of domains and CIDRs for which the proxy should not be used.
   461  	// +optional
   462  	NoProxy string `json:"noProxy,omitempty"`
   463  }
   464  
   465  // ImageContentSource defines a list of sources/repositories that can be used to pull content.
   466  // The field is deprecated. Please use imageDigestSources.
   467  type ImageContentSource struct {
   468  	// Source is the repository that users refer to, e.g. in image pull specifications.
   469  	Source string `json:"source"`
   470  
   471  	// Mirrors is one or more repositories that may also contain the same images.
   472  	// +optional
   473  	Mirrors []string `json:"mirrors,omitempty"`
   474  }
   475  
   476  // ImageDigestSource defines a list of sources/repositories that can be used to pull content.
   477  type ImageDigestSource struct {
   478  	// Source is the repository that users refer to, e.g. in image pull specifications.
   479  	Source string `json:"source"`
   480  
   481  	// Mirrors is one or more repositories that may also contain the same images.
   482  	// +optional
   483  	Mirrors []string `json:"mirrors,omitempty"`
   484  }
   485  
   486  // CredentialsMode is the mode by which CredentialsRequests will be satisfied.
   487  // +kubebuilder:validation:Enum="";Mint;Passthrough;Manual
   488  type CredentialsMode string
   489  
   490  const (
   491  	// ManualCredentialsMode indicates that cloud-credential-operator should not process any CredentialsRequests.
   492  	ManualCredentialsMode CredentialsMode = "Manual"
   493  
   494  	// MintCredentialsMode indicates that cloud-credential-operator should be creating users for each
   495  	// CredentialsRequest.
   496  	MintCredentialsMode CredentialsMode = "Mint"
   497  
   498  	// PassthroughCredentialsMode indicates that cloud-credential-operator should just copy over the cluster's
   499  	// cloud credentials for each CredentialsRequest.
   500  	PassthroughCredentialsMode CredentialsMode = "Passthrough"
   501  )
   502  
   503  // BootstrapInPlace defines the configuration for bootstrap-in-place installation
   504  type BootstrapInPlace struct {
   505  	// InstallationDisk is the target disk drive for coreos-installer
   506  	InstallationDisk string `json:"installationDisk"`
   507  }
   508  
   509  // Capabilities selects the managed set of optional, core cluster components.
   510  type Capabilities struct {
   511  	// baselineCapabilitySet selects an initial set of
   512  	// optional capabilities to enable, which can be extended via
   513  	// additionalEnabledCapabilities. The default is vCurrent.
   514  	// +optional
   515  	BaselineCapabilitySet configv1.ClusterVersionCapabilitySet `json:"baselineCapabilitySet,omitempty"`
   516  
   517  	// additionalEnabledCapabilities extends the set of managed
   518  	// capabilities beyond the baseline defined in
   519  	// baselineCapabilitySet. The default is an empty set.
   520  	// +optional
   521  	AdditionalEnabledCapabilities []configv1.ClusterVersionCapability `json:"additionalEnabledCapabilities,omitempty"`
   522  }
   523  
   524  // GetEnabledCapabilities returns a set of enabled ClusterVersionCapabilities.
   525  func (c *InstallConfig) GetEnabledCapabilities() sets.Set[configv1.ClusterVersionCapability] {
   526  	enabledCaps := sets.Set[configv1.ClusterVersionCapability]{}
   527  	if c.Capabilities == nil || c.Capabilities.BaselineCapabilitySet == "" {
   528  		// when Capabilities and/or BaselineCapabilitySet is not specified, default is vCurrent
   529  		baseSet := configv1.ClusterVersionCapabilitySets[configv1.ClusterVersionCapabilitySetCurrent]
   530  		for _, cap := range baseSet {
   531  			enabledCaps.Insert(cap)
   532  		}
   533  	}
   534  	if c.Capabilities != nil {
   535  		if c.Capabilities.BaselineCapabilitySet != "" {
   536  			baseSet := configv1.ClusterVersionCapabilitySets[c.Capabilities.BaselineCapabilitySet]
   537  			for _, cap := range baseSet {
   538  				enabledCaps.Insert(cap)
   539  			}
   540  		}
   541  		if c.Capabilities.AdditionalEnabledCapabilities != nil {
   542  			for _, cap := range c.Capabilities.AdditionalEnabledCapabilities {
   543  				enabledCaps.Insert(cap)
   544  			}
   545  		}
   546  	}
   547  	return enabledCaps
   548  }
   549  
   550  // WorkerMachinePool retrieves the worker MachinePool from InstallConfig.Compute
   551  func (c *InstallConfig) WorkerMachinePool() *MachinePool {
   552  	for _, machinePool := range c.Compute {
   553  		switch machinePool.Name {
   554  		case MachinePoolComputeRoleName, MachinePoolEdgeRoleName:
   555  			return &machinePool
   556  		}
   557  	}
   558  
   559  	return nil
   560  }
   561  
   562  // EnabledFeatureGates returns a FeatureGate that can be checked (using the Enabled function)
   563  // to determine if a feature gate is enabled in the current feature sets.
   564  func (c *InstallConfig) EnabledFeatureGates() featuregates.FeatureGate {
   565  	var customFS *configv1.CustomFeatureGates
   566  
   567  	if c.FeatureSet == configv1.CustomNoUpgrade {
   568  		customFS = featuregates.GenerateCustomFeatures(c.FeatureGates)
   569  	}
   570  
   571  	clusterProfile := GetClusterProfileName()
   572  	featureSets, ok := features.AllFeatureSets()[clusterProfile]
   573  	if !ok {
   574  		logrus.Warnf("no feature sets for cluster profile %q", clusterProfile)
   575  	}
   576  	fg := featuregates.FeatureGateFromFeatureSets(featureSets, c.FeatureSet, customFS)
   577  
   578  	return fg
   579  }
   580  
   581  // ClusterAPIFeatureGateEnabled checks whether feature gates enabling
   582  // cluster api installs are enabled.
   583  func ClusterAPIFeatureGateEnabled(platform string, fgs featuregates.FeatureGate) bool {
   584  	// FeatureGateClusterAPIInstall enables for all platforms.
   585  	if fgs.Enabled(features.FeatureGateClusterAPIInstall) {
   586  		return true
   587  	}
   588  
   589  	// Check if CAPI install is enabled for individual platforms.
   590  	switch platform {
   591  	case aws.Name, azure.Name, gcp.Name, nutanix.Name, openstack.Name, powervs.Name, vsphere.Name:
   592  		return true
   593  	case azure.StackTerraformName, azure.StackCloud.Name():
   594  		return false
   595  	case ibmcloud.Name:
   596  		return fgs.Enabled(features.FeatureGateClusterAPIInstallIBMCloud)
   597  	default:
   598  		return false
   599  	}
   600  }
   601  
   602  // MultiArchFeatureGateEnabled checks whether feature gate enabling multi-arch clusters is enabled.
   603  func MultiArchFeatureGateEnabled(platform string, fgs featuregates.FeatureGate) bool {
   604  	switch platform {
   605  	case aws.Name:
   606  		return fgs.Enabled(features.FeatureGateMultiArchInstallAWS)
   607  	case gcp.Name:
   608  		return fgs.Enabled(features.FeatureGateMultiArchInstallGCP)
   609  	default:
   610  		return false
   611  	}
   612  }
   613  
   614  // PublicAPI indicates whether the API load balancer should be public
   615  // by inspecting the cluster and operator publishing strategies.
   616  func (c *InstallConfig) PublicAPI() bool {
   617  	if c.Publish == ExternalPublishingStrategy {
   618  		return true
   619  	}
   620  
   621  	if op := c.OperatorPublishingStrategy; op != nil && strings.EqualFold(op.APIServer, "External") {
   622  		return true
   623  	}
   624  	return false
   625  }