Skip to content

Commit 0ce7d86

Browse files
committed
HIVE-2391: vSphere zonal support
1 parent 5a3b603 commit 0ce7d86

File tree

1,878 files changed

+536156
-23232
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,878 files changed

+536156
-23232
lines changed

apis/go.mod

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,23 @@ go 1.24.0
55
toolchain go1.24.6
66

77
require (
8-
github.com/openshift/api v0.0.0-20250313134101-8a7efbfb5316
8+
github.com/openshift/api v0.0.0-20250806102053-6a7223edb2fc
9+
github.com/openshift/installer v1.4.19-ec5
910
k8s.io/api v0.33.3
1011
k8s.io/apimachinery v0.33.3
1112
sigs.k8s.io/yaml v1.4.0 // indirect
1213
)
1314

1415
require (
1516
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
16-
github.com/go-logr/logr v1.4.2 // indirect
17+
github.com/go-logr/logr v1.4.2
1718
github.com/gogo/protobuf v1.3.2 // indirect
1819
github.com/json-iterator/go v1.1.12 // indirect
19-
github.com/kr/text v0.2.0 // indirect
2020
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2121
github.com/modern-go/reflect2 v1.0.2 // indirect
22-
github.com/spf13/pflag v1.0.6 // indirect
2322
github.com/x448/float16 v0.8.4 // indirect
24-
golang.org/x/net v0.38.0 // indirect
25-
golang.org/x/text v0.23.0 // indirect
23+
golang.org/x/net v0.40.0 // indirect
24+
golang.org/x/text v0.25.0 // indirect
2625
gopkg.in/inf.v0 v0.9.1 // indirect
2726
k8s.io/klog/v2 v2.130.1 // indirect
2827
k8s.io/utils v0.0.0-20241210054802-24370beab758 // indirect
@@ -31,5 +30,9 @@ require (
3130
sigs.k8s.io/structured-merge-diff/v4 v4.6.0 // indirect
3231
)
3332

33+
require github.com/kr/text v0.2.0 // indirect
34+
3435
// CVE-2025-22872: Some transitive deps are still using older versions. Safe to remove once go.sum shows only 0.38.0 or higher.
3536
replace golang.org/x/net => golang.org/x/net v0.38.0
37+
38+
replace github.com/openshift/installer => github.com/dlom/installer v0.0.0-20251022025850-76157f125d29

apis/go.sum

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
33
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
44
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM=
55
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
6+
github.com/dlom/installer v0.0.0-20251022025850-76157f125d29 h1:KGpERRn31DnQrB4A2Or06bf8B1VlCM2VtOLs7BkoZCg=
7+
github.com/dlom/installer v0.0.0-20251022025850-76157f125d29/go.mod h1:t0kOPPD5HJmywDLUJbQIluG+9PxbqN44ZZwzGwh/lsQ=
68
github.com/fxamacker/cbor/v2 v2.7.0 h1:iM5WgngdRBanHcxugY4JySA0nk1wZorNOpTgCMedv5E=
79
github.com/fxamacker/cbor/v2 v2.7.0/go.mod h1:pxXPTn3joSm21Gbwsv0w9OSA2y1HFR9qXEeXQVeNoDQ=
810
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
@@ -27,10 +29,11 @@ github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w
2729
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
2830
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
2931
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
30-
github.com/openshift/api v0.0.0-20250313134101-8a7efbfb5316 h1:iJ1OkAUvFbQPB6qWRDxrH1jj8iA9GA/Jx2vYz7o+i1E=
31-
github.com/openshift/api v0.0.0-20250313134101-8a7efbfb5316/go.mod h1:yk60tHAmHhtVpJQo3TwVYq2zpuP70iJIFDCmeKMIzPw=
32-
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
32+
github.com/openshift/api v0.0.0-20250806102053-6a7223edb2fc h1:kAiInOGnd0+nsDcwl5YVceHfbT8Xk7tJq1vlYDVBonA=
33+
github.com/openshift/api v0.0.0-20250806102053-6a7223edb2fc/go.mod h1:SPLf21TYPipzCO67BURkCfK6dcIIxx0oNRVWaOyRcXM=
3334
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
35+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
36+
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
3437
github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII=
3538
github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o=
3639
github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o=
@@ -76,8 +79,9 @@ golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9sn
7679
golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g=
7780
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
7881
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
79-
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
8082
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
83+
golang.org/x/text v0.25.0 h1:qVyWApTSYLk/drJRO5mDlNYskwQznZmkpV2c8q9zls4=
84+
golang.org/x/text v0.25.0/go.mod h1:WEdwpYrmk1qmdHvhkSTNPm3app7v4rsT8F2UD6+VHIA=
8185
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
8286
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
8387
golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE=

apis/hive/v1/clusterdeprovision_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,10 @@ type VSphereClusterDeprovision struct {
129129
// necessary for communicating with the VCenter.
130130
CertificatesSecretRef corev1.LocalObjectReference `json:"certificatesSecretRef"`
131131
// VCenter is the vSphere vCenter hostname.
132+
// Deprecated: use VCenters instead
132133
VCenter string `json:"vCenter"`
134+
// VCenters are potentially multiple vCenter hostnames. Prefer this field over VCenter.
135+
VCenters []string `json:"vCenters"`
133136
}
134137

135138
// IBMClusterDeprovision contains IBM Cloud specific configuration for a ClusterDeprovision
Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,27 @@
11
package vsphere
22

3+
import "github.com/openshift/installer/pkg/types/vsphere"
4+
35
// MachinePool stores the configuration for a machine pool installed
46
// on vSphere.
57
type MachinePool struct {
8+
vsphere.MachinePool `json:",inline"`
9+
610
// ResourcePool is the name of the resource pool that will be used for virtual machines.
711
// If it is not present, a default value will be used.
12+
// Deprecated: use Topology instead
813
// +optional
9-
ResourcePool string `json:"resourcePool,omitempty"`
10-
11-
// NumCPUs is the total number of virtual processor cores to assign a vm.
12-
NumCPUs int32 `json:"cpus"`
13-
14-
// NumCoresPerSocket is the number of cores per socket in a vm. The number
15-
// of vCPUs on the vm will be NumCPUs/NumCoresPerSocket.
16-
NumCoresPerSocket int32 `json:"coresPerSocket"`
17-
18-
// Memory is the size of a VM's memory in MB.
19-
MemoryMiB int64 `json:"memoryMB"`
20-
21-
// OSDisk defines the storage for instance.
22-
OSDisk `json:"osDisk"`
14+
DeprecatedResourcePool string `json:"resourcePool,omitempty"`
2315

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

29-
// OSDisk defines the disk for a virtual machine.
30-
type OSDisk struct {
31-
// DiskSizeGB defines the size of disk in GB.
32-
DiskSizeGB int32 `json:"diskSizeGB"`
21+
// Topology is the vSphere topology that will be used for virtual machines.
22+
// If it is not present, a default value will be used.
23+
// +optional
24+
Topology *vsphere.Topology `json:"topology,omitempty"`
3325
}
26+
27+
type OSDisk = vsphere.OSDisk

apis/hive/v1/vsphere/platform.go

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,24 @@
11
package vsphere
22

33
import (
4+
"fmt"
5+
"strings"
6+
7+
"github.com/go-logr/logr"
8+
"github.com/openshift/installer/pkg/types/vsphere"
49
corev1 "k8s.io/api/core/v1"
510
)
611

712
// Platform stores any global configuration used for vSphere platforms.
813
type Platform struct {
14+
// Infrastructure is the desired state of the vSphere infrastructure provider.
15+
Infrastructure *vsphere.Platform `json:"infrastructure,omitempty"`
16+
917
// VCenter is the domain name or IP address of the vCenter.
10-
VCenter string `json:"vCenter"`
18+
// Deprecated: Please use Platform.Infrastructure instead
19+
// See also: Platform.ConvertDeprecatedFields
20+
// +optional
21+
DeprecatedVCenter string `json:"vCenter,omitempty"`
1122

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

2031
// Datacenter is the name of the datacenter to use in the vCenter.
21-
Datacenter string `json:"datacenter"`
32+
// Deprecated: Please use Platform.Infrastructure instead
33+
// See also: Platform.ConvertDeprecatedFields
34+
// +optional
35+
DeprecatedDatacenter string `json:"datacenter,omitempty"`
2236

2337
// DefaultDatastore is the default datastore to use for provisioning volumes.
24-
DefaultDatastore string `json:"defaultDatastore"`
38+
// Deprecated: Please use Platform.Infrastructure instead
39+
// See also: Platform.ConvertDeprecatedFields
40+
// +optional
41+
DeprecatedDefaultDatastore string `json:"defaultDatastore,omitempty"`
2542

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

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

3356
// Network specifies the name of the network to be used by the cluster.
34-
Network string `json:"network,omitempty"`
57+
// Deprecated: Please use Platform.Infrastructure instead
58+
// See also: Platform.ConvertDeprecatedFields
59+
// +optional
60+
DeprecatedNetwork string `json:"network,omitempty"`
61+
}
62+
63+
func (p *Platform) ConvertDeprecatedFields(logger logr.Logger) {
64+
if p.Infrastructure != nil {
65+
return
66+
}
67+
68+
p.Infrastructure = &vsphere.Platform{
69+
VCenters: []vsphere.VCenter{
70+
{
71+
Server: p.DeprecatedVCenter,
72+
Port: 443,
73+
Datacenters: []string{p.DeprecatedDatacenter},
74+
},
75+
},
76+
FailureDomains: []vsphere.FailureDomain{
77+
{
78+
// names from https://github.com/openshift/installer/blob/f7731922a0f17a8339a3e837f72898ac77643611/pkg/types/vsphere/conversion/installconfig.go#L58-L61
79+
Name: "generated-failure-domain",
80+
Region: "generated-region",
81+
Zone: "generated-zone",
82+
Server: p.DeprecatedVCenter,
83+
Topology: vsphere.Topology{
84+
Datacenter: p.DeprecatedDatacenter,
85+
Datastore: setDatastorePath(p.DeprecatedDefaultDatastore, p.DeprecatedDatacenter, logger),
86+
Folder: setFolderPath(p.DeprecatedFolder, p.DeprecatedDatacenter, logger),
87+
ComputeCluster: setComputeClusterPath(p.DeprecatedCluster, p.DeprecatedDatacenter, logger),
88+
Networks: []string{p.DeprecatedNetwork},
89+
},
90+
},
91+
},
92+
}
93+
94+
}
95+
96+
// Copied (and slightly modified) from https://github.com/openshift/installer/blob/f7731922a0f17a8339a3e837f72898ac77643611/pkg/types/vsphere/conversion/installconfig.go#L75-L97
97+
98+
func setComputeClusterPath(cluster, datacenter string, logger logr.Logger) string {
99+
if cluster != "" && !strings.HasPrefix(cluster, "/") {
100+
logger.V(1).Info(fmt.Sprintf("computeCluster as a non-path is now depreciated please use the form: /%s/host/%s", datacenter, cluster))
101+
return fmt.Sprintf("/%s/host/%s", datacenter, cluster)
102+
}
103+
return cluster
104+
}
105+
106+
func setDatastorePath(datastore, datacenter string, logger logr.Logger) string {
107+
if datastore != "" && !strings.HasPrefix(datastore, "/") {
108+
logger.V(1).Info(fmt.Sprintf("datastore as a non-path is now depreciated please use the form: /%s/datastore/%s", datacenter, datastore))
109+
return fmt.Sprintf("/%s/datastore/%s", datacenter, datastore)
110+
}
111+
return datastore
112+
}
113+
114+
func setFolderPath(folder, datacenter string, logger logr.Logger) string {
115+
if folder != "" && !strings.HasPrefix(folder, "/") {
116+
logger.V(1).Info(fmt.Sprintf("folder as a non-path is now depreciated please use the form: /%s/vm/%s", datacenter, folder))
117+
return fmt.Sprintf("/%s/vm/%s", datacenter, folder)
118+
}
119+
return folder
35120
}

apis/hive/v1/vsphere/zz_generated.deepcopy.go

Lines changed: 17 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/hive/v1/zz_generated.deepcopy.go

Lines changed: 7 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/vendor/github.com/openshift/api/config/v1/register.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)