Skip to content

Commit

Permalink
consoleplugin watcher with predicate on label
Browse files Browse the repository at this point in the history
Signed-off-by: Eguzki Astiz Lezaun <eastizle@redhat.com>
  • Loading branch information
eguzki committed Oct 1, 2024
1 parent e2a9f4b commit 6e182e7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 4 additions & 1 deletion controllers/state_of_the_world.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
kuadrantgatewayapi "github.com/kuadrant/kuadrant-operator/pkg/library/gatewayapi"
"github.com/kuadrant/kuadrant-operator/pkg/library/kuadrant"
"github.com/kuadrant/kuadrant-operator/pkg/openshift"
"github.com/kuadrant/kuadrant-operator/pkg/openshift/consoleplugin"
)

var (
Expand Down Expand Up @@ -137,7 +138,9 @@ func NewPolicyMachineryController(manager ctrlruntime.Manager, client *dynamic.D
logger.Info("console plugin is not installed, skipping related watches and reconcilers", "err", err)
} else {
controllerOpts = append(controllerOpts,
controller.WithRunnable("consoleplugin watcher", controller.Watch(&consolev1.ConsolePlugin{}, openshift.ConsolePluginsResource, metav1.NamespaceAll)),
controller.WithRunnable("consoleplugin watcher", controller.Watch(
&consolev1.ConsolePlugin{}, openshift.ConsolePluginsResource, metav1.NamespaceAll,
controller.FilterResourcesByLabel[*consolev1.ConsolePlugin](fmt.Sprintf("%s=%s", consoleplugin.AppLabelKey, consoleplugin.AppLabelValue)))),
controller.WithObjectKinds(openshift.ConsolePluginGVK.GroupKind()),

Check warning on line 144 in controllers/state_of_the_world.go

View check run for this annotation

Codecov / codecov/patch

controllers/state_of_the_world.go#L140-L144

Added lines #L140 - L144 were not covered by tests
// TODO: add object links
)

Check warning on line 146 in controllers/state_of_the_world.go

View check run for this annotation

Codecov / codecov/patch

controllers/state_of_the_world.go#L146

Added line #L146 was not covered by tests
Expand Down
7 changes: 6 additions & 1 deletion pkg/openshift/consoleplugin/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ const (
KuadrantPluginComponent = "kuadrant-plugin"
)

var (
AppLabelKey = "app"
AppLabelValue = KuadrantConsoleName
)

func CommonLabels() map[string]string {
return map[string]string{
"app": KuadrantConsoleName,
AppLabelKey: AppLabelValue,
"app.kubernetes.io/component": KuadrantPluginComponent,
"app.kubernetes.io/managed-by": "kuadrant-operator",
"app.kubernetes.io/instance": KuadrantConsoleName,
Expand Down

0 comments on commit 6e182e7

Please sign in to comment.