ignore some cases that no needs to progress (#46)

Signed-off-by: mingzhou.swx <mingzhou.swx@alibaba-inc.com>

Co-authored-by: mingzhou.swx <mingzhou.swx@alibaba-inc.com>
This commit is contained in:
Wei-Xiang Sun 2022-06-14 15:04:01 +08:00 committed by GitHub
parent 8efe94ff58
commit cf29580566
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -144,6 +144,12 @@ func (r *ControllerFinder) getKruiseCloneSet(namespace string, ref *rolloutv1alp
if _, ok = workload.Annotations[InRolloutProgressingAnnotation]; !ok {
return workload, nil
}
// no need to progress
if cloneSet.Status.Replicas == cloneSet.Status.UpdatedReplicas && cloneSet.Status.CurrentRevision == cloneSet.Status.UpdateRevision {
return workload, nil
}
// in rollout progressing
workload.InRolloutProgressing = true
// Is it in rollback phase
@ -191,6 +197,11 @@ func (r *ControllerFinder) getDeployment(namespace string, ref *rolloutv1alpha1.
return workload, nil
}
// no need to progress
if stable.Status.Replicas == stable.Status.UpdatedReplicas {
return workload, nil
}
// in rollout progressing
workload.InRolloutProgressing = true
// workload is continuous release, indicates rollback(v1 -> v2 -> v1)
@ -252,6 +263,12 @@ func (r *ControllerFinder) getStatefulSetLikeWorkload(namespace string, ref *rol
if _, ok := workload.Annotations[InRolloutProgressingAnnotation]; !ok {
return workload, nil
}
// no need to progress
if workloadInfo.Status.Replicas == workloadInfo.Status.UpdatedReplicas && workloadInfo.Status.StableRevision == workloadInfo.Status.UpdateRevision {
return workload, nil
}
// in rollout progressing
workload.InRolloutProgressing = true