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

Added support to pass values to sub-charts via map.yaml #8580

Closed
wants to merge 1 commit into from
Closed

Added support to pass values to sub-charts via map.yaml #8580

wants to merge 1 commit into from

Conversation

jorgecarleitao
Copy link

@jorgecarleitao jorgecarleitao commented Aug 11, 2020

What this PR does / why we need it:

This PR allows developers to declare a map.yaml file on their chart, which can be used to map values in values.yaml to derived values that are used in templating, including sub-charts (see #8576 for the long explanation). This allows developers to write e.g.

apiVersion: v1
description: Chart with map and subcharts
name: chart-with-map
version: 0.0.1
dependencies:
  - name: backend
    version: 0.0.1
  - name: frontend
    version: 0.0.1
# values.yaml
domain: example.com
# map.yaml
backend:
  uri: {{ printf "https://api.%s" .Values.domain }}

frontend:
  uri: {{ printf "https://app.%s" .Values.domain }}

other_uri: {{ printf "https://blabla.%s" .Values.domain }}

thereby not having to expose backend: uri, frontend: uri in values.yaml (for the subchart), nor ask chart users to have to pass the same value in multiple keys for consistency (or use global names that lead to naming collisions).

I.e. it allows subcharts to be populated with derived (or maped) values without exposing these values to values.yaml (the public interface of the chart).

This solves a long standing issue of being very painful to pass values to subcharts that derive values in values.yaml (more details in #8576). Closes #8576.

Special notes for your reviewer: This PR is not complete yet: this is part of the proposal, and is intended to demonstrate how the proposal is implemented in practice. There are at least three issues to address, two documented as # todo, plus associated documentation.

To run the example,

make build
./bin/helm install test --debug --dry-run cmd/helm/testdata/testcharts/chart-with-map/

which leads to the manifest

---
# Source: chart-with-map/charts/subchart/templates/test1.yaml
apiVersion: v1
kind: Pod
metadata:
    name: "aaa"
    labels:
        derived: aa-a
        default: aa
---
# Source: chart-with-map/templates/test1.yaml
apiVersion: v1
kind: Pod
metadata:
    name: "aaa"
    labels:
        derived: a-a
        public1: a

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

@helm-bot helm-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 11, 2020
Signed-off-by: Jorge C. Leitao <jorgecarleitao@gmail.com>
@TBBle
Copy link
Contributor

TBBle commented Aug 29, 2020

As a note, by doing this work in recAllTpls, import-values won't be able to see the data from map.yaml as chartutil.ProcessDependencies calls processImportValues much earlier in the flow.

Copy link
Member

@bacongobbler bacongobbler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jorgecarleitao. We're asking new proposals to first write up a Helm Improvement Proposal, also known as a HIP. This gives the maintainers an opportunity to consider the design of the proposal and iron out any design kinks before a reference implementation is provided. This saves both you and us time in the long run.

Please have a read through https://github.com/helm/community/blob/master/hips/hip-0001.md and let me know if you have any questions.

@m-yosefpor
Copy link

any progress on this?

@bacongobbler
Copy link
Member

No further progress has been made since chnages were requested 12 months ago. Closing as stale.

@agates4
Copy link

agates4 commented Mar 14, 2022

@jorgecarleitao please don't give up. :)

@treksler
Copy link

Expecting anyone who is capable and willing to write code (for free) to write an HIP document instead is nuts. Like 100% nuts. If you have a problem where people are writing code that seems like it is coming out of left field, then you have lost touch with your user base, not the other way around.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backward-compatible proposal to pass values to sub-charts by supporting value constraints
7 participants