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 validation on policy permanent ID #4964

Merged

Conversation

whitewindmills
Copy link
Member

What type of PR is this?
/kind feature

What this PR does / why we need it:
Add protection mechanism for the permanent ID, see #4949 (comment)

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label May 20, 2024
@karmada-bot karmada-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label May 20, 2024
@whitewindmills
Copy link
Member Author

test result:
image

@whitewindmills
Copy link
Member Author

/assign @RainbowMango @XiShanYongYe-Chang

@codecov-commenter
Copy link

codecov-commenter commented May 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.33%. Comparing base (3314771) to head (2ff60d0).
Report is 18 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    #4964      +/-   ##
==========================================
+ Coverage   53.32%   53.33%   +0.01%     
==========================================
  Files         252      252              
  Lines       20485    20482       -3     
==========================================
+ Hits        10923    10925       +2     
+ Misses       8841     8835       -6     
- Partials      721      722       +1     
Flag Coverage Δ
unittests 53.33% <ø> (+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.

@whitewindmills
Copy link
Member Author

@XiShanYongYe-Chang
Copy link
Member

unrelated E2E case: https://github.com/karmada-io/karmada/actions/runs/9155349434/job/25167705895?pr=4964#step:6:3402

Yes, this is currently being fixed.

Signed-off-by: whitewindmills <jayfantasyhjh@gmail.com>
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.

Thanks a lot~
/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label May 22, 2024
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.

/approve

@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 23, 2024
@karmada-bot karmada-bot merged commit ef14a98 into karmada-io:master May 23, 2024
12 checks passed
@XiShanYongYe-Chang
Copy link
Member

Do we also need to add the permanentID validation for the RB/CRB and Work? @RainbowMango @whitewindmills

@whitewindmills
Copy link
Member Author

I think it’s reasonable regardless of whether to add it or not cause they are usually not visible to users. In addition, I think it is more necessary to add the validation for resource templates.

@XiShanYongYe-Chang
Copy link
Member

I think it is more necessary to add the validation for resource templates.

What behavior are you referring to?

@whitewindmills
Copy link
Member Author

apiVersion: v1
kind: ConfigMap
metadata:
  creationTimestamp: "2024-05-23T03:00:31Z"
  annotations:
    clusterpropagationpolicy.karmada.io/name: foo-cpp
  labels:
    clusterpropagationpolicy.karmada.io/name: foo-cpp
    clusterpropagationpolicy.karmada.io/permanent-id: c105115c-1243-4a4c-189c-990936097gs8
  name: foo
  namespace: default
  resourceVersion: "63274530"
  uid: b205114b-3443-4b4d-a89c-410936097ed5

protect these labels and annotations from modification by users, but I haven't figured out how to do it yet.

@XiShanYongYe-Chang
Copy link
Member

cc @RainbowMango

@XiShanYongYe-Chang
Copy link
Member

I think it’s reasonable regardless of whether to add it or not cause they are usually not visible to users.

Do we need to consider whether it is a user-aware API when validating?

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/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants