Skip to content

Commit a11ccdc

Browse files
committed
doc: add context how the migration will work so we will understand in the future why we scale down to 1
fix: ExternalIngress has also to get the anntoation to be set, such that it can execute a migration as expected Signed-off-by: Sandor Szücs <[email protected]>
1 parent 13c98eb commit a11ccdc

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

pkg/core/types.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,20 @@ func (sc *StackContainer) updateStackResources() error {
418418
return nil
419419
}
420420

421+
// updateFromResources updates stack from all the containing
422+
// resources. On cluster migrations we do traffic switching to the
423+
// other cluster, so all the new pods from this stack will not receive
424+
// any traffic. Therefore we can set replicas to 1 and remove hpa
425+
// whatever was configured. Ingress and ExternaIngress will have an
426+
// annotation set that it will send traffic to the other
427+
// cluster. RouteGroup will get a patched backend, such that it does
428+
// the same as ingress.
421429
func (sc *StackContainer) updateFromResources() {
422-
_, clusterMigration := sc.Stack.Annotations[forwardBackendAnnotation]
430+
fwdVal, clusterMigration := sc.Stack.Annotations[forwardBackendAnnotation]
423431

424432
if clusterMigration {
425-
// we do not use these so reduce wasted resources!
433+
sc.Stack.Spec.ExternalIngress.Annotations[forwardBackendAnnotation] = fwdVal
434+
// we do not use these pods so reduce wasted resources!
426435
sc.stackReplicas = 1
427436
} else {
428437
sc.stackReplicas = effectiveReplicas(sc.Stack.Spec.StackSpec.Replicas)
@@ -436,7 +445,7 @@ func (sc *StackContainer) updateFromResources() {
436445
deployment := sc.Resources.Deployment
437446

438447
if clusterMigration {
439-
// we do not use these so reduce wasted resources!
448+
// we do not use these pods so reduce wasted resources!
440449
sc.deploymentReplicas = 1
441450
sc.createdReplicas = 1
442451
sc.readyReplicas = 1
@@ -526,7 +535,7 @@ func (sc *StackContainer) updateFromResources() {
526535

527536
status := sc.Stack.Status
528537
sc.noTrafficSince = unwrapTime(status.NoTrafficSince)
529-
// do not prescale on cluste rmigration to reduce wasted resources
538+
// do not prescale on cluster migration to reduce wasted resources
530539
if status.Prescaling.Active && !clusterMigration {
531540
sc.prescalingActive = true
532541
sc.prescalingReplicas = status.Prescaling.Replicas

0 commit comments

Comments
 (0)