aws-efs-csi-driver icon indicating copy to clipboard operation
aws-efs-csi-driver copied to clipboard

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

Open jonathanrainer opened this issue 2 years ago • 12 comments

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

jonathanrainer avatar May 27 '22 20:05 jonathanrainer

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 avatar May 27 '22 20:05 k8s-ci-robot

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 avatar Jun 12 '22 08:06 jonathanrainer

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 }}

Ben-Mark avatar Aug 28 '22 14:08 Ben-Mark

[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 by writing /assign @d-nishi in a comment. 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 avatar Sep 30 '22 21:09 k8s-ci-robot

@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?

jonathanrainer avatar Sep 30 '22 21:09 jonathanrainer

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-triage-robot avatar Dec 29 '22 21:12 k8s-triage-robot

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-triage-robot avatar Jan 28 '23 22:01 k8s-triage-robot

/remove-lifecycle rotten

jonathanrainer avatar Feb 04 '23 06:02 jonathanrainer

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

jonathanrainer avatar Feb 04 '23 06:02 jonathanrainer

[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 avatar Aug 12 '23 16:08 k8s-ci-robot

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 avatar Aug 15 '23 05:08 k8s-ci-robot

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-triage-robot avatar Jan 21 '24 01:01 k8s-triage-robot

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-triage-robot avatar Feb 20 '24 01:02 k8s-triage-robot

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-triage-robot avatar Mar 21 '24 02:03 k8s-triage-robot

@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.

k8s-ci-robot avatar Mar 21 '24 02:03 k8s-ci-robot