diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go index 469a6485bd4c..54877b8b6460 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller.go @@ -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) } diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller_test.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller_test.go index 3a1dfec3d9d5..158c5b78e75e 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller_test.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_controller_test.go @@ -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) } } diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup.go index c8f10b5ad13d..fc7fbda98f06 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup.go @@ -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)" ) diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup_test.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup_test.go index 75cccf7cd991..f78ad247370e 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup_test.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_nodegroup_test.go @@ -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() diff --git a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured.go b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured.go index ac6991bebbe9..ad528ea907db 100644 --- a/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured.go +++ b/cluster-autoscaler/cloudprovider/clusterapi/clusterapi_unstructured.go @@ -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{})