-
Miciah Masters authored
Set the "traffic-policy.network.alpha.openshift.io/local-with-fallback" annotation on LoadBalancer- and NodePort-type services that use the "Local" external traffic policy. This commit is related to bug 1960284. https://bugzilla.redhat.com/show_bug.cgi?id=1960284 * pkg/operator/controller/ingress/load_balancer_service.go (localWithFallbackAnnotation): New const. Define the annotation key for the "local-with-fallback" service annotation. (desiredLoadBalancerService): Set the "local-with-fallback" annotation when using the "Local" external traffic policy. (managedLoadBalancerServiceAnnotations): New variable. Define the keys for annotations that the operator manages on LoadBalancer-type services, which now include the "local-with-fallback" annotation. (loadBalancerServiceChanged): Fix the update logic to properly handle annotations with empty values using go-cmp and managedLoadBalancerServiceAnnotations. * pkg/operator/controller/ingress/load_balancer_service_test.go (TestDesiredLoadBalancerService): Verify that the "local-with-fallback" annotation is set when appropriate. (TestLoadBalancerServiceChanged): Verify that loadBalancerServiceChanged properly handles updates to the "local-with-fallback" annotation. * pkg/operator/controller/ingress/nodeport_service.go (desiredNodePortService): Set the "local-with-fallback" annotation. (managedNodePortServiceAnnotations): New variable. Define the annotation keys that the operator manages on NodePort-type services. (nodePortServiceChanged): Check if any of the annotations in managedNodePortServiceAnnotations have changed. Update managed annotations if they have changed. * pkg/operator/controller/ingress/nodeport_service_test.go (TestDesiredNodePortService): Verify that the expected annotations are set. (TestNodePortServiceChanged): Add a test case to verify that nodePortServiceChanged properly handles updates to the "local-with-fallback" annotation.
35860222