Skip to content

Commit 2bf44bb

Browse files
committed
vSphere - do not block on vSphere >7.0.2, allow 9
This PR changes validation to still allow installations on >7.0.2 and removes the validation for 9. All versions <7.0.2 will fail validation. Fix unit tests to support version checking.
1 parent 1fbf7f2 commit 2bf44bb

File tree

4 files changed

+84
-28
lines changed

4 files changed

+84
-28
lines changed

pkg/asset/installconfig/vsphere/permission_test.go

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

152152
func TestPermissionValidate(t *testing.T) {
153153
ctx := context.TODO()
154-
vs := mock.NewSimulator("", "", 0, 0)
154+
vs := mock.NewSimulator("8.0.2", "8.0.2", 24321653, 23825572)
155155
server, err := vs.StartSimulator()
156156
if err != nil {
157157
t.Error(err)

pkg/asset/installconfig/vsphere/validation.go

Lines changed: 52 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,15 @@ func validateHostGroups(validationCtx *validationContext, cluster, hostGroup str
227227
return append(allErrs, field.NotFound(fldPath, hostGroup))
228228
}
229229

230+
/* Support Scenario Notes
231+
* <7 not supported - validation fail
232+
* <7.0.2 not supported because of CSI drivers - validation fail
233+
* >= 7.0.2 <8 - eol warning only - validation pass
234+
* >=8 - validation pass
235+
* https://knowledge.broadcom.com/external/article/326316/build-numbers-and-versions-of-vmware-vce.html
236+
* https://knowledge.broadcom.com/external/article/314608/correlating-vmware-cloud-foundation-vers.html
237+
*/
238+
230239
const (
231240
eolVSphereVersion int = 7
232241

@@ -239,31 +248,31 @@ const (
239248
// GA build of vCenter 8, there are no constraints with csi.
240249
supportedVCenterBuild int = 20519528
241250
supportedEsxiBuildNumber int = 20513097
251+
252+
vSphereCsiMinimumVersion string = "7.0.2"
242253
)
243254

244-
func getVSphereConstraints() (version.Constraints, version.Constraints, error) {
245-
eolConstraints, err := version.NewConstraint(fmt.Sprintf(">= %d, < %d", eolVSphereVersion, supportedVSphereVersion))
255+
func validateVCenterVersion(validationCtx *validationContext, fldPath *field.Path) field.ErrorList {
256+
allErrs := field.ErrorList{}
257+
258+
// constraints
259+
// CSI version constraint
260+
csiConstraint, err := version.NewConstraint(fmt.Sprintf(">= %d, < %s", eolVSphereVersion, vSphereCsiMinimumVersion))
246261
if err != nil {
247-
return nil, nil, err
262+
allErrs = append(allErrs, field.InternalError(fldPath, err))
248263
}
249264

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))
265+
eolConstraints, err := version.NewConstraint(fmt.Sprintf(">= %d, < %d", eolVSphereVersion, supportedVSphereVersion))
252266
if err != nil {
253-
return nil, nil, err
267+
allErrs = append(allErrs, field.InternalError(fldPath, err))
254268
}
255-
return eolConstraints, supportedConstraints, nil
256-
}
257269

258-
func validateVCenterVersion(validationCtx *validationContext, fldPath *field.Path) field.ErrorList {
259-
allErrs := field.ErrorList{}
260-
261-
eolConstraints, supportedConstraints, err := getVSphereConstraints()
270+
// We support vSphere 8 and VVF/VCF 9
271+
supportedConstraints, err := version.NewConstraint(fmt.Sprintf(">= %d", supportedVSphereVersion))
262272
if err != nil {
263273
allErrs = append(allErrs, field.InternalError(fldPath, err))
264274
}
265275

266-
// Current vCenter version
267276
vCenterVersion, err := version.NewVersion(validationCtx.Client.ServiceContent.About.Version)
268277
if err != nil {
269278
allErrs = append(allErrs, field.InternalError(fldPath, err))
@@ -279,7 +288,13 @@ func validateVCenterVersion(validationCtx *validationContext, fldPath *field.Pat
279288
validationCtx.Client.ServiceContent.About.Version, validationCtx.Client.ServiceContent.About.Build)
280289

281290
switch {
291+
// case: vCenter < 7.0.2
292+
case csiConstraint.Check(vCenterVersion):
293+
// case: < 7.0.2
294+
logrus.Warnf("VMware vSphere 7 is end of service as of 10/2/2025. Current vCenter version: %s, build: %d", vCenterVersion.String(), build)
295+
allErrs = append(allErrs, field.Required(fldPath, detail))
282296
case eolConstraints.Check(vCenterVersion):
297+
// case: >= 7.0.0 < 8.0.0
283298
// While vSphere 7 is EOL we can't block installs because a customer could
284299
// have an extended support and a support exception
285300
logrus.Warnf("VMware vSphere 7 is end of service as of 10/2/2025. Current vCenter version: %s, build: %d", vCenterVersion.String(), build)
@@ -289,13 +304,14 @@ func validateVCenterVersion(validationCtx *validationContext, fldPath *field.Pat
289304
allErrs = append(allErrs, field.Required(fldPath, detail))
290305
}
291306
case supportedConstraints.Check(vCenterVersion):
307+
// case: >= 8.0.0
292308
// This is currently set to the GA build number, all of vSphere 8 is supported
293309
if build < supportedVCenterBuild {
294310
allErrs = append(allErrs, field.Required(fldPath, detail))
295311
}
296-
// This covers prior to 7 and VCF 9 which is currently not tested
297312
default:
298-
detail = fmt.Sprintf("Unsupported or untested version of vSphere. Current vCenter version: %s, build: %s",
313+
// case: < 7.0.0
314+
detail = fmt.Sprintf("Unsupported version of vSphere. Current vCenter version: %s, build: %s",
299315
validationCtx.Client.ServiceContent.About.Version, validationCtx.Client.ServiceContent.About.Build)
300316
allErrs = append(allErrs, field.Required(fldPath, detail))
301317
}
@@ -310,7 +326,18 @@ func validateESXiVersion(validationCtx *validationContext, clusterPath string, v
310326
ctx, cancel := context.WithTimeout(context.TODO(), 60*time.Second)
311327
defer cancel()
312328

313-
eolConstraints, supportedConstraints, err := getVSphereConstraints()
329+
csiConstraint, err := version.NewConstraint(fmt.Sprintf(">= %d, < %s", eolVSphereVersion, vSphereCsiMinimumVersion))
330+
if err != nil {
331+
allErrs = append(allErrs, field.InternalError(vSphereFldPath, err))
332+
}
333+
334+
eolConstraints, err := version.NewConstraint(fmt.Sprintf(">= %d, < %d", eolVSphereVersion, supportedVSphereVersion))
335+
if err != nil {
336+
allErrs = append(allErrs, field.InternalError(vSphereFldPath, err))
337+
}
338+
339+
// We support vSphere 8 and VVF/VCF 9
340+
supportedConstraints, err := version.NewConstraint(fmt.Sprintf(">= %d", supportedVSphereVersion))
314341
if err != nil {
315342
allErrs = append(allErrs, field.InternalError(vSphereFldPath, err))
316343
}
@@ -371,24 +398,28 @@ func validateESXiVersion(validationCtx *validationContext, clusterPath string, v
371398
}
372399

373400
switch {
401+
// case: vCenter < 7.0.2
402+
case csiConstraint.Check(esxiHostVersion):
403+
// case: < 7.0.2
404+
logrus.Warnf("VMware vSphere 7 is end of service as of 10/2/2025. The ESXi host: %s is version: %s and build: %s",
405+
h.Name(), mh.Config.Product.Version, mh.Config.Product.Build)
406+
allErrs = append(allErrs, field.Required(vSphereFldPath, detail))
374407
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
377408
logrus.Warnf("VMware vSphere 7 is end of service as of 10/2/2025. The ESXi host: %s is version: %s and build: %s",
378409
h.Name(), mh.Config.Product.Version, mh.Config.Product.Build)
379-
380410
// Still running vSphere 7 but wrong build to use CSI driver
381411
if build < minimumEsxiBuildNumber {
382412
allErrs = append(allErrs, field.Required(vSphereFldPath, detail))
383413
}
384414
case supportedConstraints.Check(esxiHostVersion):
415+
// case: >= 8.0.0
385416
// This is currently set to the GA build number, all of vSphere 8 is supported
386417
if build < supportedEsxiBuildNumber {
387418
allErrs = append(allErrs, field.Required(vSphereFldPath, detail))
388419
}
389-
// This covers prior to 7 and VCF 9 which is currently not tested
390420
default:
391-
detail = fmt.Sprintf("Unsupported or untested version of vSphere. The ESXi host: %s is version: %s and build: %s",
421+
// case: < 7.0.0
422+
detail = fmt.Sprintf("Unsupported version of vSphere. The ESXi host: %s is version: %s and build: %s",
392423
h.Name(), mh.Config.Product.Version, mh.Config.Product.Build)
393424
allErrs = append(allErrs, field.Required(vSphereFldPath, detail))
394425
}

pkg/asset/installconfig/vsphere/validation_test.go

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ func simulatorHelper(t *testing.T, vs *mock.VSphereSimulator) (*validationContex
224224
t.Helper()
225225

226226
if vs == nil {
227-
vs = mock.NewSimulator("", "", 0, 0)
227+
vs = mock.NewSimulator("8.0.2", "8.0.2", 24321653, 23825572)
228228
}
229229
server, err := vs.StartSimulator()
230230
if err != nil {
@@ -541,7 +541,7 @@ func Test_validateVCenterVersion(t *testing.T) {
541541
expectErr: ``,
542542
},
543543
{
544-
name: "vcf 9 is not supported",
544+
name: "vcf 9 is supported",
545545
VSphereSimulator: &mock.VSphereSimulator{
546546
VCenterVersion: "9.0.0",
547547
VCenterBuild: 24755230,
@@ -551,7 +551,7 @@ func Test_validateVCenterVersion(t *testing.T) {
551551
EsxiBuild: 24859861,
552552
},
553553
fldPath: field.NewPath("platform").Child("vsphere").Child("vcenters"),
554-
expectErr: `platform.vsphere.vcenters: Required value: Unsupported or untested version of vSphere. Current vCenter version: 9.0.0, build: 24755230`,
554+
expectErr: ``,
555555
},
556556
{
557557
name: "vsphere 7 eol but csi support",
@@ -566,6 +566,19 @@ func Test_validateVCenterVersion(t *testing.T) {
566566
fldPath: field.NewPath("platform").Child("vsphere").Child("vcenters"),
567567
expectErr: ``,
568568
},
569+
{
570+
name: "vsphere 7 eol but no csi support",
571+
VSphereSimulator: &mock.VSphereSimulator{
572+
VCenterVersion: "7.0.1",
573+
// vCenter Server 7.0 Update 1d
574+
VCenterBuild: 17491160,
575+
EsxiVersion: "7.0.1",
576+
// ESXi 7.0.2 EP2
577+
EsxiBuild: 18538813,
578+
},
579+
fldPath: field.NewPath("platform").Child("vsphere").Child("vcenters"),
580+
expectErr: `platform.vsphere.vcenters: Required value: The vSphere storage driver requires a minimum of vSphere 7 Update 2. Current vCenter version: 7.0.1, build: 17491160`,
581+
},
569582
{
570583
name: "vsphere 6 eol",
571584
VSphereSimulator: &mock.VSphereSimulator{
@@ -577,7 +590,7 @@ func Test_validateVCenterVersion(t *testing.T) {
577590
EsxiBuild: 20497097,
578591
},
579592
fldPath: field.NewPath("platform").Child("vsphere").Child("vcenters"),
580-
expectErr: `platform.vsphere.vcenters: Required value: Unsupported or untested version of vSphere. Current vCenter version: 6.7, build: 24337536`,
593+
expectErr: `platform.vsphere.vcenters: Required value: Unsupported version of vSphere. Current vCenter version: 6.7, build: 24337536`,
581594
},
582595
}
583596

@@ -649,6 +662,19 @@ func Test_validateESXiVersion(t *testing.T) {
649662
computeClusterPath: platform.FailureDomains[0].Topology.ComputeCluster,
650663
expectErr: ``,
651664
},
665+
{
666+
name: "vsphere 7 eol but no csi support",
667+
VSphereSimulator: &mock.VSphereSimulator{
668+
VCenterVersion: "7.0.2",
669+
// vCenter Server 7.0 Update 2a
670+
VCenterBuild: 17920168,
671+
EsxiVersion: "7.0.1",
672+
// ESXi 7.0.2 EP2
673+
EsxiBuild: 16850804,
674+
},
675+
computeClusterPath: platform.FailureDomains[0].Topology.ComputeCluster,
676+
expectErr: `[platform.vsphere: Required value: The vSphere storage driver requires a minimum of vSphere 7 Update 2. The ESXi host: DC0_C0_H0 is version: 7.0.1 and build: 16850804, platform.vsphere: Required value: The vSphere storage driver requires a minimum of vSphere 7 Update 2. The ESXi host: DC0_C0_H1 is version: 7.0.1 and build: 16850804, platform.vsphere: Required value: The vSphere storage driver requires a minimum of vSphere 7 Update 2. The ESXi host: DC0_C0_H2 is version: 7.0.1 and build: 16850804, platform.vsphere: Required value: The vSphere storage driver requires a minimum of vSphere 7 Update 2. The ESXi host: DC0_C0_H3 is version: 7.0.1 and build: 16850804, platform.vsphere: Required value: The vSphere storage driver requires a minimum of vSphere 7 Update 2. The ESXi host: DC0_C0_H4 is version: 7.0.1 and build: 16850804, platform.vsphere: Required value: The vSphere storage driver requires a minimum of vSphere 7 Update 2. The ESXi host: DC0_C0_H5 is version: 7.0.1 and build: 16850804]`,
677+
},
652678
{
653679
name: "computeCluster not found",
654680
VSphereSimulator: &mock.VSphereSimulator{

pkg/types/vsphere/conversion/installconfig_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -380,8 +380,7 @@ func validIpiInstallConfig() *types.InstallConfig {
380380

381381
func TestConvertInstallConfig(t *testing.T) {
382382
logger, hook := test.NewNullLogger()
383-
384-
vs := mock.NewSimulator("", "", 0, 0)
383+
vs := mock.NewSimulator("8.0.2", "8.0.2", 24321653, 23825572)
385384
sim, err := vs.StartSimulator()
386385

387386
if err != nil {

0 commit comments

Comments
 (0)