-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat: add webhook for validating module config virtualization #571
base: main
Are you sure you want to change the base?
Conversation
fdc2c14
to
db29e92
Compare
images/virtualization-artifact/pkg/controller/moduleconfig/util.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/moduleconfig/util.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/moduleconfig/reduce_cidrs_validator.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/moduleconfig/reduce_cidrs_validator.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/moduleconfig/reduce_cidrs_validator.go
Outdated
Show resolved
Hide resolved
16560b2
to
537e7a0
Compare
images/virtualization-artifact/pkg/controller/moduleconfig/reduce_cidrs_validator.go
Outdated
Show resolved
Hide resolved
becb13c
to
7d715fc
Compare
b89f001
to
05daee3
Compare
images/virtualization-artifact/pkg/controller/moduleconfig/moduleconfig_webhook.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/moduleconfig/util.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/moduleconfig/cidrs_validator.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/moduleconfig/util.go
Outdated
Show resolved
Hide resolved
images/virtualization-artifact/pkg/controller/moduleconfig/remove_cidrs_validator.go
Outdated
Show resolved
Hide resolved
for i, v := range input { | ||
strVal, ok := v.(string) | ||
if !ok { | ||
return nil, fmt.Errorf("failed to convert value %v to a string", v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this internal error? Or user set wrong value to mc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This error occurs because the user provided an incorrect value to mc. However, this scenario should be impossible since we have validation in place at the OpenAPI level.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be add "please report a bug" here?
Or add the error log here
Or even both are better
194ca0b
to
69e7fde
Compare
Signed-off-by: yaroslavborbat <[email protected]>
3ff48f9
to
6821f61
Compare
for i, v := range input { | ||
strVal, ok := v.(string) | ||
if !ok { | ||
return nil, fmt.Errorf("failed to convert value %v to a string", v) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be add "please report a bug" here?
Or add the error log here
Or even both are better
|
||
leases := &virtv2.VirtualMachineIPAddressLeaseList{} | ||
if err := v.client.List(ctx, leases); err != nil { | ||
return nil, fmt.Errorf("failed to list VirtualMachineIPAddressLeases: %w", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's important to ask user report about our bug here or ask to try again later
And log the error
Please check other errors as well: the user must either understand that he screwed up somewhere, or understand that the error occurred on our side and he should to either try again later, or report the bug.
Description
Add a webhook for ModuleConfig Virtualization
Why do we need it, and what problem does it solve?
It is forbidden to delete used CIDRs
What is the expected result?
Checklist