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

Better handling for startupProbe and livenessProbe #125

Merged
merged 2 commits into from
Apr 6, 2021

Conversation

kkujawa-sumo
Copy link
Contributor

Proper json request should have appropriate HTTP header:

Content-Type: application/json
Accept: application/json

this eliminates following error in operator logs: 2021-04-06T10:59:12.161Z ERROR controller-runtime.webhook.webhooks unable to process a request with an unknown content type {"webhook": "/add-tailing-sidecars-v1-pod", "content type": "", "error": "contentType=, expected application/json"}

Add better handling for startupProbe and livenessProbe in operator code to eliminate this errror:
2021-04-06T11:23:46.412Z DEBUG controller-runtime.webhook.webhooks wrote response {"webhook": "/add-tailing-sidecars-v1-pod", "code": 400, "reason": "", "UID": "", "allowed": false}

@kkujawa-sumo kkujawa-sumo requested a review from a team as a code owner April 6, 2021 11:43
@@ -63,7 +63,10 @@ type PodExtender struct {

// Handle handles requests to create/update Pod and extends it by adding tailing sidecars
func (e *PodExtender) Handle(ctx context.Context, req admission.Request) admission.Response {
if req.Operation == admv1.Delete {

Copy link
Contributor

Choose a reason for hiding this comment

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

Why the empty line 😬 ?

Comment on lines 67 to 69
if req.Operation == "" {
return admission.Allowed("Received startupProbe/livenessProbe")
} else if req.Operation == admv1.Delete {
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: I'd personally not join those cases in 1 if block.

Copy link
Contributor

@pmalek-sumo pmalek-sumo left a comment

Choose a reason for hiding this comment

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

🚀

@kkujawa-sumo kkujawa-sumo merged commit e585d97 into main Apr 6, 2021
@kkujawa-sumo kkujawa-sumo deleted the kk-handling-probes branch April 6, 2021 12:18
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.

None yet

3 participants