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: Fix spurious transport errors (v0.37.x) #1638

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion pkg/webhooks/webhooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import (
"context"
"crypto/tls"
"errors"
"fmt"
"io"
Expand Down Expand Up @@ -187,10 +188,16 @@
}

func HealthProbe(ctx context.Context) healthz.Checker {
// Create new transport that doesn't validate the TLS certificate
// This transport is just polling so validating the server certificate isn't necessary
transport := http.DefaultTransport.(*http.Transport).Clone()
transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} // nolint:gosec
client := &http.Client{Transport: transport}

Dismissed Show dismissed Hide dismissed
// TODO: Add knative health check port for webhooks when health port can be configured
// Issue: https://github.com/knative/pkg/issues/2765
return func(req *http.Request) (err error) {
res, err := http.Get(fmt.Sprintf("http://localhost:%d", options.FromContext(ctx).WebhookPort))
res, err := client.Get(fmt.Sprintf("https://localhost:%d", options.FromContext(ctx).WebhookPort))
// If the webhook connection errors out, liveness/readiness should fail
if err != nil {
return err
Expand Down
Loading