Skip to content

Commit 883cadf

Browse files
Merge pull request #9914 from jcpowermac/vsphere7-eol
SPLAT-2430: Update vSphere version validations for 7 EOL and VCF 9
2 parents fdd2095 + db98975 commit 883cadf

Some content is hidden

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

59 files changed

+1272
-1300
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ require (
115115
github.com/thoas/go-funk v0.9.3
116116
github.com/ulikunitz/xz v0.5.12
117117
github.com/vincent-petithory/dataurl v1.0.0
118-
github.com/vmware/govmomi v0.47.1
118+
github.com/vmware/govmomi v0.49.0
119119
go.uber.org/mock v0.5.0
120120
golang.org/x/crypto v0.38.0
121121
golang.org/x/oauth2 v0.28.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -950,8 +950,8 @@ github.com/vincent-petithory/dataurl v1.0.0/go.mod h1:FHafX5vmDzyP+1CQATJn7WFKc9
950950
github.com/vmihailenco/msgpack v3.3.3+incompatible/go.mod h1:fy3FlTQTDXWkZ7Bh6AcGMlsjHatGryHQYUTf1ShIgkk=
951951
github.com/vmihailenco/msgpack/v4 v4.3.12/go.mod h1:gborTTJjAo/GWTqqRjrLCn9pgNN+NXzzngzBKDPIqw4=
952952
github.com/vmihailenco/tagparser v0.1.1/go.mod h1:OeAg3pn3UbLjkWt+rN9oFYB6u/cQgqMEUPoW2WPyhdI=
953-
github.com/vmware/govmomi v0.47.1 h1:6a2iNaqSS2/AFfvI8UMe0l787/TBKkK0KK9jCqCyYCE=
954-
github.com/vmware/govmomi v0.47.1/go.mod h1:bYwUHpGpisE4AOlDl5eph90T+cjJMIcKx/kaa5v5rQM=
953+
github.com/vmware/govmomi v0.49.0 h1:M80ExmFq3kOfeMvMJcHnXgA/4w5hUAFfYfc+Qm3lmPg=
954+
github.com/vmware/govmomi v0.49.0/go.mod h1:+oZ0tYJw/pXKoeWHLR9Egq5KENVr2hLePRzisFhEWpA=
955955
github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM=
956956
github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg=
957957
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=

pkg/asset/installconfig/vsphere/mock/vsphere_sim.go

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,47 @@ import (
2222
_ "github.com/vmware/govmomi/vapi/simulator"
2323
)
2424

25-
const (
26-
esxi7U2BuildNumber int = 17630552
27-
esxi7U2Version string = "7.0.2"
28-
vcenter7U2BuildNumber int = 17694817
29-
vcenter7U2Version string = "7.0.2"
30-
)
25+
// VSphereSimulator contains the vSphere versioning that will be used in the simulator.
26+
type VSphereSimulator struct {
27+
VCenterVersion string
28+
VCenterBuild int
29+
EsxiVersion string
30+
EsxiBuild int
31+
}
32+
33+
// NewSimulator creates a new VSphereSimulator, if versions are empty or 0 default values are used.
34+
func NewSimulator(vcenterVersion, esxiVersion string, vcenterBuild, esxiBuild int) *VSphereSimulator {
35+
vss := &VSphereSimulator{
36+
VCenterVersion: vcenterVersion,
37+
VCenterBuild: vcenterBuild,
38+
EsxiVersion: esxiVersion,
39+
EsxiBuild: esxiBuild,
40+
}
41+
42+
if vss.VCenterVersion == "" || vss.EsxiVersion == "" {
43+
return &VSphereSimulator{
44+
VCenterVersion: "8.0.0",
45+
VCenterBuild: 20519528,
46+
EsxiVersion: "8.0.0",
47+
EsxiBuild: 20513097,
48+
}
49+
}
50+
return vss
51+
}
3152

3253
// StartSimulator starts an instance of the simulator which listens on 127.0.0.1.
3354
// Call GetClient to retrieve a vim25.client which will connect to and trust this
3455
// simulator
35-
func StartSimulator(setVersionToSupported bool) (*simulator.Server, error) {
56+
func (vss *VSphereSimulator) StartSimulator() (*simulator.Server, error) {
3657
model := simulator.VPX()
3758

3859
// Change the simulated vCenter and ESXi hosts
3960
// to the version and build we support.
40-
if setVersionToSupported {
41-
esx.HostSystem.Config.Product.Build = strconv.Itoa(esxi7U2BuildNumber)
42-
esx.HostSystem.Config.Product.Version = esxi7U2Version
43-
model.ServiceContent.About.Build = strconv.Itoa(vcenter7U2BuildNumber)
44-
model.ServiceContent.About.Version = vcenter7U2Version
45-
}
61+
62+
esx.HostSystem.Config.Product.Build = strconv.Itoa(vss.EsxiBuild)
63+
esx.HostSystem.Config.Product.Version = vss.EsxiVersion
64+
model.ServiceContent.About.Build = strconv.Itoa(vss.VCenterBuild)
65+
model.ServiceContent.About.Version = vss.VCenterVersion
4666

4767
model.ClusterHost = 6
4868
model.Folder = 1

pkg/asset/installconfig/vsphere/permission_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,8 @@ func validIPIMultiZoneInstallConfig() *types.InstallConfig {
151151

152152
func TestPermissionValidate(t *testing.T) {
153153
ctx := context.TODO()
154-
server, err := mock.StartSimulator(true)
154+
vs := mock.NewSimulator("", "", 0, 0)
155+
server, err := vs.StartSimulator()
155156
if err != nil {
156157
t.Error(err)
157158
return

pkg/asset/installconfig/vsphere/validation.go

Lines changed: 80 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,6 @@ type TagManager interface {
3838
GetAttachedTagsOnObjects(ctx context.Context, objectID []mo.Reference) ([]vapitags.AttachedTags, error)
3939
}
4040

41-
const (
42-
esxi7U2BuildNumber int = 17630552
43-
vcenter7U2BuildNumber int = 17694817
44-
vcenter7U2Version string = "7.0.2"
45-
)
46-
4741
var localLogger = logrus.New()
4842

4943
type validationContext struct {
@@ -233,18 +227,49 @@ func validateHostGroups(validationCtx *validationContext, cluster, hostGroup str
233227
return append(allErrs, field.NotFound(fldPath, hostGroup))
234228
}
235229

230+
const (
231+
eolVSphereVersion int = 7
232+
233+
// csi driver requirement.
234+
minimumVCenterBuild int = 17694817
235+
minimumEsxiBuildNumber int = 17630552
236+
237+
supportedVSphereVersion int = 8
238+
239+
// GA build of vCenter 8, there are no constraints with csi.
240+
supportedVCenterBuild int = 20519528
241+
supportedEsxiBuildNumber int = 20513097
242+
)
243+
244+
func getVSphereConstraints() (version.Constraints, version.Constraints, error) {
245+
eolConstraints, err := version.NewConstraint(fmt.Sprintf(">= %d, < %d", eolVSphereVersion, supportedVSphereVersion))
246+
if err != nil {
247+
return nil, nil, err
248+
}
249+
250+
// We support vSphere 8 only, so >= 8 (covers semver minor and patch)
251+
supportedConstraints, err := version.NewConstraint(fmt.Sprintf(">= %d, < %d", supportedVSphereVersion, supportedVSphereVersion+1))
252+
if err != nil {
253+
return nil, nil, err
254+
}
255+
return eolConstraints, supportedConstraints, nil
256+
}
257+
236258
func validateVCenterVersion(validationCtx *validationContext, fldPath *field.Path) field.ErrorList {
237259
allErrs := field.ErrorList{}
238260

239-
constraints, err := version.NewConstraint(fmt.Sprintf("< %s", vcenter7U2Version))
261+
eolConstraints, supportedConstraints, err := getVSphereConstraints()
240262
if err != nil {
241263
allErrs = append(allErrs, field.InternalError(fldPath, err))
242264
}
243265

266+
// Current vCenter version
244267
vCenterVersion, err := version.NewVersion(validationCtx.Client.ServiceContent.About.Version)
245268
if err != nil {
246269
allErrs = append(allErrs, field.InternalError(fldPath, err))
247270
}
271+
272+
// Current vCenter Build number
248273
build, err := strconv.Atoi(validationCtx.Client.ServiceContent.About.Build)
249274
if err != nil {
250275
allErrs = append(allErrs, field.InternalError(fldPath, err))
@@ -253,9 +278,25 @@ func validateVCenterVersion(validationCtx *validationContext, fldPath *field.Pat
253278
detail := fmt.Sprintf("The vSphere storage driver requires a minimum of vSphere 7 Update 2. Current vCenter version: %s, build: %s",
254279
validationCtx.Client.ServiceContent.About.Version, validationCtx.Client.ServiceContent.About.Build)
255280

256-
if constraints.Check(vCenterVersion) {
257-
allErrs = append(allErrs, field.Required(fldPath, detail))
258-
} else if build < vcenter7U2BuildNumber {
281+
switch {
282+
case eolConstraints.Check(vCenterVersion):
283+
// While vSphere 7 is EOL we can't block installs because a customer could
284+
// have an extended support and a support exception
285+
logrus.Warnf("VMware vSphere 7 is end of service as of 10/2/2025. Current vCenter version: %s, build: %d", vCenterVersion.String(), build)
286+
287+
// Still running vSphere 7 but wrong build to use CSI driver
288+
if build < minimumVCenterBuild {
289+
allErrs = append(allErrs, field.Required(fldPath, detail))
290+
}
291+
case supportedConstraints.Check(vCenterVersion):
292+
// This is currently set to the GA build number, all of vSphere 8 is supported
293+
if build < supportedVCenterBuild {
294+
allErrs = append(allErrs, field.Required(fldPath, detail))
295+
}
296+
// This covers prior to 7 and VCF 9 which is currently not tested
297+
default:
298+
detail = fmt.Sprintf("Unsupported or untested version of vSphere. Current vCenter version: %s, build: %s",
299+
validationCtx.Client.ServiceContent.About.Version, validationCtx.Client.ServiceContent.About.Build)
259300
allErrs = append(allErrs, field.Required(fldPath, detail))
260301
}
261302

@@ -269,6 +310,11 @@ func validateESXiVersion(validationCtx *validationContext, clusterPath string, v
269310
ctx, cancel := context.WithTimeout(context.TODO(), 60*time.Second)
270311
defer cancel()
271312

313+
eolConstraints, supportedConstraints, err := getVSphereConstraints()
314+
if err != nil {
315+
allErrs = append(allErrs, field.InternalError(vSphereFldPath, err))
316+
}
317+
272318
clusters, err := finder.ClusterComputeResourceList(ctx, clusterPath)
273319

274320
if err != nil {
@@ -289,11 +335,6 @@ func validateESXiVersion(validationCtx *validationContext, clusterPath string, v
289335
}
290336
}
291337

292-
v7, err := version.NewVersion("7.0")
293-
if err != nil {
294-
return append(allErrs, field.InternalError(vSphereFldPath, err))
295-
}
296-
297338
hosts, err := clusters[0].Hosts(context.TODO())
298339
if err != nil {
299340
err = errors.Wrapf(err, "unable to find hosts from cluster on path: %s", clusterPath)
@@ -324,16 +365,32 @@ func validateESXiVersion(validationCtx *validationContext, clusterPath string, v
324365
detail := fmt.Sprintf("The vSphere storage driver requires a minimum of vSphere 7 Update 2. The ESXi host: %s is version: %s and build: %s",
325366
h.Name(), mh.Config.Product.Version, mh.Config.Product.Build)
326367

327-
if esxiHostVersion.LessThan(v7) {
328-
allErrs = append(allErrs, field.Required(computeClusterFldPath, detail))
329-
} else {
330-
build, err := strconv.Atoi(mh.Config.Product.Build)
331-
if err != nil {
332-
return append(allErrs, field.InternalError(vSphereFldPath, err))
368+
build, err := strconv.Atoi(mh.Config.Product.Build)
369+
if err != nil {
370+
return append(allErrs, field.InternalError(vSphereFldPath, err))
371+
}
372+
373+
switch {
374+
case eolConstraints.Check(esxiHostVersion):
375+
// While vSphere 7 is EOL we can't block installs because a customer could
376+
// have an extended support and a support exception
377+
logrus.Warnf("VMware vSphere 7 is end of service as of 10/2/2025. The ESXi host: %s is version: %s and build: %s",
378+
h.Name(), mh.Config.Product.Version, mh.Config.Product.Build)
379+
380+
// Still running vSphere 7 but wrong build to use CSI driver
381+
if build < minimumEsxiBuildNumber {
382+
allErrs = append(allErrs, field.Required(vSphereFldPath, detail))
333383
}
334-
if build < esxi7U2BuildNumber {
335-
allErrs = append(allErrs, field.Required(computeClusterFldPath, detail))
384+
case supportedConstraints.Check(esxiHostVersion):
385+
// This is currently set to the GA build number, all of vSphere 8 is supported
386+
if build < supportedEsxiBuildNumber {
387+
allErrs = append(allErrs, field.Required(vSphereFldPath, detail))
336388
}
389+
// This covers prior to 7 and VCF 9 which is currently not tested
390+
default:
391+
detail = fmt.Sprintf("Unsupported or untested version of vSphere. The ESXi host: %s is version: %s and build: %s",
392+
h.Name(), mh.Config.Product.Version, mh.Config.Product.Build)
393+
allErrs = append(allErrs, field.Required(vSphereFldPath, detail))
337394
}
338395
}
339396
return allErrs

0 commit comments

Comments
 (0)