Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkg/asset/machines/vsphere/machines.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ 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"
Expand Down Expand Up @@ -146,6 +147,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.EnabledFeatureGates().Enabled(features.FeatureGateClusterAPIMachineManagement) {
fmt.Println("Processing api update")
for index := range claim {
claim[index].APIVersion = "ipam.cluster.x-k8s.io/v1beta2"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the v1beta2 packages directly? They can be vendored as the installer is up to date with capi 1.11

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or possibly continue to create the v1beta1, but call the conversion directly via scheme (i.e. no webhook involved) if we need v1beta2.

}
for index := range address {
address[index].APIVersion = "ipam.cluster.x-k8s.io/v1beta2"
}
}
data.IPClaims = append(data.IPClaims, claim...)
data.IPAddresses = append(data.IPAddresses, address...)
}
Expand Down