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 chart] Allow passing template values for clusterName, region and vpcId #3664

Merged
merged 2 commits into from
May 7, 2024

Conversation

adriananeci
Copy link
Contributor

Issue

Helm doesn't support currently passing user parameters of the parent chart to the subchart (without using global)
See helm/helm#6699 and helm/helm#6876 for more context

Description of changes

While using the aws-load-balancer-controller as a dependency for another chart , I found it difficult to pass a global or a dynamic value for the clusterName, vpcId, region and other fields.

This PR adds support for passing a template as value for the clusterName, vpcId and region field.

Initial PR was raised in aws/eks-charts#911

Checklist

  • Added/modified documentation as required (such as the README.md for modified charts)
  • Incremented the chart version in Chart.yaml for the modified chart(s)
  • Manually tested. Describe what testing was done in the testing section below
  • Make sure the title of the PR is a good description that can go into the release notes

Testing

I've tested it by passing both static value and dynamic ones as follow:

  • for static values, nothing has changed, e.g.

    • values.yaml :
    clusterName: "aa"
    
    • helm template --debug .
    ..............
     containers:
          - name: aws-load-balancer-controller
            args:
            - --cluster-name=aa
            - --ingress-class=alb
            command:
            - /controller
    ..............
    
  • for template value:

    • values.yaml:
    ........
    clusterName: "{{- .Values.global.clusterName }}"
    ........
    
    • helm template --debug --set global.clusterName=ethos000-sbx-va6 .
    ..............
    containers:
        - name: aws-load-balancer-controller
          args:
          - --cluster-name=ethos000-sbx-va6
          - --ingress-class=alb
          command:
          - /controller
    ..............
    
  • for empty/unset clusterName value:

    • helm template --debug .
install.go:194: [debug] Original chart version: ""
install.go:211: [debug] CHART PATH: /test-chart

Error: execution error at (test-chart/charts/aws-load-balancer-controller/templates/deployment.yaml:61:28): Chart cannot be installed without a valid clusterName!
helm.go:84: [debug] execution error at (/test-chart/charts/aws-load-balancer-controller/templates/deployment.yaml:61:28): Chart cannot be installed without a valid clusterName!

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Apr 24, 2024
@k8s-ci-robot k8s-ci-robot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Apr 24, 2024
@adriananeci
Copy link
Contributor Author

Dependency Review / govulncheck (pull_request) PR check failure doesn't seem related to changes from this PR if I read the logs right

@adriananeci
Copy link
Contributor Author

/assign @M00nF1sh

@shraddhabang
Copy link
Collaborator

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Apr 30, 2024
@oliviassss
Copy link
Collaborator

oliviassss commented May 6, 2024

Dependency Review / govulncheck (pull_request) PR check failure doesn't seem related to changes from this PR if I read the logs right

@adriananeci, correct, it's another issue we will address later. can you please address the comments so we can merge your PR?

@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2024
@adriananeci
Copy link
Contributor Author

Dependency Review / govulncheck (pull_request) PR check failure doesn't seem related to changes from this PR if I read the logs right

@adriananeci, correct, it's another issue we will address later. can you please address the comments so we can merge your PR?

Done

@oliviassss oliviassss added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label May 6, 2024
@oliviassss
Copy link
Collaborator

thanks for your contribution.

/lgtm
/approve

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 6, 2024
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adriananeci, oliviassss

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 6, 2024
@oliviassss oliviassss merged commit 615eac3 into kubernetes-sigs:main May 7, 2024
7 of 9 checks passed
@adriananeci adriananeci deleted the add_tpl branch May 20, 2024 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants