Skip to content

feature: add name length check for fedresourcequota #2168

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 1 commit into from
May 13, 2025

Conversation

likakuli
Copy link
Member

@likakuli likakuli commented Jul 11, 2022

Signed-off-by: likakuli [email protected]

What type of PR is this?
/kind feature

What this PR does / why we need it:

FedResourceQuota is a user-facing resource and its name is used in work's label. So the length should be no more than 63 characters like other resource. e.g. PropagationPolicy

Which issue(s) this PR fixes:
Fixes #
Part of #6350

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

`karmada-webhook`: The length of FederatedResourceQuota now has been restricted to no more than 63 chars.

@karmada-bot karmada-bot added the kind/bug Categorizes issue or PR as related to a bug. label Jul 11, 2022
@karmada-bot karmada-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jul 11, 2022
@likakuli likakuli force-pushed the feature_quotanamevalidate branch from a095d64 to cf1f058 Compare July 11, 2022 09:30
Copy link
Member

@XiShanYongYe-Chang XiShanYongYe-Chang left a comment

Choose a reason for hiding this comment

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

I think it makes sense to add this validation. However, it may be not a bug fix but only a verification enhancement.

@likakuli
Copy link
Member Author

I think it makes sense to add this validation. However, it may be not a bug fix but only a verification enhancement.

OK,let me update the kind.

@likakuli likakuli changed the title fix: add name length check for fedresourcequota feature: add name length check for fedresourcequota Jul 12, 2022
@XiShanYongYe-Chang
Copy link
Member

This failing e2e case will be fixed by #2177

@RainbowMango
Copy link
Member

FedResourceQuota is a user-facing resource and its name is used in work's label.

I'm afraid this is the wrong decision that directly takes name as the label.
We already have lessons learned about that. We should use the hash value, just like what we did for ResourceBinding.

By the way, restricting the name length definitely a cheaper way, but we should avoid doing that as we don't know exactly the use case and should not make the assumption that the name length never exceeds 63.

@RainbowMango
Copy link
Member

Hi @likakuli Long time no see, hope you are doing well.
As I mentioned earlier, using resource names as labels is not a recommended practice. However, this approach was once widely used in Karmada. Fortunately, we have fixed most of these issues, such as replacing it with the UUID of PropagationPolicy. Unfortunately, FederatedResourceQuota still is an exception.

Currently, we are enhancing the FederatedResourceQuota, see #6350, For now, I think we can adopt this cheaper solution to prevent people from doing wrong and fix it later.

@codecov-commenter
Copy link

codecov-commenter commented May 10, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.34%. Comparing base (fc44746) to head (9dde2b0).
Report is 4 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2168      +/-   ##
==========================================
- Coverage   49.34%   49.34%   -0.01%     
==========================================
  Files         678      678              
  Lines       55050    55061      +11     
==========================================
+ Hits        27167    27168       +1     
- Misses      26115    26124       +9     
- Partials     1768     1769       +1     
Flag Coverage Δ
unittests 49.34% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@RainbowMango RainbowMango added this to the v1.14 milestone May 10, 2025
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/assign

Signed-off-by: likakuli <[email protected]>

fix: add name length check for fedresourcequota

Signed-off-by: likakuli <[email protected]>

fix: add name length check for fedresourcequota

Signed-off-by: likakuli <[email protected]>
@likakuli likakuli force-pushed the feature_quotanamevalidate branch from 66b8fc8 to 9dde2b0 Compare May 13, 2025 02:55
Copy link
Member

@RainbowMango RainbowMango left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label May 13, 2025
@karmada-bot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: RainbowMango

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

@karmada-bot karmada-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 13, 2025
@karmada-bot karmada-bot merged commit d4cf986 into karmada-io:master May 13, 2025
24 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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants