removes deprecated CAPI annotations
This commit is contained in:
parent
86068ba9a9
commit
ecfaa6d700
|
|
@ -259,10 +259,7 @@ func (c *machineController) findMachineByProviderID(providerID normalizedProvide
|
|||
return nil, nil
|
||||
}
|
||||
|
||||
machineID, ok := node.Annotations[machineAnnotationKey]
|
||||
if !ok {
|
||||
machineID = node.Annotations[deprecatedMachineAnnotationKey]
|
||||
}
|
||||
machineID, _ := node.Annotations[machineAnnotationKey]
|
||||
return c.findMachine(machineID)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -596,12 +596,11 @@ func TestControllerFindMachine(t *testing.T) {
|
|||
for i := range testConfig.machines {
|
||||
n := testConfig.nodes[i]
|
||||
annotations := n.GetAnnotations()
|
||||
val, ok := annotations[machineAnnotationKey]
|
||||
_, ok := annotations[machineAnnotationKey]
|
||||
if !ok {
|
||||
t.Fatal("node did not contain machineAnnotationKey")
|
||||
}
|
||||
delete(annotations, machineAnnotationKey)
|
||||
annotations[deprecatedMachineAnnotationKey] = val
|
||||
n.SetAnnotations(annotations)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// deprecatedMachineDeleteAnnotationKey should not be removed until minimum cluster-api support is v1alpha3
|
||||
deprecatedMachineDeleteAnnotationKey = "cluster.k8s.io/delete-machine"
|
||||
// TODO: determine what currently relies on deprecatedMachineAnnotationKey to determine when it can be removed
|
||||
deprecatedMachineAnnotationKey = "cluster.k8s.io/machine"
|
||||
debugFormat = "%s (min: %d, max: %d, replicas: %d)"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -649,9 +649,6 @@ func TestNodeGroupDeleteNodes(t *testing.T) {
|
|||
if _, found := machine.GetAnnotations()[machineDeleteAnnotationKey]; !found {
|
||||
t.Errorf("expected annotation %q on machine %s", machineDeleteAnnotationKey, machine.GetName())
|
||||
}
|
||||
if _, found := machine.GetAnnotations()[deprecatedMachineDeleteAnnotationKey]; !found {
|
||||
t.Errorf("expected annotation %q on machine %s", deprecatedMachineDeleteAnnotationKey, machine.GetName())
|
||||
}
|
||||
}
|
||||
|
||||
gvr, err := ng.scalableResource.GroupVersionResource()
|
||||
|
|
|
|||
|
|
@ -130,7 +130,6 @@ func (r unstructuredScalableResource) UnmarkMachineForDeletion(machine *unstruct
|
|||
|
||||
annotations := u.GetAnnotations()
|
||||
delete(annotations, machineDeleteAnnotationKey)
|
||||
delete(annotations, deprecatedMachineDeleteAnnotationKey)
|
||||
u.SetAnnotations(annotations)
|
||||
_, updateErr := r.controller.managementClient.Resource(r.controller.machineResource).Namespace(u.GetNamespace()).Update(context.TODO(), u, metav1.UpdateOptions{})
|
||||
|
||||
|
|
@ -151,7 +150,6 @@ func (r unstructuredScalableResource) MarkMachineForDeletion(machine *unstructur
|
|||
}
|
||||
|
||||
annotations[machineDeleteAnnotationKey] = time.Now().String()
|
||||
annotations[deprecatedMachineDeleteAnnotationKey] = time.Now().String()
|
||||
u.SetAnnotations(annotations)
|
||||
|
||||
_, updateErr := r.controller.managementClient.Resource(r.controller.machineResource).Namespace(u.GetNamespace()).Update(context.TODO(), u, metav1.UpdateOptions{})
|
||||
|
|
|
|||
Loading…
Reference in New Issue