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