@@ -427,15 +427,7 @@ func (sc *StackContainer) updateStackResources() error {
427427// cluster. RouteGroup will get a patched backend, such that it does
428428// the same as ingress.
429429func (sc * StackContainer ) updateFromResources () {
430- fwdVal , clusterMigration := sc .Stack .Annotations [forwardBackendAnnotation ]
431-
432- if clusterMigration {
433- sc .Stack .Spec .ExternalIngress .Annotations [forwardBackendAnnotation ] = fwdVal
434- // we do not use these pods so reduce wasted resources!
435- sc .stackReplicas = 1
436- } else {
437- sc .stackReplicas = effectiveReplicas (sc .Stack .Spec .StackSpec .Replicas )
438- }
430+ sc .stackReplicas = effectiveReplicas (sc .Stack .Spec .StackSpec .Replicas )
439431
440432 var deploymentUpdated , serviceUpdated , ingressUpdated , routeGroupUpdated , hpaUpdated bool
441433 var ingressSegmentUpdated , routeGroupSegmentUpdated bool
@@ -444,18 +436,11 @@ func (sc *StackContainer) updateFromResources() {
444436 if sc .Resources .Deployment != nil {
445437 deployment := sc .Resources .Deployment
446438
447- if clusterMigration {
448- // we do not use these pods so reduce wasted resources!
449- sc .deploymentReplicas = 1
450- sc .createdReplicas = 1
451- sc .readyReplicas = 1
452- sc .updatedReplicas = 1
453- } else {
454- sc .deploymentReplicas = effectiveReplicas (deployment .Spec .Replicas )
455- sc .createdReplicas = deployment .Status .Replicas
456- sc .readyReplicas = deployment .Status .ReadyReplicas
457- sc .updatedReplicas = deployment .Status .UpdatedReplicas
458- }
439+ sc .deploymentReplicas = effectiveReplicas (deployment .Spec .Replicas )
440+ sc .createdReplicas = deployment .Status .Replicas
441+ sc .readyReplicas = deployment .Status .ReadyReplicas
442+ sc .updatedReplicas = deployment .Status .UpdatedReplicas
443+
459444 deploymentUpdated = IsResourceUpToDate (sc .Stack , sc .Resources .Deployment .ObjectMeta ) && deployment .Status .ObservedGeneration == deployment .Generation
460445 }
461446
@@ -467,18 +452,12 @@ func (sc *StackContainer) updateFromResources() {
467452 // the per-stack ingress must either be present and up-to-date, or not present and not expected.
468453 // the per-stack ingress is not expected if the stack has no hostnames matching the cluster domain.
469454 if sc .Resources .Ingress != nil {
470- if clusterMigration {
471- sc .Resources .Ingress .Annotations ["zalando.org/skipper-backend" ] = "forward"
472- }
473455 ingressUpdated = IsResourceUpToDate (sc .Stack , sc .Resources .Ingress .ObjectMeta )
474456 } else {
475457 hostnames := sc .stackHostnames (sc .ingressSpec , false )
476458 ingressUpdated = len (hostnames ) == 0
477459 }
478460 if sc .Resources .IngressSegment != nil {
479- if clusterMigration {
480- sc .Resources .IngressSegment .Annotations ["zalando.org/skipper-backend" ] = "forward"
481- }
482461 ingressSegmentUpdated = IsResourceUpToDate (sc .Stack , sc .Resources .IngressSegment .ObjectMeta )
483462 }
484463 } else {
@@ -492,20 +471,13 @@ func (sc *StackContainer) updateFromResources() {
492471 // the per-stack route group must either be present and up-to-date, or not present and not expected.
493472 // the per-stack route group is not expected if the stack has no hostnames matching the cluster domain.
494473 if sc .Resources .RouteGroup != nil {
495- if clusterMigration {
496- patchForwardBackend (& sc .Resources .RouteGroup .Spec )
497- }
498474 routeGroupUpdated = IsResourceUpToDate (sc .Stack , sc .Resources .RouteGroup .ObjectMeta )
499475 } else {
500476 hostnames := sc .stackHostnames (sc .routeGroupSpec , false )
501477 routeGroupUpdated = len (hostnames ) == 0
502478 }
503479
504480 if sc .Resources .RouteGroupSegment != nil {
505- if clusterMigration {
506- patchForwardBackend (& sc .Resources .RouteGroupSegment .Spec )
507- }
508-
509481 routeGroupSegmentUpdated = IsResourceUpToDate (
510482 sc .Stack ,
511483 sc .Resources .RouteGroupSegment .ObjectMeta ,
@@ -518,10 +490,8 @@ func (sc *StackContainer) updateFromResources() {
518490 }
519491
520492 // hpa not used if we migrate cluster to reduce wasted resources
521- if sc .IsAutoscaled () && ! clusterMigration {
493+ if sc .IsAutoscaled () {
522494 hpaUpdated = sc .Resources .HPA != nil && IsResourceUpToDate (sc .Stack , sc .Resources .HPA .ObjectMeta )
523- } else {
524- hpaUpdated = sc .Resources .HPA == nil
525495 }
526496
527497 // aggregated 'resources updated' for the readiness
@@ -535,27 +505,11 @@ func (sc *StackContainer) updateFromResources() {
535505
536506 status := sc .Stack .Status
537507 sc .noTrafficSince = unwrapTime (status .NoTrafficSince )
538- // do not prescale on cluster migration to reduce wasted resources
539- if status .Prescaling .Active && ! clusterMigration {
508+
509+ if status .Prescaling .Active {
540510 sc .prescalingActive = true
541511 sc .prescalingReplicas = status .Prescaling .Replicas
542512 sc .prescalingDesiredTrafficWeight = status .Prescaling .DesiredTrafficWeight
543513 sc .prescalingLastTrafficIncrease = unwrapTime (status .Prescaling .LastTrafficIncrease )
544514 }
545515}
546-
547- func patchForwardBackend (rg * rgv1.RouteGroupSpec ) {
548- rg .Backends = []rgv1.RouteGroupBackend {
549- {
550- Name : forwardBackendName ,
551- Type : rgv1 .ForwardRouteGroupBackend ,
552- },
553- }
554- for _ , route := range rg .Routes {
555- route .Backends = []rgv1.RouteGroupBackendReference {
556- {
557- BackendName : forwardBackendName ,
558- },
559- }
560- }
561- }
0 commit comments