Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation uses deprecated variables for defining namespace scope in manager options #6843

Open
mmeknowis opened this issue Oct 15, 2024 · 0 comments

Comments

@mmeknowis
Copy link

mmeknowis commented Oct 15, 2024

While reading the operator-scope section, it seems that the documentation contains a deprecated manager Options type:

...
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
    Scheme:             scheme,
    MetricsBindAddress: metricsAddr,
    Port:               9443,
    LeaderElection:     enableLeaderElection,
    LeaderElectionID:   "f1c5ece8.example.com",
    Cache: cache.Options{
      DefaultNamespaces: map[string]cache.Config{"operator-namespace": cache.Config{}},
    },
})
...

But if I check the type [Options}(https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/manager#Options) the variables Port and MetricsBindAddress are missing for me.

We tried on our own to find a valid solution, like:

...
mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
    Scheme:             scheme,
    WebhookServer: webhook.NewServer(webhook.Options{Port: 9443}),
    Metrics:       server.Options{BindAddress: metricsAddr},
    LeaderElection:     enableLeaderElection,
    LeaderElectionID:   "f1c5ece8.example.com",
    Cache: cache.Options{
      DefaultNamespaces: map[string]cache.Config{"operator-namespace": cache.Config{}},
    },
})
...

But we are getting strange errors when we start the operator:

{"level":"ERROR","@timestamp":"2024-10-15T11:06:07.370Z","logger":"client-go","caller":"leaderelection/leaderelection.go:332","message":"error retrieving resource lock operator-namespace/f1c5ece8.example.com: Get \"https://172.30.0.1:443/apis/coordination.k8s.io/v1/namespaces/ioperator-namespace/leases/f1c5ece8.example.com\"

What would be a valid new example for watching resources in a specific namespace or are we doing something wrong?

Thanks a lot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant