vmware-tanzu/vm-operator

Replace deprecated `loadBalancerIP` field from created `Service` objects with custom annotations

Open

#156 opened on Jun 2, 2023

 (1 comment) (2 reactions) (0 assignees)Go (78 forks)auto 404
enhancementhelp wanted

Repository metrics

Stars
 (130 stars)
PR merge metrics
 (PR metrics pending)

Description

Please describe the solution you would like. The VirtualMachineService controller has the logic to create a Service CR without selectors which gets the load balancer IP address as provided by the configured LoadBalancer provider. Currently, the created Service CR has the IP address populates in its Spec.loadBalancerIP field. This field has been deprecated since k8s 1.24 and will be removed in a future release. The alternate course of action suggested is to use a custom annotation to set the information on the Service object instead of setting the spec.loadBalancerIP value on the Service CR.

This issue is to track updating the controller logic for the VirtualMachineService CR to set the load balancer IP address via a custom annotation along with setting the value on the Service.Spec.loadBalancerIP. Eventually, for backwards compatibility we will need to replace the logic for the creation of a Service object with:

  1. Fetch the existing Service object, if any, into a k8s.io/apimachinery/pkg/apis/meta/v1/unstructured.Unstructured type
  2. Depending upon the presence of the loadBalancerIP field, we'd set the custom annotation on the Service CR.
  3. Update the object with the newer annotation type.

Is there anything else you would like to add? The documentation for the deprecation and the alternate course of action can be found here:

Contributor guide