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 examples of defining namespace scope in manager options #6796

Open
NymanRobin opened this issue Aug 1, 2024 · 1 comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/documentation Categorizes issue or PR as related to documentation. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.

Comments

@NymanRobin
Copy link

NymanRobin commented Aug 1, 2024

While reading the operator-scope section, I noticed that the documentation contains a mix of current and deprecated method for defining the namespace to watch in the manager options.

When introducing the manager watch options it correctly defines it according to the current standard

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{}},
    },
})

However, further down in the document when giving a code examples it gives the old and deprecated syntax of giving the Namespace option directly.

watchNamespace, err := getWatchNamespace()
if err != nil {
    setupLog.Error(err, "unable to get WatchNamespace, " +
       "the manager will watch and manage resources in all namespaces")
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), ctrl.Options{
    Scheme:             scheme,
    MetricsBindAddress: metricsAddr,
    Port:               9443,
    LeaderElection:     enableLeaderElection,
    LeaderElectionID:   "f1c5ece8.example.com",
    Namespace:          watchNamespace, // namespaced-scope when the value is not an empty string
})

Noticed that the tutorial also uses examples with the deprecated Namespace variable when introducing the Manager.

I think it would make sense to unify the documentation and only use the new style of giving the Namespace

@acornett21 acornett21 added kind/documentation Categorizes issue or PR as related to documentation. help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. labels Aug 1, 2024
@kevalsabhani kevalsabhani mentioned this issue Oct 7, 2024
2 tasks
kevalsabhani added a commit to kevalsabhani/operator-sdk that referenced this issue Oct 7, 2024
Signed-off-by: kevalsabhani <kevalsabhani@gmail.com>
acornett21 pushed a commit that referenced this issue Oct 15, 2024
Signed-off-by: kevalsabhani <kevalsabhani@gmail.com>
acornett21 pushed a commit to joelanford/operator-sdk that referenced this issue Oct 15, 2024
Signed-off-by: kevalsabhani <kevalsabhani@gmail.com>
@openshift-bot
Copy link

Issues go stale after 90d of inactivity.

Mark the issue as fresh by commenting /remove-lifecycle stale.
Stale issues rot after an additional 30d of inactivity and eventually close.
Exclude this issue from closing by commenting /lifecycle frozen.

If this issue is safe to close now please do so with /close.

/lifecycle stale

@openshift-ci openshift-ci bot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Denotes an issue that needs help from a contributor. Must meet "help wanted" guidelines. kind/documentation Categorizes issue or PR as related to documentation. lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale.
Projects
None yet
Development

No branches or pull requests

3 participants