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

[proposal] Add CRDs from external helm chart #21

Closed
eshepelyuk opened this issue Jan 19, 2024 · 30 comments
Closed

[proposal] Add CRDs from external helm chart #21

eshepelyuk opened this issue Jan 19, 2024 · 30 comments
Assignees
Labels
enhancement New feature or request

Comments

@eshepelyuk
Copy link

Hello

Wdyt about extending this controller with possibility to extract CRDs from published Helm charts repositories. (both OCI and plain old HTTP).

Since Helm has old issue that CRDs are not automatically upgraded but the CRDs are still packaged within Helm charts, this application could address this gap.

@Skarlso
Copy link
Owner

Skarlso commented Jan 19, 2024

Oh that is a very good idea! Thanks for this proposal. I actually know how to do that. :D

💯

@Skarlso Skarlso added the enhancement New feature or request label Jan 19, 2024
@Skarlso Skarlso self-assigned this Jan 19, 2024
@eshepelyuk
Copy link
Author

Oh that is a very good idea! Thanks for this proposal. I actually know how to do that. :D

💯

In terms of cli it would be smth like

helm pull --untar .... /tmpdir
.. do magic with crd folder ...

@Skarlso
Copy link
Owner

Skarlso commented Jan 19, 2024

Yep, pretty much. Also, flux has some libraries in it's publish pkg repository to deal with OCI repos and extract tar files. So integrating that will help massively in providing this feature.

@eshepelyuk
Copy link
Author

Yep, pretty much. Also, flux has some libraries in it's publish pkg repository to deal with OCI repos and extract tar files. So integrating that will help massively in providing this feature.

i just assumed helm libs itself should support oci repos, without even going to any 3rd party.

@Skarlso
Copy link
Owner

Skarlso commented Jan 19, 2024

That's true. I thought you might want to do something like a helm source which would require credentials and would use helm package or something to extract / fetch the helm resources.

@Skarlso
Copy link
Owner

Skarlso commented Jan 24, 2024

The difficulty here will be tag discovery. Since that is broken in Helm for OCI repositories. I'll see what I can do about it. Like, I can use oras or containerregistry or whatever to see which is the latest tag. And then hope it's a chart file. :D

@eshepelyuk
Copy link
Author

The difficulty here will be tag discovery. Since that is broken in Helm for OCI repositories. I'll see what I can do about it. Like, I can use oras or containerregistry or whatever to see which is the latest tag. And then hope it's a chart file. :D

First, what do you mean broken and 2nd - why do you mention latest tag ?

Could you plz provide more details ?

@Skarlso
Copy link
Owner

Skarlso commented Jan 24, 2024

helm/helm#11000

I'm not saying latest; I'm saying latest as in the newest version. So v1.0.0 v2.0.0 v3.0.0. To detect if a new version has been pushed.

@eshepelyuk
Copy link
Author

helm/helm#11000

I'm not saying latest; I'm saying latest as in the newest version. So v1.0.0 v2.0.0 v3.0.0. To detect if a new version has been pushed.

sorry, i don't understand :(

@eshepelyuk
Copy link
Author

helm should already support semantic ranges for OCI, so i still not understanding the issue.

@Skarlso
Copy link
Owner

Skarlso commented Jan 24, 2024

Can it list tags for a specific chart?

I need to be able to track which is the latest version to reconcile new versions. If a new versions is available, I'm installing it.

In order to do that, I'm asking for a list of versions and see if the latest version is greater than the current reconciled versions given a semver constraint. So like, only patch versions, or, major, or minor.

@Skarlso
Copy link
Owner

Skarlso commented Jan 24, 2024

For example:

helm search repo chart oci://ghcr.io/skarlso/helm/crd-bootstrap --versions

Returns

No results found

So I can't use helm to discover tags.

But that's fine.. I can use oras for example, or anything else that deals with OCI registries.

@eshepelyuk
Copy link
Author

Can it list tags for a specific chart?

I need to be able to track which is the latest version to reconcile new versions. If a new versions is available, I'm installing it.

In order to do that, I'm asking for a list of versions and see if the latest version is greater than the current reconciled versions given a semver constraint. So like, only patch versions, or, major, or minor.

this is a very bad idea imo.
the versions of CRDs must be driven by customer restriction, i.e. either particular version, or semantic range ( assuming helm golang library supports it, because helm CLI supports it)

