@@ -358,141 +358,6 @@ var _ = Describe("Shoot Validation Tests", func() {
358358 ))
359359 })
360360
361- Context ("#ValidateShootHAControlPlaneUpdate" , func () {
362- It ("should pass as Shoot ControlPlane Spec with HA set to zone has not changed" , func () {
363- shoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeZone }}}
364- newShoot := prepareShootForUpdate (shoot )
365- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
366- Expect (errorList ).To (BeEmpty ())
367- })
368-
369- It ("should pass as non-HA Shoot ControlPlane Spec has not changed" , func () {
370- newShoot := prepareShootForUpdate (shoot )
371- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
372- Expect (errorList ).To (BeEmpty ())
373- })
374-
375- It ("should allow upgrading from non-HA to HA Shoot ControlPlane.HighAvailability Spec" , func () {
376- shoot .Spec .ControlPlane = & core.ControlPlane {}
377- newShoot := prepareShootForUpdate (shoot )
378- newShoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeZone }}}
379- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
380- Expect (errorList ).To (BeEmpty ())
381- })
382-
383- Context ("shoot is scheduled" , func () {
384- BeforeEach (func () {
385- shoot .Spec .SeedName = ptr .To ("someSeed" )
386- })
387-
388- It ("should forbid to change the Shoot ControlPlane spec" , func () {
389- shoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeZone }}}
390- newShoot := prepareShootForUpdate (shoot )
391- newShoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeNode }}}
392-
393- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
394- Expect (errorList ).To (ConsistOf (
395- PointTo (MatchFields (IgnoreExtras , Fields {
396- "Type" : Equal (field .ErrorTypeInvalid ),
397- "BadValue" : Equal (core .FailureToleranceTypeNode ),
398- "Field" : Equal ("spec.controlPlane.highAvailability.failureTolerance.type" ),
399- })),
400- ))
401- })
402-
403- It ("should forbid to unset of Shoot ControlPlane" , func () {
404- shoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeZone }}}
405- newShoot := prepareShootForUpdate (shoot )
406- newShoot .Spec .ControlPlane = nil
407-
408- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
409-
410- Expect (errorList ).To (ConsistOf (
411- PointTo (MatchFields (IgnoreExtras , Fields {
412- "Type" : Equal (field .ErrorTypeInvalid ),
413- "Field" : Equal ("spec.controlPlane.highAvailability.failureTolerance.type" ),
414- })),
415- ))
416- })
417- })
418-
419- Context ("shoot is not scheduled" , func () {
420- It ("should allow to change the Shoot ControlPlane spec" , func () {
421- shoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeZone }}}
422- newShoot := prepareShootForUpdate (shoot )
423- newShoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeNode }}}
424-
425- Expect (ValidateShootHAConfigUpdate (newShoot , shoot )).To (BeEmpty ())
426- })
427-
428- It ("should allow to unset of Shoot ControlPlane" , func () {
429- shoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeZone }}}
430- newShoot := prepareShootForUpdate (shoot )
431- newShoot .Spec .ControlPlane = nil
432-
433- Expect (ValidateShootHAConfigUpdate (newShoot , shoot )).To (BeEmpty ())
434- })
435- })
436-
437- Context ("shoot is hibernated" , func () {
438- It ("should not allow upgrading from non-HA to HA when Spec.Hibernation.Enabled is set to `true`" , func () {
439- shoot .Spec .ControlPlane = & core.ControlPlane {}
440- newShoot := prepareShootForUpdate (shoot )
441- newShoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeZone }}}
442- newShoot .Spec .Hibernation = & core.Hibernation {Enabled : ptr .To (true )}
443- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
444- Expect (errorList ).To (ConsistOf (
445- PointTo (MatchFields (IgnoreExtras , Fields {
446- "Type" : Equal (field .ErrorTypeForbidden ),
447- "Field" : Equal ("spec.controlPlane.highAvailability.failureTolerance.type" ),
448- "Detail" : Equal ("Shoot is currently hibernated and cannot be scaled up to HA. Please make sure your cluster has woken up before scaling it up to HA" ),
449- })),
450- ))
451- })
452-
453- It ("should not allow upgrading from non-HA to HA when Status.IsHibernation is set to `true`" , func () {
454- shoot .Spec .ControlPlane = & core.ControlPlane {}
455- newShoot := prepareShootForUpdate (shoot )
456- newShoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeNode }}}
457- newShoot .Status .IsHibernated = true
458- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
459- Expect (errorList ).To (ConsistOf (
460- PointTo (MatchFields (IgnoreExtras , Fields {
461- "Type" : Equal (field .ErrorTypeForbidden ),
462- "Field" : Equal ("spec.controlPlane.highAvailability.failureTolerance.type" ),
463- "Detail" : Equal ("Shoot is currently hibernated and cannot be scaled up to HA. Please make sure your cluster has woken up before scaling it up to HA" ),
464- })),
465- ))
466- })
467-
468- It ("should not allow upgrading from non-HA to HA when Spec.Hibernation.Enabled is set to `false` and Status.IsHibernation is set to `true`" , func () {
469- shoot .Spec .ControlPlane = & core.ControlPlane {}
470- newShoot := prepareShootForUpdate (shoot )
471- newShoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeNode }}}
472- newShoot .Spec .Hibernation = & core.Hibernation {Enabled : ptr .To (false )}
473- newShoot .Status .IsHibernated = true
474- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
475- Expect (errorList ).To (ConsistOf (
476- PointTo (MatchFields (IgnoreExtras , Fields {
477- "Type" : Equal (field .ErrorTypeForbidden ),
478- "Field" : Equal ("spec.controlPlane.highAvailability.failureTolerance.type" ),
479- "Detail" : Equal ("Shoot is currently hibernated and cannot be scaled up to HA. Please make sure your cluster has woken up before scaling it up to HA" ),
480- })),
481- ))
482- })
483-
484- It ("should allow upgrading from non-HA to HA when Spec.Hibernation.Enabled is set to `false` and Status.IsHibernation is set to `false`" , func () {
485- shoot .Spec .ControlPlane = & core.ControlPlane {}
486- newShoot := prepareShootForUpdate (shoot )
487- newShoot .Spec .ControlPlane = & core.ControlPlane {HighAvailability : & core.HighAvailability {FailureTolerance : core.FailureTolerance {Type : core .FailureToleranceTypeNode }}}
488- newShoot .Spec .Hibernation = & core.Hibernation {Enabled : ptr .To (false )}
489- newShoot .Status .IsHibernated = false
490- errorList := ValidateShootHAConfigUpdate (newShoot , shoot )
491- Expect (errorList ).To (BeEmpty ())
492- })
493- })
494- })
495-
496361 Context ("#ValidateShootHAConfig" , func () {
497362 It ("should forbid to set unsupported failure tolerance type" , func () {
498363 shoot .Spec .ControlPlane = & core.ControlPlane {}
0 commit comments