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

Make the v1beta1 api package easier to consume #7176

Closed
johannesfrey opened this issue Sep 6, 2022 · 9 comments
Closed

Make the v1beta1 api package easier to consume #7176

johannesfrey opened this issue Sep 6, 2022 · 9 comments
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Comments

@johannesfrey
Copy link
Contributor

johannesfrey commented Sep 6, 2022

User Story

As a user I would like to easily consume the CAPI v1beta1 API package without introducing unwanted transitive dependencies.

Detailed Description

Currently if one imports the CAPI v1beta1 API package, which in turn imports sigs.k8s.io/controller-runtime, the user transitively imports sigs.k8s.io/controller-runtime/pkg/client/config, which sets the string var kubeconfig to the default command line FlagSet. See:

In the past this lead to redefined flag panics in our internal code base. A slack discussion revealed two possible solutions in CAPI:

Anything else you would like to add:

It's probably most desirable to fix this directly in controller-runtime instead of CAPI and potential providers. Nevertheless, for both mentioned "CAPI solutions" there are corresponding WIP PRs in place. If one is more desirable the other one could be closed.

/kind feature

Johannes Frey <johannes.frey@mercedes-benz.com>, Mercedes-Benz Tech Innovation GmbH (Provider Information)

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 6, 2022
@johannesfrey johannesfrey changed the title Make the api packages easier to consume Make the v1beta1 api package easier to consume Sep 6, 2022
@sbueringer
Copy link
Member

sbueringer commented Sep 6, 2022

I would prefer the first option, i.e. changing the imports.

But I wonder if there is a way to resolve the TODO in CR itself so using the top-level package doesn't lead to this problem.

Essentially resolving

// TODO: Fix this to allow double vendoring this library but still register flags on behalf of users
https://github.com/kubernetes-sigs/controller-runtime/blob/15b6689c55745514d6bade4c55efb3333c0da4d9/pkg/client/config/config.go#L38

in CR instead of changing the imports in CAPI.

No strong objections against changing the imports in CAPI in the meantime, but it would be more sustainable if it could be fixed in CR instead (not sure who remembers in the future which imports we have to use, and it would be nice to use the aliases for their intended purposes).

@vincepri WDYT?

@johannesfrey
Copy link
Contributor Author

johannesfrey commented Sep 6, 2022

I would prefer the first option, i.e. changing the imports.

But I wonder if there is a way to resolve the TODO in CR itself so using the top-level package doesn't lead to this problem.

Essentially resolving

// TODO: Fix this to allow double vendoring this library but still register flags on behalf of users
https://github.com/kubernetes-sigs/controller-runtime/blob/15b6689c55745514d6bade4c55efb3333c0da4d9/pkg/client/config/config.go#L38

in CR instead of changing the imports in CAPI.

No strong objections against changing the imports in CAPI in the meantime, but it would be more sustainable if it could be fixed in CR instead (not sure who remembers in the future which imports we have to use, and it would be nice to use the aliases for their intended purposes).

@vincepri WDYT?

Thanks for the quick reply.

FYI: There have been related issues regarding this in CR:

@sbueringer
Copy link
Member

Thx!
Yup looks like it needs an idea on how to resolve this and potentially a first implementation PR to make it happen / to push it forward.

@fabriziopandini
Copy link
Member

/triage accepted

I'm curious to understand if changing imports is enough to improve the situation/simplify the import graph.
+1 to fix the flag issue in CR

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Sep 16, 2022
@johannesfrey
Copy link
Contributor Author

FYI: The CR PR has been merged, which should resolve the issue as soon as CAPI bumps to a version of CR that contains the fix. Some follow-up steps/questions:

@fabriziopandini
Copy link
Member

Thanks for the update!
+1 to close the two PRs
We are usually bumping CR as soon as a new release is out, but feel free to open an issue to track this bump specifically

@johannesfrey
Copy link
Contributor Author

Thanks for the update! +1 to close the two PRs We are usually bumping CR as soon as a new release is out, but feel free to open an issue to track this bump specifically

Sure 🙂. Ok, if the bump is done regularly I won't open an issue. Thx!

@sbueringer
Copy link
Member

sbueringer commented Nov 3, 2022

Sounds good to me. The bump of CR will be mandatory for the Kubernetes 1.26 dependency bump anyway.

Both should easily make it into v1.4.0 (given that Kubernetes 1.26 is planned for December and CAPI 1.4 for end of March)

@sbueringer
Copy link
Member

@johannesfrey Thx for your work on this!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. triage/accepted Indicates an issue or PR is ready to be actively worked on.
Projects
None yet
4 participants