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

Bug in docs around component config and using a custom type #3418

Closed
hsyed-dojo opened this issue May 16, 2023 · 3 comments · Fixed by #3467
Closed

Bug in docs around component config and using a custom type #3418

hsyed-dojo opened this issue May 16, 2023 · 3 comments · Fixed by #3467
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation.

Comments

@hsyed-dojo
Copy link

hsyed-dojo commented May 16, 2023

What broke? What's expected?

I found a problem trying to switch my project to component config. I need to provide a custom type as I'd like to configure further facets of my operator using this mechanism.

The documentation suggests that a custom type needs to be registered with the scheme in main.go. If I do this manager startup fails with:

ERROR	setup	unable to load the config file	{"error": "could not decode file into runtime.Object"}

If I do not register my custom type with the scheme the new type deserializes correctly and everything works.

Some feedback on the component config process and potentially improving the docs. The docs suggest creating a new API for the config using kubebuilder. This forces the user to turn the project into a multi-group project. This seems to be unnecessary since the type does not need to be registered with the scheme. It might be simpler for the user to just plop a config struct somewhere in their codebase manually ?

Reproducing this issue

Create a hello world operator with kubebuilder, follow the docs exactly to enable component config and add a custom type. Deploy the operator somewhere.

KubeBuilder (CLI) Version

3.10.0

PROJECT version

v1

Plugin versions

- go.kubebuilder.io/v4-alpha

Other versions

1.20.4
sigs.k8s.io/controller-runtime v0.14.1

Extra Labels

/kind documentation

@hsyed-dojo hsyed-dojo added the kind/bug Categorizes issue or PR as related to a bug. label May 16, 2023
@k8s-ci-robot k8s-ci-robot added the kind/documentation Categorizes issue or PR as related to documentation. label May 16, 2023
@hsyed-dojo
Copy link
Author

hsyed-dojo commented May 17, 2023

image

I just updated controller-runtime to 0.14.4 in my operators and the documented approach for wiring up the component config is now using deprecated APIs.

I feel it might be safer for me to go back to command line flags for configuring the controller-runtime and just loading my custom config file outside of the kubuilder rails via a configmap.

@camilamacedo86
Copy link
Member

Thank you for raising this one.
We will need to look out on this.

It seems that we just need to address the deprecation or did I missed something on this one?

@hsyed-dojo
Copy link
Author

hsyed-dojo commented May 24, 2023

The deprecation problem came in with kubebuilder 3.10.0 via controller-runtime 0.14.4. The issues above apply to the documentation and 3.9.0.

There are other issues, recap:

  • Documentation suggests registering a custom type with the scheme, this stops the service from starting and is not needed for deserializing the component config.
  • Documentation leads the user into making the project multi-group to use custom types, quite a disruptive change to a project that is not strictly needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. kind/documentation Categorizes issue or PR as related to documentation.
Projects
None yet
3 participants