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

Including files in a helm package - is this possible? #74

Open
msmithson-roku opened this issue Apr 2, 2024 · 7 comments
Open

Including files in a helm package - is this possible? #74

msmithson-roku opened this issue Apr 2, 2024 · 7 comments
Labels
enhancement New feature or request

Comments

@msmithson-roku
Copy link

Helm allows you to load files using .Files.get - https://helm.sh/docs/chart_template_guide/accessing_files/

I can't work out a way to include files in the chart root folder using helm_package (other than Chart.yaml or values.yaml). Without this rules_helm can't be used with chart that use .Files.get as this is not allowed to access files in the templates folder.

Is there a way to do this that I can missing?

@abrisco
Copy link
Owner

abrisco commented Apr 22, 2024

This should work as long as the files are inputs to the rule. Can you provide an example of something that works with helm directly but not in rules_helm?

@msmithson-roku
Copy link
Author

msmithson-roku commented Apr 23, 2024

As far as I can see helm_package does not allow you to specify inputs - other the chart, values or templates.

Try to specify inputs or add the additional files to deps causes errors.

An example is specifying a ConfigMap where the data comes from a file. e.g.

apiVersion: v1
kind: ConfigMap
metadata:
  name: {{ .Values.name }}-mappings
  namespace: {{ .Release.Namespace }}
  labels:
    app: {{ .Values.name }}
data:
  mappings.yaml: |-
    {{- .Files.Get "mappings.yaml" | trimSuffix "\n" | nindent 4 }}

For this to work mappings.yaml needs to packaged with the Chart (and not in the templates folder). I can't find a way to do this with rules_helm.

At the moment we are using pkg_tar to add these files to the chart created using helm_package and then using helm_import so we can use it a chart in other rules. Not ideal.

@iDiogenes
Copy link
Contributor

@msmithson-roku - It sounds like this is your issue? #70

@msmithson-roku
Copy link
Author

#70 allows templates from multiple locations to be packaged into a chart under the templates folder (which is great!).

However for this use case, we need to include resources that will not be in the templates folder in the packaged chart. (helm specifically prevents you using .Files.Get for with resources that are in the templates folder)

@dormidon
Copy link
Contributor

dormidon commented Oct 1, 2024

Hello!
Please have a look at #102.
Would appreciate your feedback.

@abrisco
Copy link
Owner

abrisco commented Oct 7, 2024

Thanks! Sorry for the delay here. I'll take a look as soon as I have bandwidth!

@ashwin153
Copy link

@abrisco I'm also interested in including a values.schema.json file in my packaged chart. Let me know if I can help get this merged in any way.

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

5 participants