Merge pull request #4721 from chaosi-zju/hpasyncerv2
fix deployment replicas syncer in case deployment status changed before label added
This commit is contained in:
commit
dbb82bebd2
|
@ -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