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

Implement ResourceInterpreterCustomization ValidatingAdmission #2755

Merged
merged 1 commit into from
Nov 28, 2022

Conversation

chaunceyjiang
Copy link
Member

Signed-off-by: chaunceyjiang chaunceyjiang@gmail.com

What type of PR is this?
/kind feature

What this PR does / why we need it:
Prevent modifying and creating ResourceInterpreterCustomization using the same interpretation rules.

Which issue(s) this PR fixes:

Part of #2371

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

Prevent modifying and creating `ResourceInterpreterCustomization` using the same interpretation rules.

@karmada-bot karmada-bot added the kind/feature Categorizes issue or PR as related to a new feature. label Nov 8, 2022
@karmada-bot karmada-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 8, 2022
@codecov-commenter
Copy link

Codecov Report

Merging #2755 (74a2887) into master (31f97ac) will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #2755      +/-   ##
==========================================
+ Coverage   33.46%   33.47%   +0.01%     
==========================================
  Files         200      200              
  Lines       19636    19636              
==========================================
+ Hits         6572     6574       +2     
+ Misses      12669    12668       -1     
+ Partials      395      394       -1     
Flag Coverage Δ
unittests 33.47% <ø> (+0.01%) ⬆️

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

Impacted Files Coverage Δ
pkg/search/proxy/store/util.go 92.98% <0.00%> (-0.59%) ⬇️
pkg/util/worker.go 71.42% <0.00%> (+4.76%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

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~
A change to a file may have been missed: pkg/karmadactl/cmdinit/karmada/webhook_configuration.go

artifacts/deploy/webhook-configuration.yaml Outdated Show resolved Hide resolved
artifacts/deploy/webhook-configuration.yaml Outdated Show resolved Hide resolved
pkg/webhook/resourceinterpretercustomization/validating.go Outdated Show resolved Hide resolved
@chaunceyjiang
Copy link
Member Author

This judgement may conflict with what was said at today's community meeting: InterpretDependency operation can support multiple different script definitions.

Yes, let's pending this PR first, and we'll deal with this PR after the community has a clearer description of the above issue.

@chaunceyjiang chaunceyjiang force-pushed the resourceInterpreter branch 3 times, most recently from e474cfa to 45829d4 Compare November 8, 2022 09:41
@chaunceyjiang chaunceyjiang force-pushed the resourceInterpreter branch 2 times, most recently from b36ffbb to 44a917c Compare November 23, 2022 16:02
@XiShanYongYe-Chang
Copy link
Member

/assign

@chaunceyjiang chaunceyjiang force-pushed the resourceInterpreter branch 2 times, most recently from 2c1896c to 5be03ca Compare November 24, 2022 11:17
@chaunceyjiang chaunceyjiang requested review from XiShanYongYe-Chang and removed request for Garrybest, rv64m and lonelyCZ November 24, 2022 11:23
@ikaven1024
Copy link
Member

Shall we check the script in the webhook? Like

func checkScrip(script string) error {
ctx, cancel := context.WithTimeout(context.TODO(), time.Second)
defer cancel()
l, err := luavm.NewWithContext(ctx)
if err != nil {
return err
}
defer l.Close()
_, err = l.LoadString(script)
return err
}

@XiShanYongYe-Chang
Copy link
Member

Shall we check the script in the webhook?

+1 I agree with this point.

@RainbowMango
Copy link
Member

/assign

@karmada-bot karmada-bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Nov 25, 2022
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~
other parts lgtm

pkg/util/validation/rule.go Outdated Show resolved Hide resolved
@chaunceyjiang chaunceyjiang force-pushed the resourceInterpreter branch 3 times, most recently from 7a472b7 to 8b5d5a3 Compare November 25, 2022 16:04
@chaunceyjiang chaunceyjiang force-pushed the resourceInterpreter branch 7 times, most recently from a4e0dd8 to 1e5396b Compare November 28, 2022 08:21
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.

Copy link
Member

@ikaven1024 ikaven1024 left a comment

Choose a reason for hiding this comment

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

Other LGTM

pkg/webhook/resourceinterpretercustomization/helper.go Outdated Show resolved Hide resolved
Signed-off-by: chaunceyjiang <chaunceyjiang@gmail.com>
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

Leave LGTM to @XiShanYongYe-Chang @ikaven1024

@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 Nov 28, 2022
@XiShanYongYe-Chang
Copy link
Member

/lgtm

@karmada-bot karmada-bot added the lgtm Indicates that a PR is ready to be merged. label Nov 28, 2022
@karmada-bot karmada-bot merged commit 3f21fc1 into karmada-io:master Nov 28, 2022
@chaunceyjiang chaunceyjiang deleted the resourceInterpreter branch December 19, 2022 10:28
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/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants