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 for "Watching Externally Managed Resources" No longer matches implementation #3583

Closed
SimonStiil opened this issue Sep 3, 2023 · 7 comments · Fixed by #3777
Assignees
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation.

Comments

@SimonStiil
Copy link

What broke? What's expected?

Seems like there have been a few updates to the controller-runtime that have not been added in the documentation for
https://kubebuilder.io/reference/watching-resources/externally-managed

This means if you use the examples in the documentation you get compilation issues

func (r *ConfigDeploymentReconciler) findObjectsForConfigMap(configMap client.Object) []reconcile.Request {

Should now be

func (r *ConfigDeploymentReconciler) findObjectsForConfigMap(ctx context.Context, configMap client.Object) []reconcile.Request {
        Watches(
            &source.Kind{Type: &corev1.ConfigMap{}},
            handler.EnqueueRequestsFromMapFunc(r.findObjectsForConfigMap),
            builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}),
        ).

Should now be

        Watches(
            &corev1.ConfigMap{},
            handler.EnqueueRequestsFromMapFunc(r.findObjectsForConfigMap),
            builder.WithPredicates(predicate.ResourceVersionChangedPredicate{}),
        ).

Reproducing this issue

Create new kubebuilder project using
KubeBuilderVersion:"3.11.1"
sigs.k8s.io/controller-runtime v0.15.0

try to implement watching externally managed resources using existing documentation
https://kubebuilder.io/reference/watching-resources/externally-managed

KubeBuilder (CLI) Version

3.11.1

PROJECT version

3

Plugin versions

- go.kubebuilder.io/v4

Other versions

go version go1.21.0 linux/amd64

sigs.k8s.io/controller-runtime v0.15.0

Extra Labels

/kind documentation

@SimonStiil SimonStiil added the kind/bug Categorizes issue or PR as related to a bug. label Sep 3, 2023
@k8s-ci-robot k8s-ci-robot added the kind/documentation Categorizes issue or PR as related to documentation. label Sep 3, 2023
@camilamacedo86
Copy link
Member

Hi @SimonStiil,

Please, feel free to push a PR with the fix.
Your help is more than welcome

@camilamacedo86 camilamacedo86 added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Sep 6, 2023
@camilamacedo86
Copy link
Member

For who will take this one, please just confirm that the change is required / accurate.

@ashutosh887
Copy link
Contributor

Let me take this ahead @camilamacedo86

/assign

@camilamacedo86
Copy link
Member

Hi @ashutosh887,

Are you working in this one? If so, please, feel free to ping us if you face any challenge to achieve this one. If not, please unassigned it from you so others might able to work on it.

Thank you a lot for all your contributions 🥇 and help in make kubebuilder better for the community.

@omerxx
Copy link

omerxx commented Nov 16, 2023

This is very much needed I was battling with my own code that just worked a few months back

@ashutosh887
Copy link
Contributor

@camilamacedo86 @varshaprasad96
What needs to be done in this please guide a bit!!!

@vladfr
Copy link
Contributor

vladfr commented Feb 12, 2024

Bumped into this, I might as well

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants