Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
8 changes: 5 additions & 3 deletions apis/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,21 @@ go 1.24.0
toolchain go1.24.6

require (
github.com/openshift/api v0.0.0-20250313134101-8a7efbfb5316
github.com/openshift/api v0.0.0-20250806102053-6a7223edb2fc
github.com/openshift/installer v1.4.19-ec5
k8s.io/api v0.33.3
k8s.io/apimachinery v0.33.3
sigs.k8s.io/yaml v1.4.0 // indirect
)

require (
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/logr v1.4.2 // indirect
github.com/go-logr/logr v1.4.2
github.com/gogo/protobuf v1.3.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/spf13/pflag v1.0.6 // indirect
github.com/x448/float16 v0.8.4 // indirect
golang.org/x/net v0.43.0 // indirect
golang.org/x/text v0.29.0 // indirect
Expand All @@ -33,3 +33,5 @@ require (

// CVE-2025-22872: Some transitive deps are still using older versions. Safe to remove once go.sum shows only 0.38.0 or higher.
replace golang.org/x/net => golang.org/x/net v0.38.0

replace github.com/openshift/installer => github.com/dlom/installer v0.0.0-20251022233056-d4fcf543b15c
9 changes: 6 additions & 3 deletions apis/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/dlom/installer v0.0.0-20251022233056-d4fcf543b15c h1:8L4spXM2MYFRcXEDrqTHqhnUlRtdUq2BGQ2yZioQOkA=
github.com/dlom/installer v0.0.0-20251022233056-d4fcf543b15c/go.mod h1:t0kOPPD5HJmywDLUJbQIluG+9PxbqN44ZZwzGwh/lsQ=
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
Expand All @@ -27,10 +29,11 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/openshift/api v0.0.0-20250313134101-8a7efbfb5316 h1:iJ1OkAUvFbQPB6qWRDxrH1jj8iA9GA/Jx2vYz7o+i1E=
github.com/openshift/api v0.0.0-20250313134101-8a7efbfb5316/go.mod h1:yk60tHAmHhtVpJQo3TwVYq2zpuP70iJIFDCmeKMIzPw=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/openshift/api v0.0.0-20250806102053-6a7223edb2fc h1:kAiInOGnd0+nsDcwl5YVceHfbT8Xk7tJq1vlYDVBonA=
github.com/openshift/api v0.0.0-20250806102053-6a7223edb2fc/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
Expand Down
3 changes: 3 additions & 0 deletions apis/hive/v1/clusterdeprovision_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,10 @@ type VSphereClusterDeprovision struct {
// necessary for communicating with the VCenter.
CertificatesSecretRef corev1.LocalObjectReference `json:"certificatesSecretRef"`
// VCenter is the vSphere vCenter hostname.
// Deprecated: use VCenters instead
VCenter string `json:"vCenter"`
// VCenters are potentially multiple vCenter hostnames. Prefer this field over VCenter.
VCenters []string `json:"vCenters"`
}

// IBMClusterDeprovision contains IBM Cloud specific configuration for a ClusterDeprovision
Expand Down
34 changes: 14 additions & 20 deletions apis/hive/v1/vsphere/machinepools.go
Original file line number Diff line number Diff line change
@@ -1,33 +1,27 @@
package vsphere

import "github.com/openshift/installer/pkg/types/vsphere"

// MachinePool stores the configuration for a machine pool installed
// on vSphere.
type MachinePool struct {
vsphere.MachinePool `json:",inline"`

// ResourcePool is the name of the resource pool that will be used for virtual machines.
// If it is not present, a default value will be used.
// Deprecated: use Topology instead
// +optional
ResourcePool string `json:"resourcePool,omitempty"`

// NumCPUs is the total number of virtual processor cores to assign a vm.
NumCPUs int32 `json:"cpus"`

// NumCoresPerSocket is the number of cores per socket in a vm. The number
// of vCPUs on the vm will be NumCPUs/NumCoresPerSocket.
NumCoresPerSocket int32 `json:"coresPerSocket"`

// Memory is the size of a VM's memory in MB.
MemoryMiB int64 `json:"memoryMB"`

// OSDisk defines the storage for instance.
OSDisk `json:"osDisk"`
DeprecatedResourcePool string `json:"resourcePool,omitempty"`

// TagIDs is a list of up to 10 tags to add to the VMs that this machine set provisions in vSphere.
// Deprecated: use Topology instead
// +kubebuilder:validation:MaxItems:=10
TagIDs []string `json:"tagIDs,omitempty"`
}
DeprecatedTagIDs []string `json:"tagIDs,omitempty"`

// OSDisk defines the disk for a virtual machine.
type OSDisk struct {
// DiskSizeGB defines the size of disk in GB.
DiskSizeGB int32 `json:"diskSizeGB"`
// Topology is the vSphere topology that will be used for virtual machines.
// If it is not present, a default value will be used.
// +optional
Topology *vsphere.Topology `json:"topology,omitempty"`
}

type OSDisk = vsphere.OSDisk
97 changes: 91 additions & 6 deletions apis/hive/v1/vsphere/platform.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,24 @@
package vsphere

import (
"fmt"
"strings"

"github.com/go-logr/logr"
"github.com/openshift/installer/pkg/types/vsphere"
corev1 "k8s.io/api/core/v1"
)

// Platform stores any global configuration used for vSphere platforms.
type Platform struct {
// Infrastructure is the desired state of the vSphere infrastructure provider.
Infrastructure *vsphere.Platform `json:"infrastructure,omitempty"`

// VCenter is the domain name or IP address of the vCenter.
VCenter string `json:"vCenter"`
// Deprecated: Please use Platform.Infrastructure instead
// See also: Platform.ConvertDeprecatedFields
// +optional
DeprecatedVCenter string `json:"vCenter,omitempty"`

// CredentialsSecretRef refers to a secret that contains the vSphere account access
// credentials: GOVC_USERNAME, GOVC_PASSWORD fields.
Expand All @@ -18,18 +29,92 @@ type Platform struct {
CertificatesSecretRef corev1.LocalObjectReference `json:"certificatesSecretRef"`

// Datacenter is the name of the datacenter to use in the vCenter.
Datacenter string `json:"datacenter"`
// Deprecated: Please use Platform.Infrastructure instead
// See also: Platform.ConvertDeprecatedFields
// +optional
DeprecatedDatacenter string `json:"datacenter,omitempty"`

// DefaultDatastore is the default datastore to use for provisioning volumes.
DefaultDatastore string `json:"defaultDatastore"`
// Deprecated: Please use Platform.Infrastructure instead
// See also: Platform.ConvertDeprecatedFields
// +optional
DeprecatedDefaultDatastore string `json:"defaultDatastore,omitempty"`

// Folder is the name of the folder that will be used and/or created for
// virtual machines.
Folder string `json:"folder,omitempty"`
// Deprecated: Please use Platform.Infrastructure instead
// See also: Platform.ConvertDeprecatedFields
// +optional
DeprecatedFolder string `json:"folder,omitempty"`

// Cluster is the name of the cluster virtual machines will be cloned into.
Cluster string `json:"cluster,omitempty"`
// Deprecated: Please use Platform.Infrastructure instead
// See also: Platform.ConvertDeprecatedFields
// +optional
DeprecatedCluster string `json:"cluster,omitempty"`

// Network specifies the name of the network to be used by the cluster.
Network string `json:"network,omitempty"`
// Deprecated: Please use Platform.Infrastructure instead
// See also: Platform.ConvertDeprecatedFields
// +optional
DeprecatedNetwork string `json:"network,omitempty"`
}

func (p *Platform) ConvertDeprecatedFields(logger logr.Logger) {
if p.Infrastructure != nil {
return
}

p.Infrastructure = &vsphere.Platform{
VCenters: []vsphere.VCenter{
{
Server: p.DeprecatedVCenter,
Port: 443,
Datacenters: []string{p.DeprecatedDatacenter},
},
},
FailureDomains: []vsphere.FailureDomain{
{
// names from https://github.com/openshift/installer/blob/f7731922a0f17a8339a3e837f72898ac77643611/pkg/types/vsphere/conversion/installconfig.go#L58-L61
Name: "generated-failure-domain",
Region: "generated-region",
Zone: "generated-zone",
Server: p.DeprecatedVCenter,
Topology: vsphere.Topology{
Datacenter: p.DeprecatedDatacenter,
Datastore: setDatastorePath(p.DeprecatedDefaultDatastore, p.DeprecatedDatacenter, logger),
Folder: setFolderPath(p.DeprecatedFolder, p.DeprecatedDatacenter, logger),
ComputeCluster: setComputeClusterPath(p.DeprecatedCluster, p.DeprecatedDatacenter, logger),
Networks: []string{p.DeprecatedNetwork},
},
},
},
}

}

// Copied (and slightly modified) from https://github.com/openshift/installer/blob/f7731922a0f17a8339a3e837f72898ac77643611/pkg/types/vsphere/conversion/installconfig.go#L75-L97

func setComputeClusterPath(cluster, datacenter string, logger logr.Logger) string {
if cluster != "" && !strings.HasPrefix(cluster, "/") {
logger.V(1).Info(fmt.Sprintf("computeCluster as a non-path is now depreciated please use the form: /%s/host/%s", datacenter, cluster))
return fmt.Sprintf("/%s/host/%s", datacenter, cluster)
}
return cluster
}

func setDatastorePath(datastore, datacenter string, logger logr.Logger) string {
if datastore != "" && !strings.HasPrefix(datastore, "/") {
logger.V(1).Info(fmt.Sprintf("datastore as a non-path is now depreciated please use the form: /%s/datastore/%s", datacenter, datastore))
return fmt.Sprintf("/%s/datastore/%s", datacenter, datastore)
}
return datastore
}

func setFolderPath(folder, datacenter string, logger logr.Logger) string {
if folder != "" && !strings.HasPrefix(folder, "/") {
logger.V(1).Info(fmt.Sprintf("folder as a non-path is now depreciated please use the form: /%s/vm/%s", datacenter, folder))
return fmt.Sprintf("/%s/vm/%s", datacenter, folder)
}
return folder
}
36 changes: 17 additions & 19 deletions apis/hive/v1/vsphere/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 7 additions & 2 deletions apis/hive/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions apis/vendor/github.com/openshift/api/config/v1/register.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading