Skip to content

improving extraVolumeTags validation to follow EC2 tagging convention #2504

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

Merged
merged 2 commits into from
Jun 13, 2025

Conversation

hrdkmshra
Copy link
Contributor

@hrdkmshra hrdkmshra commented May 22, 2025

What type of PR is this?

/kind bug

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

We need this PR to improve our extraVolumeTags validation to follow EC2 tagging convention as described here
This PR addresses #2491

How was this change tested?

cd aws-ebs-csi-driver/charts/aws-ebs-csi-driver

helm template . -f test-file.yaml --debug | grep "extra-tag"

created 3 files

  1. valid-test-values.yaml
controller:
  extraVolumeTags:
    # Normal valid cases
    normal-key: "normal-value"
    with.dot: "value.with.dot"
    with_underscore: "value_with_underscore"
    with-hyphen: "value-with-hyphen"
    withNumber123: "value123"
    UPPERCASE: "UPPERCASE_VALUE"
    "key:with:colon": "value:with:colon"
    "key@with@at": "value@with@at"
    "key/with/slash": "value/with/slash"
    "unicode_key_测试": "unicode_value_测试"
    
    # Edge cases that look like aws: but are valid
    awstest: "valid"
    aws-test: "valid"
    aws.test: "valid"
    aws_test: "valid"
    AWStest: "valid"
    awsS: "valid"
    awSs: "valid"
    
    # Length limit edge cases
    "k": "single-char-key"  # minimum key length (1)
    normalkey: ""  # empty value (allowed)
    "kxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx": "valid"  # exactly 128 chars
    shortkey: "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv1234"  # exactly 256 chars

    # Special characters in values
    special-chars: "value;with;semicolons"
    more-special: "value/with/slashes"
    even-more: "value with spaces"
    symbols: "!@#$%^&*()"
  1. invalid-test-value.yaml
controller:
  extraVolumeTags:
  
    # Invalid aws: prefix cases (all case combinations)
    aws:test: "value"
    AWS:test: "value"
    Aws:test: "value"
    aWs:test: "value"
    awS:test: "value"
    AwS:test: "value"
    aWS:test: "value"
    AWs:test: "value"

    # Invalid length cases
    "": "empty-key-not-allowed"  # key too short (0 chars)
    "kxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx": "invalid"  # key too long (129 chars)
    toolong: "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv1234"  # value too long (257 chars)
  1. 51-tag.yaml
controller:
  extraVolumeTags:
    tag01: "value01"
    tag02: "value02"
    tag03: "value03"
    tag04: "value04"
    tag05: "value05"
    tag06: "value06"
    tag07: "value07"
    tag08: "value08"
    tag09: "value09"
    tag10: "value10"
    tag11: "value11"
    tag12: "value12"
    tag13: "value13"
    tag14: "value14"
    tag15: "value15"
    tag16: "value16"
    tag17: "value17"
    tag18: "value18"
    tag19: "value19"
    tag20: "value20"
    tag21: "value21"
    tag22: "value22"
    tag23: "value23"
    tag24: "value24"
    tag25: "value25"
    tag26: "value26"
    tag27: "value27"
    tag28: "value28"
    tag29: "value29"
    tag30: "value30"
    tag31: "value31"
    tag32: "value32"
    tag33: "value33"
    tag34: "value34"
    tag35: "value35"
    tag36: "value36"
    tag37: "value37"
    tag38: "value38"
    tag39: "value39"
    tag40: "value40"
    tag41: "value41"
    tag42: "value42"
    tag43: "value43"
    tag44: "value44"
    tag45: "value45"
    tag46: "value46"
    tag47: "value47"
    tag48: "value48"
    tag49: "value49"
    tag50: "value50"
    tag51: "value51"  # This makes it exceed 50 tags

Does this PR introduce a user-facing change?

Fixed the validation of `extraVolumeTags` to follow EC2 tagging requirements

edit :

I made another commit : 9db1ad1 :

as I was educated that all i was trying to do is already being validated is being done at validation.go so no need maxProperties and checking for "pattern": "^([^aA]|[aA][^wW]|[aA][wW][^sS]|[aA][wW][sS][^:])" so all the previous info in PR may not be of concern anymore.

happy to learn more from my mistake.

@k8s-ci-robot k8s-ci-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. labels May 22, 2025
@k8s-ci-robot
Copy link
Contributor

Welcome @hrdkmshra!

It looks like this is your first PR to kubernetes-sigs/aws-ebs-csi-driver 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/aws-ebs-csi-driver has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

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

Hi @hrdkmshra. 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 the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 22, 2025
@ElijahQuinones
Copy link
Member

/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 May 22, 2025
@mdzraf
Copy link
Contributor

mdzraf commented May 23, 2025

The change allows for any characters in the tags which is correct per EC2 documentation and also restricts the limits to the ones specified in the documentation as well.

Manually tested these changes and got expected results: See results here

Resolves #2491

/lgtm

@k8s-ci-robot
Copy link
Contributor

@mdzraf: changing LGTM is restricted to collaborators

In response to this:

The change allows for any characters in the tags which is correct per EC2 documentation and also restricts the limits to the ones specified in the documentation as well.

Manually tested these changes and got expected results: See results here

Closes #2491

/lgtm

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.

@mdzraf
Copy link
Contributor

mdzraf commented May 23, 2025

A few requests before final approval:

  1. Squash the old commits
  2. More descriptive final commit message, something like Improving extraVolumeTags validation to follow EC2 tagging convention
  3. Edit release note to better comply with release notes best practices, for example something like Fixed the validation of extraVolumeTags to follow EC2 tagging requirements

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. labels May 29, 2025
@k8s-ci-robot k8s-ci-robot added size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 29, 2025
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
/label tide/merge-method-squash

@k8s-ci-robot k8s-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Jun 13, 2025
@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 13, 2025
Copy link
Contributor

@AndrewSirenko AndrewSirenko left a comment

Choose a reason for hiding this comment

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

/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: AndrewSirenko

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 Jun 13, 2025
@k8s-ci-robot k8s-ci-robot merged commit 6d253b3 into kubernetes-sigs:master Jun 13, 2025
11 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. kind/bug Categorizes issue or PR as related to a bug. 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. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 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.

6 participants