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

Bug 2236387: Regenerate ACM Policy Name Resource When Length Exceeds 62 Characters #136

Conversation

raghavendra-talur
Copy link
Collaborator

This pull request addresses an issue where the ACM policy name, combined with the namespace, exceeds the limit of 62 characters, as specified here. To comply with this limitation, we introduce logic to regenerate the policy name when necessary.

Changes Made:

We check whether the concatenation of the policy name and the namespace exceeds 62 characters.
If the total length is within the limit, the name remains unchanged.
If the total length exceeds 62 characters, we follow these steps:
Calculate an MD5 hash of the original name.
Prepend the hash with vs-secret- to create a new name.
Trim the new name to fit within the limit by removing characters from the end of the hash, up to (62 characters minus the length of the namespace). If the end result is less than 14 characters (length of vs-secret- plus 3 chars buffer), then we do nothing.
Examples:

Example 1:

Original Name: my-policy-name-vs-secret (24 characters)
Namespace: my-policy-namespace (19 characters)
Total Length: 43 characters (within the 62-character limit)
Result: The name remains unchanged.
Example 2:

Original Name: my-policy-name-pppppppppppppppppppp-vs-secret (45 characters)
Namespace: my-policy-namespace-pppppppppppppppppppp (40 characters)
Total Length: 85 characters (exceeds the 62-character limit)
Result:
MD5 Hash of Original Name: vs-secret-dd7542bf4c870b8b16777913b492e145
New Name: vs-secret-dd7542bf4c87 (22 characters)
Final Result: The name is trimmed to vs-secret-dd7542bf4c87
Example 3:

Original Name: my-policy-name--vs-secret (24 characters)
Namespace: my-policy-namespace-ppppppppppppppppppppaaaaaaaaaaaaaaaaaaaaaa (62 characters)
Total Length: 86 characters (exceeds the 62-character limit)
Result: Both the name and namespace are used as-is, as no changes are enforced, and we expect it to fail as it does today.
Fixes bz 2236387

@openshift-ci
Copy link

openshift-ci bot commented Sep 11, 2023

@raghavendra-talur: No Bugzilla bug is referenced in the title of this pull request.
To reference a bug, add 'Bug XXX:' to the title of this pull request and request another bug refresh with /bugzilla refresh.

In response to this:

Regenerate ACM Policy Name Resource When Length Exceeds 62 Characters

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.

@openshift-ci
Copy link

openshift-ci bot commented Sep 11, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: raghavendra-talur

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

@raghavendra-talur raghavendra-talur changed the title Regenerate ACM Policy Name Resource When Length Exceeds 62 Characters Bug 2236387: Regenerate ACM Policy Name Resource When Length Exceeds 62 Characters Sep 12, 2023
@openshift-ci
Copy link

openshift-ci bot commented Sep 12, 2023

@raghavendra-talur: This pull request references Bugzilla bug 2236387, which is invalid:

  • expected the bug to target the "ODF 4.14.0" release, but it targets "---" instead

Comment /bugzilla refresh to re-evaluate validity if changes to the Bugzilla bug are made, or edit the title of this pull request to link to a different bug.

In response to this:

Bug 2236387: Regenerate ACM Policy Name Resource When Length Exceeds 62 Characters

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.

This commit addresses an issue where the ACM policy name, combined with the
namespace, exceeds the limit of 62 characters. The changes made are:
  1. We check whether the concatenation of the policy name and the namespace
     exceeds 62 characters.
  2. If the total length is within the limit, the name remains unchanged.
  3. If the total length exceeds 62 characters, we follow these steps:
     - Calculate an MD5 hash of the original name.
     - Prepend the hash with `vs-secret-` to create a new name.
     - Trim the new name to fit within the limit by removing characters from
       the end of the hash, up to (62 characters minus the length of the namespace).
       If the end result is less than 14 chars (length of "vs-secret-" plus 3 chars buffer),
       then we do nothing.

Signed-off-by: Benamar Mekhissi <[email protected]>
(cherry picked from commit ae7c1ca)
@raghavendra-talur
Copy link
Collaborator Author

/bugzilla refresh

@openshift-ci
Copy link

openshift-ci bot commented Sep 12, 2023

@raghavendra-talur: This pull request references Bugzilla bug 2236387, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (ODF 4.14.0) matches configured target release for branch (ODF 4.14.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @keesturam

In response to this:

/bugzilla refresh

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.

@openshift-ci
Copy link

openshift-ci bot commented Sep 12, 2023

@openshift-ci[bot]: GitHub didn't allow me to request PR reviews from the following users: keesturam.

Note that only red-hat-storage members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

@raghavendra-talur: This pull request references Bugzilla bug 2236387, which is valid. The bug has been moved to the POST state. The bug has been updated to refer to the pull request using the external bug tracker.

3 validation(s) were run on this bug
  • bug is open, matching expected state (open)
  • bug target release (ODF 4.14.0) matches configured target release for branch (ODF 4.14.0)
  • bug is in the state ASSIGNED, which is one of the valid states (NEW, ASSIGNED, ON_DEV, POST, POST)

Requesting review from QA contact:
/cc @keesturam

In response to this:

/bugzilla refresh

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.

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.

@raghavendra-talur raghavendra-talur merged commit e55e62b into red-hat-storage:release-4.14 Sep 12, 2023
12 checks passed
@openshift-ci
Copy link

openshift-ci bot commented Sep 12, 2023

@raghavendra-talur: All pull requests linked via external trackers have merged:

Bugzilla bug 2236387 has been moved to the MODIFIED state.

In response to this:

Bug 2236387: Regenerate ACM Policy Name Resource When Length Exceeds 62 Characters

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.

@raghavendra-talur raghavendra-talur deleted the rtalur-backport-1060 branch September 12, 2023 05:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant