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

Helm: Support templated annotationed or allow to override image regex #3619

Closed
jkroepke opened this issue Jan 22, 2024 · 7 comments
Closed

Comments

@jkroepke
Copy link

jkroepke commented Jan 22, 2024

Is your feature request related to a problem? Please describe.
Currently, images from helm charts are detected through helm template, then a regex based on image..
Each operator introduce additional images (e.g. sidecar containers) which are not visible through helm template

The current workaround is the helm annotation artifacthub.io/images which can be set via Chart.yaml. However the annotations are not rendered via helm template.

Since the sidecar images are present at values file, I would like to avoid a duplicated maintenance of the values file and Chart.yaml file.

Describe the solution you'd like
I would like to use the helm template engine to render the annotation. Maybe a specific format of the from the NOTES.txt could be uses as source for metadata.

Describe alternatives you've considered
Add a new annotation which allows to override the Regex which is used in helm template parser.

containersImagesRE = regexp.MustCompile(`^\s+(?:-\s+)?image:\s+(\S+)`)

Additional context

prometheus-community/helm-charts#4161

@tegioz
Copy link
Collaborator

tegioz commented Jan 22, 2024

Hi @jkroepke 👋

Please note that Artifact Hub and Helm are two different projects. Artifact Hub supports Helm Charts, but also 20 additional artifact kinds (and growing!). To request new functionality to be added to the Helm CLI tool (i.e. extending the Helm template subcommand), it'd be better to open an issue on the Helm repository.

FYI there have been some discussions somehow related to this in the Helm repo (there is even a HIP). Until this is standardized, AH provides a mechanism to define these images using the annotation you mentioned in your comment. But that annotation is specific to Artifact Hub and not endorsed or supported by Helm in any way.

At the moment we do not have plans to make the regex we use for detecting images configurable. But it'd be great to have an external tool that was able to extract those images, something that could be used independently of AH -and that AH could rely on as well-. Maybe a Helm plugin? 😇

@tegioz
Copy link
Collaborator

tegioz commented Jan 22, 2024

(... I went looking for it and came back 😂)

Well, it looks like there is a Helm plugin for that in Artifact Hub! 😅

https://artifacthub.io/packages/helm-plugin/images/images

Maybe this could be helpful for the user who created the issue you shared (although not sure how it handles cases like the kube-prometheus-stack chart, I haven't tried it yet).

@jkroepke
Copy link
Author

Please note that Artifact Hub and Helm are two different projects

I'm aware of this. I was not asking new helm features (because this is pointless and maintainers are more ignorant; even after hours of writing a HIP - nothing happens), my scope had more the request to produce more accurate results for this:

image

I'm also aware of helm images plugin which I used in history.

But if I have an operator like

spec:
  containers:
    - name: kube-prometheus-stack
      image: "quay.io/prometheus-operator/prometheus-operator:v0.68.0"
      imagePullPolicy: "IfNotPresent"
      args:
        - --prometheus-config-reloader=quay.io/prometheus-operator/prometheus-config-reloader:v0.68.0
        - --thanos-default-base-image=quay.io/thanos/thanos:v0.32.4

how I could transfer the information to Artifact Hub and enrich the list of images?


Until this is standardized, AH provides a mechanism to define these images using the annotation you mentioned in your comment. But that annotation is specific to Artifact Hub and not endorsed or supported by Helm in any way.

This is fine, the target of the request is current AH exclusivity, otherwise I would not open an issue here. Tbh, I do not expect that this get ever standardized, since the development of new features is slow as a tortoise.

@tegioz
Copy link
Collaborator

tegioz commented Jan 23, 2024

how I could transfer the information to Artifact Hub and enrich the list of images?

You'd need to use the artifacthub.io/images annotation. To avoid the duplicated maintenance of the images in the values.yaml and Chart.yaml files, you'd need to setup some sort of custom automation.

Some tools that may assist with this task:

https://github.com/Cray-HPE/chart-metadata#update-artifacthubioimages-annotation
https://github.com/vmware-labs/distribution-tooling-for-helm#annotating-a-helm-chart-experimental

@jkroepke
Copy link
Author

And now ask (as part of this festure request), if the annotations can be moved to a place, e.g. NOTES.txt where I can use the helm template engine to generate the annotation list?

@tegioz
Copy link
Collaborator

tegioz commented Jan 23, 2024

Annotations in the Chart.yml file are a standard Helm mechanism to add custom metadata to a Chart. We support quite a few more in addition to the images one, and other tools (i.e. like the ones mentioned above) and plenty of users may rely on them as well.

I don't think moving them to a non-standard location (or adding support for an additional arbitrary location) just for the sake of generating one of them in a particular way would be a good idea TBH.

@jkroepke
Copy link
Author

Okay, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants