Skip to content

Commit

Permalink
don't watch unlabelled secrets in the operator controller
Browse files Browse the repository at this point in the history
this is likely not backportable, requires newer controller-runtime

Signed-off-by: Evan <cordell.evan@gmail.com>
  • Loading branch information
ecordell committed Jul 9, 2021
1 parent 8694c6c commit bb2540d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cmd/olm/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@ package main

import (
"context"
"k8s.io/apimachinery/pkg/labels"

corev1 "k8s.io/api/core/v1"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/cache"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/install"
"github.com/operator-framework/operator-lifecycle-manager/pkg/controller/operators"
"github.com/operator-framework/operator-lifecycle-manager/pkg/feature"
)
Expand All @@ -16,7 +20,16 @@ func Manager(ctx context.Context, debug bool) (ctrl.Manager, error) {

// Setup a Manager
setupLog.Info("configuring manager")
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{MetricsBindAddress: "0"}) // TODO(njhale): Enable metrics on non-conflicting port (not 8080)
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
MetricsBindAddress: "0", // TODO(njhale): Enable metrics on non-conflicting port (not 8080)
NewCache: cache.BuilderWithOptions(cache.Options{
SelectorsByObject: cache.SelectorsByObject{
&corev1.Secret{}: {
Label: labels.SelectorFromValidatedSet(map[string]string{install.OLMManagedLabelKey: install.OLMManagedLabelValue}),
},
},
}),
})
if err != nil {
return nil, err
}
Expand Down

0 comments on commit bb2540d

Please sign in to comment.