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

Issue 187: Webhook rejects requests when cluster is upgrading #190

Merged
merged 3 commits into from
May 22, 2019

Conversation

Tristan1900
Copy link
Member

Change log description

Enable webhook to reject requests when cluster is upgrading

Purpose of the change

Fix #187

How to test

Unit test should pass

Signed-off-by: wenqimou [email protected]

@@ -60,6 +62,10 @@ func (pwh *pravegaWebhookHandler) Handle(ctx context.Context, req admissiontypes
}
copy := pravega.DeepCopy()

if err := pwh.clusterIsAvailable(ctx, copy); err != nil {
return admission.ErrorResponse(http.StatusBadRequest, err)
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe that, in this case, we should return a server error (5xx) instead of a user error (4xx). BadRequest is telling the user that the request is malformed, which is not the case, it's just that the cluster status does not allow this type of request temporarily.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it!

wenqimou added 2 commits May 21, 2019 11:05
Signed-off-by: wenqimou <[email protected]>
@adrianmo adrianmo merged commit ab37930 into master May 22, 2019
@adrianmo adrianmo deleted the issue-187-webhook-fix branch May 22, 2019 08:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants