diff --git a/pkg/asset/machines/vsphere/machines.go b/pkg/asset/machines/vsphere/machines.go index b85f9bf3022..c97c6ad0cf9 100644 --- a/pkg/asset/machines/vsphere/machines.go +++ b/pkg/asset/machines/vsphere/machines.go @@ -15,7 +15,6 @@ import ( ipamv1 "sigs.k8s.io/cluster-api/api/ipam/v1beta1" //nolint:staticcheck //CORS-3563 v1 "github.com/openshift/api/config/v1" - "github.com/openshift/api/features" machinev1 "github.com/openshift/api/machine/v1" machineapi "github.com/openshift/api/machine/v1beta1" "github.com/openshift/installer/pkg/types" @@ -147,17 +146,17 @@ func Machines(clusterID string, config *types.InstallConfig, pool *types.Machine if err != nil { return data, err } else if claim != nil && address != nil { - // To prevent having to touch many function below, adding logic here to ClusterCAPI issue with v1beta1 vs v1beta2. - // If cluster capi operator is enabled, we need to support v1beta2 of the IPAM. If disabled, we can keep v1beta1. - if config.Enabled(features.FeatureGateClusterAPIMachineManagement) { - logrus.Debug("updating capi ipam apiVersion from v1beta1 to v1beta2 when feature gate ClusterAPIMachineManagement is enabled") - for index := range claim { - claim[index].APIVersion = "ipam.cluster.x-k8s.io/v1beta2" - } - for index := range address { - address[index].APIVersion = "ipam.cluster.x-k8s.io/v1beta2" - } - } + // IPClaims and IPAddresses are both CAPI APIs whose CRD is + // installed by the CAPI operator based on manifests in the + // cluster-api component. + // + // To avoid requiring a call to a conversion webhook whose endpoint + // may not be up yet, we must ensure the IPAM API version specified + // here matches the storage version of the IPAM API installed by the + // cluster-api component. As of 4.22 this is v1beta1 for both + // Default and TPNU clusters, even though TPNU clusters use v1beta2. + // Expect to update this here when the cluster-api component storage + // version is updated to v1beta2. data.IPClaims = append(data.IPClaims, claim...) data.IPAddresses = append(data.IPAddresses, address...) }