Skip to content

Commit 6e182e7

Browse files
committed
consoleplugin watcher with predicate on label
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
1 parent e2a9f4b commit 6e182e7

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

controllers/state_of_the_world.go

+4-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import (
3232
kuadrantgatewayapi "github.com/kuadrant/kuadrant-operator/pkg/library/gatewayapi"
3333
"github.com/kuadrant/kuadrant-operator/pkg/library/kuadrant"
3434
"github.com/kuadrant/kuadrant-operator/pkg/openshift"
35+
"github.com/kuadrant/kuadrant-operator/pkg/openshift/consoleplugin"
3536
)
3637

3738
var (
@@ -137,7 +138,9 @@ func NewPolicyMachineryController(manager ctrlruntime.Manager, client *dynamic.D
137138
logger.Info("console plugin is not installed, skipping related watches and reconcilers", "err", err)
138139
} else {
139140
controllerOpts = append(controllerOpts,
140-
controller.WithRunnable("consoleplugin watcher", controller.Watch(&consolev1.ConsolePlugin{}, openshift.ConsolePluginsResource, metav1.NamespaceAll)),
141+
controller.WithRunnable("consoleplugin watcher", controller.Watch(
142+
&consolev1.ConsolePlugin{}, openshift.ConsolePluginsResource, metav1.NamespaceAll,
143+
controller.FilterResourcesByLabel[*consolev1.ConsolePlugin](fmt.Sprintf("%s=%s", consoleplugin.AppLabelKey, consoleplugin.AppLabelValue)))),
141144
controller.WithObjectKinds(openshift.ConsolePluginGVK.GroupKind()),
142145
// TODO: add object links
143146
)

pkg/openshift/consoleplugin/common.go

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,14 @@ const (
55
KuadrantPluginComponent = "kuadrant-plugin"
66
)
77

8+
var (
9+
AppLabelKey = "app"
10+
AppLabelValue = KuadrantConsoleName
11+
)
12+
813
func CommonLabels() map[string]string {
914
return map[string]string{
10-
"app": KuadrantConsoleName,
15+
AppLabelKey: AppLabelValue,
1116
"app.kubernetes.io/component": KuadrantPluginComponent,
1217
"app.kubernetes.io/managed-by": "kuadrant-operator",
1318
"app.kubernetes.io/instance": KuadrantConsoleName,

0 commit comments

Comments
 (0)