@eshepelyuk
Copy link
Author

For example:

helm search repo chart oci://ghcr.io/skarlso/helm/crd-bootstrap --versions

Returns

No results found

So I can't use helm to discover tags.

But that's fine.. I can use oras for example, or anything else that deals with OCI registries.

this is incorrect syntax, this should work

helm search repo crd-bootstrap -l

@Skarlso
Copy link
Owner

Skarlso commented Jan 24, 2024

Did you try it? :) It does not work. :)

this is a very bad idea IMO.
the versions of CRDs must be driven by customer restriction, i.e. either particular version, or semantic range ( assuming >helm golang library supports it, because helm CLI supports it)

Yes, this is exactly what I just wrote. You define a semver. If the semver allows it it will update. If it doesn't it won't. :)

@eshepelyuk
Copy link
Author

eshepelyuk commented Jan 24, 2024

Did you try it? :) It does not work. :)

this is a very bad idea IMO.
the versions of CRDs must be driven by customer restriction, i.e. either particular version, or semantic range ( assuming >helm golang library supports it, because helm CLI supports it)

Yes, this is exactly what I just wrote. You define a semver. If the semver allows it it will update. If it doesn't it won't. :)

i am AFK, command lines writing by memory.
but about latest - there should not be latest, semver exact or range should be set. and helm already handles this.

@Skarlso
Copy link
Owner

Skarlso commented Jan 24, 2024

I'm not looking at latest. I'm looking for new versions that are allowed by a set semver.

@eshepelyuk
Copy link
Author

I'm not looking at latest. I'm looking for new versions that are allowed by a set semver.

since i am afk - cant suggest smth in particular

but let give you an example.

I was using helm library chart as a dependency for my charts.

That helm library chart was published to github packages, i.e OCi registry.

I was declaring the dependency with semantic version, like ~6.

So, every time i was running helm dep up withing my my charts, the latest semantic version was resolved and downloaded.

@Skarlso
Copy link
Owner

Skarlso commented Jan 25, 2024

Aha. Interesting. I'll take a look at that code section how they circumvent the search problem. Thanks for the pointer.

@Skarlso
Copy link
Owner

Skarlso commented Jan 25, 2024

So dep update basically downloads everything again into the local registry and THEN selects the latest version using the semver. I could use something similar internally, but I don't require this level of engagement. I literally just need some tags from the OCI registry and that's it. :)

For plain HTTP and use helm search.

edit: technically it only downloads the index file. not the actual whole thing.

@eshepelyuk
Copy link
Author

So dep update basically downloads everything again into the local registry and THEN selects the latest version using the semver. I could use something similar internally, but I don't require this level of engagement. I literally just need some tags from the OCI registry and that's it. :)

For plain HTTP and use helm search.

edit: technically it only downloads the index file. not the actual whole thing.

for plain HTTP it downloads index.yaml from the repo. for OCI it queries tags via OCI registry API.

@Skarlso
Copy link
Owner

Skarlso commented Jan 25, 2024

for OCI it queries tags via OCI registry API.

Yep:

tags, err := c.RegistryClient.Tags(strings.TrimPrefix(ref, fmt.Sprintf("%s://", registry.OCIScheme)))

I guess I could use the registry client I already construct. Hopefully that works.

@Skarlso
Copy link
Owner

Skarlso commented Jan 26, 2024

The latest release should contain this feature. v0.5.0.

@eshepelyuk
Copy link
Author

The latest release should contain this feature. v0.5.0.

great.
need a time to test it, hope during the weekend.

@eshepelyuk
Copy link
Author

Maybe worth mentioning here ?
helm/helm#8668

@Skarlso
Copy link
Owner

Skarlso commented Jan 26, 2024

Thanks. I'll take a look at it. 😊

@Skarlso
Copy link
Owner

Skarlso commented Jan 26, 2024

Heh, interesting answer on that issue....

@eshepelyuk
Copy link
Author

Heh, interesting answer on that issue....

which one ?

@Skarlso
Copy link
Owner

Skarlso commented Jan 28, 2024

There is only one.

@Skarlso
Copy link
Owner

Skarlso commented Jul 29, 2024

This is now done. Please feel free to re-open or create a new issue if problems arise. :) 🙇

@Skarlso Skarlso closed this as completed Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants