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

feat(helm): add valueFiles field to specify custom value files #1099

Merged
merged 3 commits into from
Aug 19, 2019

Conversation

edvald
Copy link
Collaborator

@edvald edvald commented Aug 13, 2019

What this PR does / why we need it:

Previously you could only (easily) provide custom values to charts via the values key. Having different value files based on context/environment is a pretty common practice with Helm, so we should enable that.

You could for example have a base values file with defaults, and then a custom one based on environment:

kind: Module
type: helm
...
valueFiles:
  - values.common.yaml
  - values.${environment.name}.yaml

You can still use the current values field, which will take precedence over the files listed under valueFiles.

Which issue(s) this PR fixes:

Closes #1098

Special notes for your reviewer:

See if the docs and the schema makes sense, as documented.

Does this PR introduce a user-facing change?:

Yes

Copy link
Collaborator

@eysi09 eysi09 left a comment

Choose a reason for hiding this comment

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

Couple of minor comments, mostly regarding doc text.

key: some-value
```

This will effectively create a new YAML with the supplies values and pass it to Helm when rendering/deploying the chart. This is particularly handy when you want to template in the values (see the next section for a good example).
Copy link
Collaborator

Choose a reason for hiding this comment

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

supplies => supplied

key: prod-value
```

In this example, `some.key` is set to `"prod-value"` for the `prod` environment, and `other.key` keep the default value set in `values.default.yaml`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

keep => keeps. Or maybe better, maintains.


In this example, `some.key` is set to `"prod-value"` for the `prod` environment, and `other.key` keep the default value set in `values.default.yaml`.

If you were to also set the `values` field in the Module configuration, the values there would take precedence over both of the value files.
Copy link
Collaborator

Choose a reason for hiding this comment

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

May drop the "hypothetical past tense" (or whatever it's called) and just say: "If you also set the values field [...], the values there take..."

in \`valueFiles\`).
`),
valueFiles: joiArray(joi.string().posixPath({ subPathOnly: true }))
.description(dedent`
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this be deline? Noticed some extra new lines in the generated doc above (although not visible to when rendered as markdown).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, that'll bunch up all the paragraphs, right? It's too much text for a single paragraph imo.

const chartPath = await getChartPath(module)
const gardenValuesPath = getGardenValuesPath(chartPath)

const valueFiles = module.spec.valueFiles
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you add a comment saying that the gardenValuesPath takes precedence over the other value files and is therefore appended last.

@eysi09 eysi09 added this to the v0.10.6 milestone Aug 19, 2019
@edvald
Copy link
Collaborator Author

edvald commented Aug 19, 2019

Addressed the comments, to be squashed on merge.

@edvald edvald merged commit ca47483 into master Aug 19, 2019
@edvald edvald deleted the helm-value-files branch August 19, 2019 16:23
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 this pull request may close these issues.

Permit to get values from files when using helm module
2 participants