mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 17:30:00 +00:00
Deployment: Clear obsolete OverlapAnnotaiton.
This ensures old clients will not assume the Deployment is blocked.
This commit is contained in:
parent
fa23729a6d
commit
de92f90f12
@ -581,6 +581,20 @@ func (dc *DeploymentController) syncDeployment(key string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is the point at which we used to add/remove the overlap annotation.
|
||||||
|
// Now we always remove it if it exists, because it is obsolete as of 1.6.
|
||||||
|
// Although the server no longer adds or looks at the annotation,
|
||||||
|
// it's important to remove it from controllers created before the upgrade,
|
||||||
|
// so that old clients (e.g. kubectl reaper) know they can no longer assume
|
||||||
|
// the controller is blocked due to selector overlap and has no dependents.
|
||||||
|
if _, ok := d.Annotations[util.OverlapAnnotation]; ok {
|
||||||
|
delete(d.Annotations, util.OverlapAnnotation)
|
||||||
|
d, err = dc.client.ExtensionsV1beta1().Deployments(d.Namespace).UpdateStatus(d)
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("couldn't remove obsolete overlap annotation from deployment %v: %v", key, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// List ReplicaSets owned by this Deployment, while reconciling ControllerRef
|
// List ReplicaSets owned by this Deployment, while reconciling ControllerRef
|
||||||
// through adoption/orphaning.
|
// through adoption/orphaning.
|
||||||
rsList, err := dc.getReplicaSetsForDeployment(d)
|
rsList, err := dc.getReplicaSetsForDeployment(d)
|
||||||
|
@ -254,6 +254,32 @@ func TestSyncDeploymentCreatesReplicaSet(t *testing.T) {
|
|||||||
f.run(getKey(d, t))
|
f.run(getKey(d, t))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestSyncDeploymentClearsOverlapAnnotation(t *testing.T) {
|
||||||
|
f := newFixture(t)
|
||||||
|
|
||||||
|
d := newDeployment("foo", 1, nil, nil, nil, map[string]string{"foo": "bar"})
|
||||||
|
d.Annotations[util.OverlapAnnotation] = "overlap"
|
||||||
|
f.dLister = append(f.dLister, d)
|
||||||
|
f.objects = append(f.objects, d)
|
||||||
|
|
||||||
|
rs := newReplicaSet(d, "deploymentrs-4186632231", 1)
|
||||||
|
|
||||||
|
f.expectUpdateDeploymentStatusAction(d)
|
||||||
|
f.expectCreateRSAction(rs)
|
||||||
|
f.expectUpdateDeploymentStatusAction(d)
|
||||||
|
f.expectUpdateDeploymentStatusAction(d)
|
||||||
|
|
||||||
|
f.run(getKey(d, t))
|
||||||
|
|
||||||
|
d, err := f.client.ExtensionsV1beta1().Deployments(d.Namespace).Get(d.Name, metav1.GetOptions{})
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("can't get deployment: %v", err)
|
||||||
|
}
|
||||||
|
if _, ok := d.Annotations[util.OverlapAnnotation]; ok {
|
||||||
|
t.Errorf("OverlapAnnotation = %q, wanted absent", d.Annotations[util.OverlapAnnotation])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestSyncDeploymentDontDoAnythingDuringDeletion(t *testing.T) {
|
func TestSyncDeploymentDontDoAnythingDuringDeletion(t *testing.T) {
|
||||||
f := newFixture(t)
|
f := newFixture(t)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user