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

Fix updating invalid Instance parameters #1441

Merged
merged 6 commits into from
Mar 31, 2020
Merged

Conversation

zen-dog
Copy link
Contributor

@zen-dog zen-dog commented Mar 26, 2020

Summary:
in the past, we've allowed updating Instance with parameters that are missing in the corresponding OV (since there was no way to forbid this in the absence of an admission controller). Now that we have the instance admission controller in place, we can fix this behavior.

Fixes #1411

Signed-off-by: Aleksey Dukhovniy alex.dukhovniy@googlemail.com

Summary:
in the past we've allowed updating Instance with parameters that are missing in the corresponding OV (since there were no way to forbid this in the absence of an admission controller). Now that we have instance admission controller in place, we can fix this behavior.

Fixes #1411

Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Copy link
Member

@nfnt nfnt left a comment

Choose a reason for hiding this comment

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

LGTM!
See my comments on handling added parameters on upgrades. Although this is handled in the existing code, this could be clearer by handling this by calling GetParamDefinitions for added and removed parameters separately.

pkg/webhook/instance_admission.go Outdated Show resolved Hide resolved
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Copy link
Member

@ANeumann82 ANeumann82 left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Member

@porridge porridge left a comment

Choose a reason for hiding this comment

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

A few comments inline.

Also, now that we have typed parameters, I think we should somehow attempt verify the type of the passed parameter. Something simple like attempting an unmarshall of the parameter according to type would do the trick.

@@ -299,15 +299,15 @@ func TestValidateUpdate(t *testing.T) {
wantErr: true,
},
{
name: "parameter update triggering a non-existing OV plan IS allowed but will NOT trigger a plan",
name: "parameter update triggering a non-existing OV plan IS NOT allowed",
Copy link
Member

Choose a reason for hiding this comment

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

I think this change of behaviour deserves at least a mention in the PR description, if not title.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It is mentioned in the PR description and somewhat vaguely in the PR title. Do you have a better title suggestion that doesn't exceed 60 characters?

Copy link
Member

@porridge porridge Mar 30, 2020

Choose a reason for hiding this comment

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

This test claims to be about "non-existent plans" while the PR title/description only seems to mention non-existent parameters. To me these are two different things.
See also #1268 w.r.t the former.

Copy link
Contributor Author

@zen-dog zen-dog Mar 30, 2020

Choose a reason for hiding this comment

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

You're right, plan description is misleading, it's the parameter existence that is being checked. Fixed the description.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

...and also added a test for the missing plan 👍

pkg/webhook/instance_admission_test.go Show resolved Hide resolved
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Signed-off-by: Aleksey Dukhovniy <alex.dukhovniy@googlemail.com>
Copy link
Member

@porridge porridge left a comment

Choose a reason for hiding this comment

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

🚢

@zen-dog zen-dog merged commit 98cee77 into master Mar 31, 2020
@zen-dog zen-dog deleted the ad/updating-missing-params branch March 31, 2020 08:36
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.

KUDO Allows for the update of a non-existent param
4 participants