Skip to content

Commit

Permalink
fix sets deletion and add filter for infra
Browse files Browse the repository at this point in the history
Signed-off-by: chiragkyal <ckyal@redhat.com>
  • Loading branch information
chiragkyal committed Oct 1, 2024
1 parent 0014335 commit ea36409
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
13 changes: 12 additions & 1 deletion pkg/operator/controller/ingress/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ import (

const (
controllerName = "ingress_controller"
// the name of the 'cluster' infrastructure object
clusterInfrastructureName = "cluster"
)

// TODO: consider moving these to openshift/api
Expand Down Expand Up @@ -135,7 +137,9 @@ func New(mgr manager.Manager, config Config) (controller.Controller, error) {
return nil, err
}
// Watch for changes to infrastructure config to update user defined tags
if err := c.Watch(source.Kind[client.Object](operatorCache, &configv1.Infrastructure{}, handler.EnqueueRequestsFromMapFunc(reconciler.ingressConfigToIngressController))); err != nil {
if err := c.Watch(source.Kind[client.Object](operatorCache, &configv1.Infrastructure{}, handler.EnqueueRequestsFromMapFunc(reconciler.ingressConfigToIngressController),
predicate.NewPredicateFuncs(hasName(clusterInfrastructureName)),
)); err != nil {
return nil, err
}
return c, nil
Expand Down Expand Up @@ -191,6 +195,13 @@ func enqueueRequestForOwningIngressController(namespace string) handler.EventHan
})
}

// hasName returns a predicate which checks whether an object has the given name.
func hasName(name string) func(o client.Object) bool {
return func(o client.Object) bool {
return o.GetName() == name
}
}

// Config holds all the things necessary for the controller to run.
type Config struct {
Namespace string
Expand Down
3 changes: 2 additions & 1 deletion pkg/operator/controller/ingress/load_balancer_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,8 @@ func IsServiceInternal(service *corev1.Service) bool {

// loadBalancerServiceTagsModified verifies that none of the managedAnnotations except awsLBAdditionalResourceTags have been changed
func loadBalancerServiceTagsModified(current, expected *corev1.Service) (bool, *corev1.Service) {
ignoredAnnotations := managedLoadBalancerServiceAnnotations.Delete(awsLBAdditionalResourceTags)
ignoredAnnotations := managedLoadBalancerServiceAnnotations.Clone()
ignoredAnnotations.Delete(awsLBAdditionalResourceTags)
return loadBalancerServiceAnnotationsChanged(current, expected, ignoredAnnotations)
}

Expand Down

0 comments on commit ea36409

Please sign in to comment.