mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-05 02:09:56 +00:00
revert 45764
This commit is contained in:
parent
72cb080c87
commit
31d0869f83
@ -341,9 +341,8 @@ func (m *ReplicaSetControllerRefManager) ClaimReplicaSets(sets []*extensions.Rep
|
|||||||
return claimed, utilerrors.NewAggregate(errlist)
|
return claimed, utilerrors.NewAggregate(errlist)
|
||||||
}
|
}
|
||||||
|
|
||||||
// AdoptReplicaSet sends a patch to take control of the ReplicaSet and also
|
// AdoptReplicaSet sends a patch to take control of the ReplicaSet. It returns
|
||||||
// sets the finalizers to foregroundDeletion. It returns the error if
|
// the error if the patching fails.
|
||||||
// the patching fails.
|
|
||||||
func (m *ReplicaSetControllerRefManager) AdoptReplicaSet(rs *extensions.ReplicaSet) error {
|
func (m *ReplicaSetControllerRefManager) AdoptReplicaSet(rs *extensions.ReplicaSet) error {
|
||||||
if err := m.canAdopt(); err != nil {
|
if err := m.canAdopt(); err != nil {
|
||||||
return fmt.Errorf("can't adopt ReplicaSet %v/%v (%v): %v", rs.Namespace, rs.Name, rs.UID, err)
|
return fmt.Errorf("can't adopt ReplicaSet %v/%v (%v): %v", rs.Namespace, rs.Name, rs.UID, err)
|
||||||
@ -351,14 +350,7 @@ func (m *ReplicaSetControllerRefManager) AdoptReplicaSet(rs *extensions.ReplicaS
|
|||||||
// Note that ValidateOwnerReferences() will reject this patch if another
|
// Note that ValidateOwnerReferences() will reject this patch if another
|
||||||
// OwnerReference exists with controller=true.
|
// OwnerReference exists with controller=true.
|
||||||
addControllerPatch := fmt.Sprintf(
|
addControllerPatch := fmt.Sprintf(
|
||||||
`{
|
`{"metadata":{"ownerReferences":[{"apiVersion":"%s","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],"uid":"%s"}}`,
|
||||||
"metadata":
|
|
||||||
{
|
|
||||||
"ownerReferences": [{"apiVersion":"%s","kind":"%s","name":"%s","uid":"%s","controller":true,"blockOwnerDeletion":true}],
|
|
||||||
"uid":"%s",
|
|
||||||
"finalizers": ["foregroundDeletion"]
|
|
||||||
}
|
|
||||||
}`,
|
|
||||||
m.controllerKind.GroupVersion(), m.controllerKind.Kind,
|
m.controllerKind.GroupVersion(), m.controllerKind.Kind,
|
||||||
m.controller.GetName(), m.controller.GetUID(), rs.UID)
|
m.controller.GetName(), m.controller.GetUID(), rs.UID)
|
||||||
return m.rsControl.PatchReplicaSet(rs.Namespace, rs.Name, []byte(addControllerPatch))
|
return m.rsControl.PatchReplicaSet(rs.Namespace, rs.Name, []byte(addControllerPatch))
|
||||||
|
@ -300,7 +300,6 @@ func (dc *DeploymentController) getNewReplicaSet(d *extensions.Deployment, rsLis
|
|||||||
Name: d.Name + "-" + podTemplateSpecHash,
|
Name: d.Name + "-" + podTemplateSpecHash,
|
||||||
Namespace: d.Namespace,
|
Namespace: d.Namespace,
|
||||||
OwnerReferences: []metav1.OwnerReference{*newControllerRef(d)},
|
OwnerReferences: []metav1.OwnerReference{*newControllerRef(d)},
|
||||||
Finalizers: []string{metav1.FinalizerDeleteDependents},
|
|
||||||
},
|
},
|
||||||
Spec: extensions.ReplicaSetSpec{
|
Spec: extensions.ReplicaSetSpec{
|
||||||
Replicas: new(int32),
|
Replicas: new(int32),
|
||||||
|
Loading…
Reference in New Issue
Block a user