diff --git a/kuryr_kubernetes/controller/handlers/lbaas.py b/kuryr_kubernetes/controller/handlers/lbaas.py index 1e08e5101..24fc5afb9 100644 --- a/kuryr_kubernetes/controller/handlers/lbaas.py +++ b/kuryr_kubernetes/controller/handlers/lbaas.py @@ -437,13 +437,13 @@ class EndpointsHandler(k8s_base.ResourceEventHandler): k8s = clients.get_kubernetes_client() service_link = utils.get_service_link(endpoints) to_remove = [ - (endpoints['metadata']['selfLink'], + (utils.get_res_link(endpoints), k_const.K8S_ANNOTATION_LBAAS_SPEC), (service_link, k_const.K8S_ANNOTATION_LBAAS_SPEC), ] if state: - to_remove.append((endpoints['metadata']['selfLink'], + to_remove.append((utils.get_res_link(endpoints), k_const.K8S_ANNOTATION_LBAAS_STATE)) for path, name in to_remove: diff --git a/kuryr_kubernetes/utils.py b/kuryr_kubernetes/utils.py index 49878eb83..48581fed5 100644 --- a/kuryr_kubernetes/utils.py +++ b/kuryr_kubernetes/utils.py @@ -424,7 +424,7 @@ def set_lbaas_state(endpoints, lbaas_state): annotation = jsonutils.dumps(lbaas_state.obj_to_primitive(), sort_keys=True) k8s = clients.get_kubernetes_client() - k8s.annotate(endpoints['metadata']['selfLink'], + k8s.annotate(get_res_link(endpoints), {constants.K8S_ANNOTATION_LBAAS_STATE: annotation}, resource_version=endpoints['metadata']['resourceVersion']) @@ -442,7 +442,7 @@ def get_endpoints_link(service): def get_service_link(endpoints): - endpoints_link = endpoints['metadata']['selfLink'] + endpoints_link = get_res_link(endpoints) link_parts = endpoints_link.split('/') if link_parts[-2] != 'endpoints':