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-operator: support go text/template evaluation in override values #5105

Merged

Conversation

joelanford
Copy link
Member

Description of the change:
Support text/template expansion of helm-operator overrideValues.

Motivation for the change:
In some cases, environment variables need to be parsed to be used in helm charts, especially in dependent charts that helm-operator authors have less (or zero) control over.

For example, with this change it is possible to split a fully qualified image repo:tag into separate repo and tag values to pass to helm as values:

Environment:

export MY_IMAGE="quay.io/operator-framework/helm-operator:latest"

Input values:

overrideValues:
  repo: '{{ ("$MY_IMAGE" | split ":")._0 }}'
  tag: '{{ ("$MY_IMAGE" | split ":")._1 }}'

Expanded values:

overrideValues:
  repo: "quay.io/operator-framework/helm-operator"
  tag: "latest"

/cc @madorn

Checklist

If the pull request includes user-facing changes, extra documentation is required:

@joelanford joelanford added kind/feature Categorizes issue or PR as related to a new feature. language/helm Issue is related to a Helm operator project labels Aug 2, 2021
@openshift-ci openshift-ci bot requested a review from madorn August 2, 2021 15:42
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
@estroz
Copy link
Member

estroz commented Aug 2, 2021

Can you add a line or two about which text functions can be used to https://master.sdk.operatorframework.io/docs/building-operators/helm/reference/advanced_features/override_values/

Copy link
Member

@estroz estroz left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2021
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
@openshift-ci
Copy link

openshift-ci bot commented Aug 3, 2021

New changes are detected. LGTM label has been removed.

@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Aug 3, 2021
@estroz estroz merged commit 1557215 into operator-framework:master Aug 4, 2021
@joelanford joelanford deleted the helm-overrides-template branch August 6, 2021 04:54
bentito pushed a commit to bentito/operator-sdk that referenced this pull request Aug 24, 2021
…operator-framework#5105)

* support go text/template evaluation in override values
* add documentation for templating in helm override values

Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
twasyl pushed a commit to twasyl/operator-sdk that referenced this pull request Sep 3, 2021
…operator-framework#5105)

* support go text/template evaluation in override values
* add documentation for templating in helm override values

Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
Signed-off-by: Thierry Wasylczenko <thierry.wasylczenko@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature. language/helm Issue is related to a Helm operator project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants