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

feat: add webhook for validating module config virtualization #571

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

yaroslavborbat
Copy link
Member

@yaroslavborbat yaroslavborbat commented Dec 12, 2024

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

  • The code is covered by unit tests.
  • e2e tests passed.
  • Documentation updated according to the changes.
  • Changes were tested in the Kubernetes cluster manually.

@yaroslavborbat yaroslavborbat force-pushed the feat/mc-webhook branch 12 times, most recently from fdc2c14 to db29e92 Compare December 16, 2024 09:56
Isteb4k
Isteb4k previously approved these changes Dec 17, 2024
diafour
diafour previously approved these changes Dec 23, 2024
@diafour diafour dismissed their stale review December 25, 2024 13:07

The merge-base changed after approval.

for i, v := range input {
strVal, ok := v.(string)
if !ok {
return nil, fmt.Errorf("failed to convert value %v to a string", v)
Copy link
Contributor

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

Copy link
Member Author

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.

Copy link
Contributor

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

@yaroslavborbat yaroslavborbat force-pushed the feat/mc-webhook branch 2 times, most recently from 194ca0b to 69e7fde Compare January 10, 2025 08:16
for i, v := range input {
strVal, ok := v.(string)
if !ok {
return nil, fmt.Errorf("failed to convert value %v to a string", v)
Copy link
Contributor

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)
Copy link
Contributor

@Isteb4k Isteb4k Jan 13, 2025

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants