Merge pull request #36399 from mwielgus/fedrc1
Automatic merge from submit-queue Make desired objects in fed controller reconcilation function fully writable When creating desired objects for sub-cluster in reconciliate functions we don't make full copies. This may result in unexpected race condition in the future when someone actually adds some object modifications (not needed in most cases but anyway - the cost of extra copy will be relatively small comparing to inter-cluster traffic). In case of ReplicaSet and Deployment the spec copy was a shallow one - ok for setting just replicas but also error-prone in the future. cc: @quinton-hoole @nikhiljindal @madhusudancs
This commit is contained in:
@@ -391,9 +391,10 @@ func (nc *NamespaceController) reconcileNamespace(namespace string) {
|
||||
nc.deliverNamespace(namespace, 0, true)
|
||||
return
|
||||
}
|
||||
// The object should not be modified.
|
||||
desiredNamespace := &api_v1.Namespace{
|
||||
ObjectMeta: util.CopyObjectMeta(baseNamespace.ObjectMeta),
|
||||
Spec: baseNamespace.Spec,
|
||||
ObjectMeta: util.DeepCopyRelevantObjectMeta(baseNamespace.ObjectMeta),
|
||||
Spec: util.DeepCopyApiTypeOrPanic(baseNamespace.Spec).(api_v1.NamespaceSpec),
|
||||
}
|
||||
glog.V(5).Infof("Desired namespace in underlying clusters: %+v", desiredNamespace)
|
||||
|
||||
|
Reference in New Issue
Block a user