fix deployment replicas syncer in case deployment status changed before label added
Signed-off-by: chaosi-zju <chaosi@zju.edu.cn>
This commit is contained in:
parent
aa89947194
commit
3012c808f8
|
@ -57,6 +57,13 @@ var predicateFunc = predicate.Funcs{
|
|||
return false
|
||||
}
|
||||
|
||||
// if old deployment is not labeled `retain-replicas`, but new is labeled, reconcile is needed.
|
||||
// in case of deployment status changed before `retain-replicas` labeled.
|
||||
oldRetainReplicasLabel := util.GetLabelValue(oldObj.GetLabels(), util.RetainReplicasLabel)
|
||||
if oldRetainReplicasLabel != util.RetainReplicasValue {
|
||||
return true
|
||||
}
|
||||
|
||||
if oldObj.Spec.Replicas == nil || newObj.Spec.Replicas == nil {
|
||||
klog.Errorf("spec.replicas field unexpectedly become nil: %+v, %+v", oldObj.Spec.Replicas, newObj.Spec.Replicas)
|
||||
return false
|
||||
|
|
Loading…
Reference in New Issue