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

Add Ability to Set Tags on StorageClass, Expand Range of Characters Supported in Tags #700

Conversation

jonathanrainer
Copy link
Contributor

@jonathanrainer jonathanrainer commented May 27, 2022

Is this a bug fix or adding new feature?
This allows users to set tags on the StorageClass so they can have more granular tagging for their accessPoints should they desire, this addresses the feature requested in #692. In doing so the parsing of tags has been expanded to include characters like ':' and ' ' and so addresses #613 as well. It doesn't go quite as far as the issue suggests (i.e. aligning with the EBS driver on a standard) but it allows tags to have ':' and ' ' in them with a modicum of effort on the part of the user. That being said if we did decide in future we wanted to align and both use "=" and the key/value separator and "," as the tag separator because they're pulled out into constants that would not be very difficult.

What is this PR about? / Why do we need it?
This PR allows users to specify tags on StorageClasses and further, where tags could be specified previously, they can now include spaces, and colons as well as all the other special characters dictated by the AWS standard: https://docs.aws.amazon.com/general/latest/gr/aws_tagging.html and https://docs.aws.amazon.com/efs/latest/ug/manage-fs-tags.html

What testing is done?
I have added extra Unit tests to cover this behaviour. If it needs extra E2E tests adding please let me know

fixes #613

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 27, 2022
@k8s-ci-robot
Copy link
Contributor

Hi @jonathanrainer. 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 needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label May 27, 2022
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 27, 2022
@jonathanrainer jonathanrainer changed the title Support spaces in Controller Tags Add Ability to Set Tags on StorageClass, Expand Range of Characters Supported in Tags May 28, 2022
@jonathanrainer
Copy link
Contributor Author

jonathanrainer commented Jun 12, 2022

I have End-To-End tested this myself in an EKS cluster. Installed the driver with the following helm overrides

controller:
  tags:
    environment: prod
    region: us-east-1
    "'I have spaces'": "'and:I:have:colons'"

Then created a StorageClass to facilitate dynamic provisioning like so:

allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  creationTimestamp: "2022-06-12T08:40:57Z"
  labels:
    provisioning-type: dynamic
  name: efs-dynamic
  resourceVersion: "13482"
  uid: eb329bc4-8a69-4a02-b523-3648cdb7ec67
parameters:
  basePath: /dynamic
  directoryPerms: "777"
  extraTags: SCTag:'Look at the spaces'
  fileSystemId: fs-0a2f099fa92ff360d
  gidRangeEnd: "2000"
  gidRangeStart: "1000"
  provisioningMode: efs-ap
provisioner: efs.csi.aws.com
reclaimPolicy: Delete
volumeBindingMode: Immediate

Created a PVC in the cluster to kickoff dynamic provisioning and it created an Access Point with the following tags:
Screenshot 2022-06-12 at 09 35 18

Then tweaked the Chart Overrides:

controller:
  tags:
    environment: prod
    region: us-east-1
    "'I have spaces'": "'and:I:have:colons'"
    OverrideMe: foo

And the StorageClass to show the overriding behaviour:

allowVolumeExpansion: true
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
  creationTimestamp: "2022-06-12T08:40:57Z"
  labels:
    provisioning-type: dynamic
  name: efs-dynamic
  resourceVersion: "13482"
  uid: eb329bc4-8a69-4a02-b523-3648cdb7ec67
parameters:
  basePath: /dynamic
  directoryPerms: "777"
  extraTags: SCTag:'Look at the spaces' OverrideMe:bar
  fileSystemId: fs-0a2f099fa92ff360d
  gidRangeEnd: "2000"
  gidRangeStart: "1000"
  provisioningMode: efs-ap
provisioner: efs.csi.aws.com
reclaimPolicy: Delete
volumeBindingMode: Immediate

And then got the following tags in AWS:
Screenshot 2022-06-12 at 09 48 05

So very happy to say that this works exactly as expected, you can pass tags with spaces and colons through the values.yaml, which resolves #613, or you can have them on a per-StorageClass basis, with the more specific StorageClass tags overriding the more general tags defined on the Controller, which addresses part of #692.

@jonathanrainer jonathanrainer force-pushed the support-spaces-in-tags branch 2 times, most recently from c2518dc to d286c25 Compare June 16, 2022 19:29
@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 12, 2022
@Ben-Mark
Copy link

Before fixing the conflicts,
will this PR support the below functionality like the ebs storage class has?

ebs storageclass can auto add the tags like this:
parameters:
tagSpecification_1: "pvc_namespace={{ .PVCNamespace }}"
tagSpecification_2: "pvc_service={{ .PVCService }}"
tagSpecification_3: "pvc_name={{ .PVCName }}"
tagSpecification_4: "pv_name={{ .PVName }}"

would efs storageclass allow it as well like this?
parameters:
extraTags: "pvc_namespace={{ .PVCNamespace }} pvc_service={{ .PVCService }} pvc_name={{ .PVCName }} pv_name={{ .PVName }}

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 30, 2022
@jonathanrainer
Copy link
Contributor Author

@Ben-Mark I'm not sure that the functionality described is the best fit for this PR, but I think #689 does what you want?

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle stale
  • Mark this issue or PR as rotten with /lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Dec 29, 2022
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages issues and PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the issue is closed

You can:

  • Mark this issue or PR as fresh with /remove-lifecycle rotten
  • Close this issue or PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Jan 28, 2023
@jonathanrainer
Copy link
Contributor Author

/remove-lifecycle rotten

@k8s-ci-robot k8s-ci-robot removed the lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. label Feb 4, 2023
@jonathanrainer
Copy link
Contributor Author

@Ashley-wenyizha Could we get an ok to test here as well?

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 1, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: jonathanrainer
Once this PR has been reviewed and has the lgtm label, please assign d-nishi for approval. For more information see the Kubernetes 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

@k8s-ci-robot k8s-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 12, 2023
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

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 needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 15, 2023
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Jan 21, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle rotten
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle rotten

@k8s-ci-robot k8s-ci-robot added lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. and removed lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. labels Feb 20, 2024
@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

@k8s-ci-robot
Copy link
Contributor

@k8s-triage-robot: Closed this PR.

In response to this:

The Kubernetes project currently lacks enough active contributors to adequately respond to all issues and PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Reopen this PR with /reopen
  • Mark this PR as fresh with /remove-lifecycle rotten
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/close

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.

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. lifecycle/rotten Denotes an issue or PR that has aged beyond stale and will be auto-closed. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helm: No support for tags with spaces
4 participants