Skip to content

Remove dependency on k8s.io/kubernetes #142

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

Closed
astefanutti opened this issue May 21, 2024 · 7 comments · Fixed by #143
Closed

Remove dependency on k8s.io/kubernetes #142

astefanutti opened this issue May 21, 2024 · 7 comments · Fixed by #143

Comments

@astefanutti
Copy link

WHY

k8s.io/kubernetes is not meant to be depended on as explain in kubernetes/kubernetes#79384.

WHAT

This causes issues with some tools.

HOW

Replace the dependency:

pkgcorev1 "k8s.io/kubernetes/pkg/apis/core/v1"

With the right one from k8s.io/api/core/v1.

@astefanutti
Copy link
Author

/cc @dgrove-oss

@dgrove-oss
Copy link
Collaborator

I'm pretty sure k8s.io/api/core/v1 isn't enough (that was what I initially tried last week when fixing #131). Just depending on core/v1 doesn't get the "right" AddToScheme function implementation that causes the generated defaulting functions to be registered.

I'll try to figure out some how to get those defaulters without the direct dependency.

@dgrove-oss
Copy link
Collaborator

Looks like we can't get the defaulters through one of the published k8s modules so we will have to replicate the needed functionality instead. This will be a bit fragile, but appears to be unavoidable if we can't access the generated functions.

@tardieu
Copy link
Member

tardieu commented May 21, 2024

Could we run defaulter-gen ourselves?

@astefanutti
Copy link
Author

It's annoying but not blocking, so we can leave it as if we think there isn't any "good" solution.

Ideally these defaulters would be published as part of https://github.com/kubernetes/api.

@dgrove-oss
Copy link
Collaborator

In the short term, I'm going to copy in the generated defaulter (and associated helpers) I'm using into our utils package as package-private functions. That will let us clean the dependency. Longer term, I'd like to kick off a discussion with the Kueue maintainers about whether they really need to use such a picky and fragile notion of equality.

@astefanutti
Copy link
Author

Sounds good, thanks.

dgrove-oss added a commit to dgrove-oss/appwrapper that referenced this issue May 21, 2024
Fixes project-codeflare#142.

We need the functionality provided by this code, but it is sadly
k8s internal and not registered by the AddToScheme method of the
approved API package.
dgrove-oss added a commit that referenced this issue May 21, 2024
Fixes #142.

We need the functionality provided by this code, but it is sadly
k8s internal and not registered by the AddToScheme method of the
approved API package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants