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 ClusterClaim deletion webhook bug #5075

Merged
merged 1 commit into from
Jun 7, 2023

Conversation

luolanzone
Copy link
Contributor

@luolanzone luolanzone commented Jun 2, 2023

After K8s 1.16, the req.Object in a deletion request is empty, and only req.OldObject will be provided, so change the ClusterClaim webhook to decode OldObject if it is a deletion operation.

This will fix a bug that ClusterCliam is unable to be deleted with the below error:

Error from server: error when deleting "clusterclaims.yaml": admission webhook
"vclusterclaim.kb.io" denied the request: there is no content to decode

After K8s 1.16, the req.Object in deletion request is empty, only
req.OldObject will be fulfilled, so change the ClusterClaim webhook
to decode OldObject if it's deletion operation.

This will fix a bug that ClusterCliam is unable to be deleted with below
errors:
```
Error from server: error when deleting "clusterclaims.yaml": admission webhook
"vclusterclaim.kb.io" denied the request: there is no content to decode
```

Signed-off-by: Lan Luo <luola@vmware.com>
@luolanzone luolanzone added the action/backport Indicates a PR that requires backports. label Jun 2, 2023
@luolanzone
Copy link
Contributor Author

/test-multicluster-e2e

@luolanzone luolanzone added the area/multi-cluster Issues or PRs related to multi cluster. label Jun 2, 2023
@luolanzone
Copy link
Contributor Author

@jianjuns could you help to review this PR? I think we need backport this fix. Thanks.

@jianjuns
Copy link
Contributor

jianjuns commented Jun 6, 2023

We do not have test to cover such basic deletion case?

@luolanzone
Copy link
Contributor Author

luolanzone commented Jun 7, 2023

Yeah, unit test covered deletion but it used the wrong Object to fake data, so this issue is not found.
e2e doesn't cover deletion part, I have created an issue to improve the e2e with antctl #5084, the deletion command test should be able to help on this.

@jianjuns
Copy link
Contributor

jianjuns commented Jun 7, 2023

/skip-all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action/backport Indicates a PR that requires backports. area/multi-cluster Issues or PRs related to multi cluster.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants