Skip to content

Adding Proper Handling of VAC Tags On Volume Creation #2457

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

Closed
wants to merge 1 commit into from

Conversation

mdzraf
Copy link
Contributor

@mdzraf mdzraf commented Apr 30, 2025

What type of PR is this?

/kind feature

What is this PR about? / Why do we need it?

This PR adds proper handling of creating a PVC with a specified volumeAttributesClassName so that the tags specified in the VAC are on the created volume.

Closes #2442

How was this change tested?

Used the following resource configurations and then ran aws ec2 describe-volumes with the created volume-id to make sure that the tags specified in the VAC were added.

---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  name: ebs-sc
provisioner: ebs.csi.aws.com
volumeBindingMode: WaitForFirstConsumer
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: ebs-claim
spec:
  accessModes:
    - ReadWriteOnce
  storageClassName: ebs-sc
  volumeAttributesClassName: io2-class
  resources:
    requests:
      storage: 10Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: app
spec:
  containers:
  - name: app
    image: public.ecr.aws/amazonlinux/amazonlinux
    command: ["/bin/sh"]
    args: ["-c", "while true; do echo $(date -u) | tee /data/out.txt; sleep 5; done"]
    volumeMounts:
    - name: persistent-storage
      mountPath: /data
  volumes:
  - name: persistent-storage
    persistentVolumeClaim:
      claimName: ebs-claim
---
apiVersion: storage.k8s.io/v1beta1
kind: VolumeAttributesClass
metadata:
  name: io2-class
driverName: ebs.csi.aws.com
parameters:
  type: io2
  iops: "3000"
  tagSpecification_1: "pvcnamespaceTEST={{ .PVCNamespace }}"
  tagSpecification_2: "pvcnameTEST={{ .PVCName }}"
  tagSpecification_3: "pvnameTEST={{ .PVName }}"
  tagSpecification_4: "location=Seattle"
  tagSpecification_5: "cost-center="

Does this PR introduce a user-facing change?

Added Proper Handling To Ensure Tags Added in a VAC Which a PVC Points To Get Added to the Provisioned Volume

@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels Apr 30, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @mdzraf. 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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels Apr 30, 2025
@ConnorJC3
Copy link
Contributor

/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 Apr 30, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from connorjc3. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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

@mdzraf mdzraf changed the title Fix for issue #2442 [WIP] Fix for issue #2442 Apr 30, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Apr 30, 2025
Copy link
Contributor

@ConnorJC3 ConnorJC3 left a comment

Choose a reason for hiding this comment

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

Maybe worth adding a simple unit test? Otherwise /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, 2025
@mdzraf
Copy link
Contributor Author

mdzraf commented May 1, 2025

Working on adding fix to be able to use string interpolation before merging

@mdzraf mdzraf force-pushed the vacTagsOnProvisionFix branch from b3b1123 to 9adf294 Compare May 1, 2025 15:56
@k8s-ci-robot k8s-ci-robot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. and removed lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 1, 2025
@rdpsin
Copy link
Contributor

rdpsin commented May 1, 2025

Can you also update the commit title to be more descriptive, for posterity.

@mdzraf
Copy link
Contributor Author

mdzraf commented May 2, 2025

/retest

Copy link

github-actions bot commented May 2, 2025

Code Coverage Diff

File Old Coverage New Coverage Delta
github.com/kubernetes-sigs/aws-ebs-csi-driver/pkg/driver/controller.go 83.8% 83.1% -0.7

@mdzraf mdzraf changed the title [WIP] Fix for issue #2442 [WIP] Adding Proper Handling of VAC Tags On Volume Creation May 2, 2025
@mdzraf mdzraf force-pushed the vacTagsOnProvisionFix branch from 9adf294 to c9cee53 Compare May 2, 2025 15:38
Copy link
Member

@torredil torredil left a comment

Choose a reason for hiding this comment

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

/lgtm

Manually tested latest revision with the example manifests provided, works with string interpolation:

"Tags": [
       {
            "Key": "pvcnamespaceTEST",
             "Value": "default"
       },
       {
           "Key": "pvnameTEST",
            "Value": "pvc-0287221a-8e65-4e11-8eff-1553a0c4e764"
        },
         {
             "Key": "CSIVolumeName",
              "Value": "pvc-0287221a-8e65-4e11-8eff-1553a0c4e764"
         },
         {
             "Key": "kubernetes.io/created-for/pvc/name",
              "Value": "ebs-claim"
         },
         ....

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label May 2, 2025
@mdzraf mdzraf changed the title [WIP] Adding Proper Handling of VAC Tags On Volume Creation Adding Proper Handling of VAC Tags On Volume Creation May 2, 2025
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 2, 2025
@mdzraf
Copy link
Contributor Author

mdzraf commented May 6, 2025

/hold Waiting on decision to refactor tag templating logic

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 6, 2025
@mdzraf
Copy link
Contributor Author

mdzraf commented May 13, 2025

New PR (#2470) to handle VAC and Controller tags on creation is replacing this one

@mdzraf mdzraf closed this May 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/feature Categorizes issue or PR as related to a new feature. 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/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VAC tags should appear on volumes created with VAC
6 participants