diff --git a/config/manager/kustomization.yaml b/config/manager/kustomization.yaml index 2e820674..e9617245 100644 --- a/config/manager/kustomization.yaml +++ b/config/manager/kustomization.yaml @@ -4,5 +4,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1 kind: Kustomization images: - name: controller - newName: kusionstack/kuperator + newName: coldsteelrail/kusion-kuperator newTag: test diff --git a/pkg/controllers/collaset/synccontrol/replace.go b/pkg/controllers/collaset/synccontrol/replace.go index 9ebaa8c4..29b5f5b2 100644 --- a/pkg/controllers/collaset/synccontrol/replace.go +++ b/pkg/controllers/collaset/synccontrol/replace.go @@ -365,8 +365,11 @@ func classifyPodReplacingMapping(podWrappers []*collasetutils.PodWrapper) map[st if replacePairNewIdStr, exist := podWrapper.Labels[appsv1alpha1.PodReplacePairNewId]; exist { if pairNewPod, exist := podIdMap[replacePairNewIdStr]; exist { replacePodMapping[name] = pairNewPod - // if one of pair pods is to Exclude, both pods should not scaleIn + // if one of pair pods is to Exclude, both pods should not scaleIn until + // exclude finished, this is because scale in should be exclusive to ex/include podWrapper.ToExclude = podWrapper.ToExclude || pairNewPod.ToExclude + // if new pod is selective scaleIn, origin pod should be scaled first and then scaleIn newPod + podWrapper.ToDelete = podWrapper.ToDelete || pairNewPod.ToDelete continue } } else if replaceOriginStr, exist := podWrapper.Labels[appsv1alpha1.PodReplacePairOriginName]; exist { diff --git a/pkg/controllers/collaset/synccontrol/scale.go b/pkg/controllers/collaset/synccontrol/scale.go index 78e2e14b..be35463e 100644 --- a/pkg/controllers/collaset/synccontrol/scale.go +++ b/pkg/controllers/collaset/synccontrol/scale.go @@ -52,16 +52,12 @@ func getPodsToDelete(filteredPods []*collasetutils.PodWrapper, replaceMapping ma var needDeletePods []*collasetutils.PodWrapper // 2. select pods to delete in second round according to replace, delete, exclude for _, pod := range targetsPods[:diff] { - // don't scaleIn exclude pod and its newPod (if exist) + // scaleIn is exclusive to exclude, just ignore if pod.ToExclude { continue } if replacePairPod, exist := replaceMapping[pod.Name]; exist && replacePairPod != nil { - // don't selective scaleIn newPod (and its originPod) until replace finished - if replacePairPod.ToDelete { - continue - } // when scaleIn origin Pod, newPod should be deleted if not service available if _, serviceAvailable := replacePairPod.Labels[appsv1alpha1.PodServiceAvailableLabel]; !serviceAvailable { needDeletePods = append(needDeletePods, replacePairPod)