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

[ebs-csi-controller] Allow passing template value for clusterName #1753

Merged

Conversation

monicastanciu
Copy link
Contributor

Is this a bug fix or adding new feature? & What is this PR about? / Why do we need it?
This is a new feature. While using the aws-ebs-csi-driver as a dependency for another chart , I found it difficult to pass a global or a dynamic value for the clusterName related fields. This PR adds support for passing a template as value for podAnnotations and k8sTagClusterId fields.

What testing is done?
I've tested it by passing both static value and dynamic ones as follow:

  • for the current values (empty/unset) nothing has changed:
    values.yaml
k8sTagClusterId:
podAnnotations: {}

helm template --debug . output: no podAnnotations added and no argument

  • for static values
    values.yaml
k8sTagClusterId: "cluster"
podAnnotations:
   test.annotation: test

helm template --debug .

...........................
    annotations:
        test.annotation: test
..........................
      containers:
        - name: ebs-plugin
          image: public.ecr.aws/ebs-csi-driver/aws-ebs-csi-driver:v1.23.0
          imagePullPolicy: IfNotPresent
          args:
            - controller
            - --endpoint=$(CSI_ENDPOINT)
            - --k8s-tag-cluster-id=cluster
            - --logging-format=text
            - --user-agent-extra=helm
            - --v=2
  • for template values
    values.yaml
k8sTagClusterId: "{{- .Values.global.clusterName }}-k8s-eks"
podAnnotations:
   iam.amazonaws.com/role: arn:aws:iam::{{ .Values.global.accountId }}:role/{{ .Values.global.clusterName }}
   test.annotation: test

helm template --set global.clusterName=cluster01-dev-va6 --set global.accountId=1234567 .

...........................
      annotations:
        iam.amazonaws.com/role: arn:aws:iam::1234567:role/cluster01-dev-va6
        test.annotation: test
.....................
          args:
            - controller
            - --endpoint=$(CSI_ENDPOINT)
            - --k8s-tag-cluster-id=cluster01-dev-va6-k8s-eks
            - --logging-format=text
            - --user-agent-extra=helm
            - --v=2

@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 21, 2023
@k8s-ci-robot
Copy link
Contributor

Hi @monicastanciu. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Sep 21, 2023
@AndrewSirenko
Copy link
Contributor

AndrewSirenko commented Sep 22, 2023

Thank you for the thoughtful contribution and comprehensive testing! I'll run our CI now.
/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 22, 2023
@ConnorJC3
Copy link
Contributor

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Sep 22, 2023
@ConnorJC3
Copy link
Contributor

/retest

@torredil
Copy link
Member

Thank you for your contribution @monicastanciu
/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: torredil

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 Sep 22, 2023
@ConnorJC3
Copy link
Contributor

/retest

@k8s-ci-robot k8s-ci-robot merged commit 6fe468b into kubernetes-sigs:master Sep 23, 2023
4 checks passed
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. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants