@@ -147,6 +147,10 @@ func (r *RealSyncControl) SyncTargets(ctx context.Context, instance api.XSetObje
147147 syncContext .FilteredTarget = filteredTargets
148148 }
149149
150+ if instance .GetDeletionTimestamp () != nil {
151+ return false , nil
152+ }
153+
150154 // sync subresource
151155 // 1. list pvcs using ownerReference
152156 // 2. adopt and retain orphaned pvcs according to PVC retention policy
@@ -904,10 +908,9 @@ func (r *RealSyncControl) CalculateStatus(_ context.Context, instance api.XSetOb
904908
905909 var readyReplicas , scheduledReplicas , replicas , terminatingReplicas , updatedReplicas , operatingReplicas , updatedReadyReplicas , availableReplicas , updatedAvailableReplicas int32
906910
907- activeTargets := FilterOutActiveTargetWrappers (syncContext .TargetWrappers )
908- for _ , targetWrapper := range activeTargets {
911+ for _ , target := range syncContext .FilteredTarget {
909912 // for naming with persistent sequences suffix, terminating targets can be shown in status
910- if targetWrapper .GetDeletionTimestamp () != nil {
913+ if target .GetDeletionTimestamp () != nil {
911914 terminatingReplicas ++
912915 if ! IsTargetNamingSuffixPolicyPersistentSequence (r .xsetController .GetXSetSpec (instance )) {
913916 continue
@@ -917,30 +920,30 @@ func (r *RealSyncControl) CalculateStatus(_ context.Context, instance api.XSetOb
917920 replicas ++
918921
919922 isUpdated := false
920- if isUpdated = IsTargetUpdatedRevision (targetWrapper . Object , syncContext .UpdatedRevision .Name ); isUpdated {
923+ if isUpdated = IsTargetUpdatedRevision (target , syncContext .UpdatedRevision .Name ); isUpdated {
921924 updatedReplicas ++
922925 }
923926
924- if opslifecycle .IsDuringOps (r .updateConfig .XsetLabelAnnoMgr , r .scaleInLifecycleAdapter , targetWrapper ) ||
925- opslifecycle .IsDuringOps (r .updateConfig .XsetLabelAnnoMgr , r .updateLifecycleAdapter , targetWrapper ) {
927+ if opslifecycle .IsDuringOps (r .updateConfig .XsetLabelAnnoMgr , r .scaleInLifecycleAdapter , target ) ||
928+ opslifecycle .IsDuringOps (r .updateConfig .XsetLabelAnnoMgr , r .updateLifecycleAdapter , target ) {
926929 operatingReplicas ++
927930 }
928931
929- if ready , _ := r .xsetController .CheckReadyTime (targetWrapper . Object ); ready {
932+ if ready , _ := r .xsetController .CheckReadyTime (target ); ready {
930933 readyReplicas ++
931934 if isUpdated {
932935 updatedReadyReplicas ++
933936 }
934937 }
935938
936- if r .xsetController .CheckAvailable (targetWrapper . Object ) {
939+ if r .xsetController .CheckAvailable (target ) {
937940 availableReplicas ++
938941 if isUpdated {
939942 updatedAvailableReplicas ++
940943 }
941944 }
942945
943- if r .xsetController .CheckScheduled (targetWrapper . Object ) {
946+ if r .xsetController .CheckScheduled (target ) {
944947 scheduledReplicas ++
945948 }
946949 }
0 commit comments