operator-framework / operator-sdk

SDK for building Kubernetes applications. Provides high level APIs, useful abstractions, and project scaffolding.
https://sdk.operatorframework.io
Apache License 2.0
7.1k stars 1.73k forks source link

Go Operator Tutorial Page: Incorrect Link(s) and some file path corrections #6701

Open harshvijaythakkar opened 3 months ago

harshvijaythakkar commented 3 months ago

What is the URL of the document?

Go Operator Tutorial

Which section(s) is the issue in?

Implement the Controller

What needs fixing?

The latest operator-sdk version: "v1.34.0" is pointing to wrong link for memcached_controller.go file.

Additional context

First Issue

When I click on memcached_controller.go it is giving 404 not found error. On the "latest" branch of operator-sdk repository under testdata path I don't see go/v3 folder.

The correct file location of memcached_controller.go file is under testdata/go/v4/memcached-operator/internal/controller/memcached_controller.go

On documentation I see following text

For this example replace the generated controller file controllers/memcached_controller.go with the example memcached_controller.go implementation.

I think it needs to be changed to

For this example replace the generated controller file internal/controller/memcached_controller.go with the example memcached_controller.go implementation.

Second Issue

On documentation I see following text

The SetupWithManager() function in controllers/memcached_controller.go specifies how the controller is built to watch a CR and other resources that are owned and managed by that controller.

I think it needs to be changed to

The SetupWithManager() function in internal/controllers/memcached_controller.go specifies how the controller is built to watch a CR and other resources that are owned and managed by that controller.

If my understanding is correct I think I can also make changes but just want to confirm that my understanding is correct before raising PR for changes.

caspereijkens commented 3 months ago

Also, the tutorial is incompatible with go v1.22: https://github.com/operator-framework/operator-sdk/issues/6681 I think a warning would save time for many of us.

caspereijkens commented 3 months ago

And the namespace scoping as described in the tutorial also doesn't work anymore. Please update to follow https://pkg.go.dev/sigs.k8s.io/controller-runtime/pkg/manager#example-New-LimitToNamespaces