Skip to content

Commit 3b3dda6

Browse files
a-hilalyitaiatu
andcommitted
feat: Add watch selector support to controller manager
Adds the configured watch selectors to the controller managers cache options, allowing filtered resource watching based on labels. Co-authored-by: itaiatu <itaiatu@adobe.com>
1 parent 3722729 commit 3b3dda6

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

templates/cmd/controller/main.go.tpl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,20 @@ func main() {
107107
for _, namespace := range namespaces {
108108
watchNamespaces[namespace] = ctrlrtcache.Config{}
109109
}
110+
watchSelectors, err := ackCfg.ParseWatchSelectors()
111+
if err != nil {
112+
setupLog.Error(
113+
err, "Unable to parse watch selectors.",
114+
"aws.service", awsServiceAlias,
115+
)
116+
os.Exit(1)
117+
}
110118
mgr, err := ctrlrt.NewManager(ctrlrt.GetConfigOrDie(), ctrlrt.Options{
111119
Scheme: scheme,
112120
Cache: ctrlrtcache.Options{
113-
Scheme: scheme,
114-
DefaultNamespaces: watchNamespaces,
121+
Scheme: scheme,
122+
DefaultNamespaces: watchNamespaces,
123+
DefaultLabelSelector: watchSelectors,
115124
},
116125
WebhookServer: &ctrlrtwebhook.DefaultServer{
117126
Options: ctrlrtwebhook.Options{

0 commit comments

Comments
 (0)