Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 1 addition & 2 deletions pkg/activator/net/revision_backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ func (d dests) MarshalLogObject(enc zapcore.ObjectEncoder) error {
const (
probeTimeout time.Duration = 300 * time.Millisecond
defaultProbeFrequency time.Duration = 200 * time.Millisecond
probePath = "/healthz"
)

// revisionWatcher watches the podIPs and ClusterIP of the service for a revision. It implements the logic
Expand Down Expand Up @@ -158,7 +157,7 @@ func (rw *revisionWatcher) probe(ctx context.Context, dest string) (bool, error)
httpDest := url.URL{
Scheme: "http",
Host: dest,
Path: probePath,
Path: network.ProbePath,
}
// NOTE: changes below may require changes to testing/roundtripper.go to make unit tests passing.
return prober.Do(ctx, rw.transport, httpDest.String(),
Expand Down
3 changes: 2 additions & 1 deletion pkg/autoscaler/statserver/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import (
"go.uber.org/zap"
"golang.org/x/sync/errgroup"
"knative.dev/serving/pkg/autoscaler/metrics"
"knative.dev/serving/pkg/network"

"k8s.io/apimachinery/pkg/types"
)
Expand Down Expand Up @@ -61,7 +62,7 @@ func TestProbe(t *testing.T) {

defer server.Shutdown(0)
go server.listenAndServe()
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/healthz", server.listenAddr()), nil)
req, err := http.NewRequest(http.MethodGet, fmt.Sprintf("%s/%s", server.listenAddr(), network.ProbePath), nil)
if err != nil {
t.Fatal("Error creating request:", err)
}
Expand Down
4 changes: 4 additions & 0 deletions pkg/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ import (
)

const (
// ProbeHeaderName is the name of a path that activator, autoscaler and
Comment thread
nak3 marked this conversation as resolved.
Outdated
// prober(used by KIngress generally) use for health check.
ProbePath = "/healthz"

// ProbeHeaderName is the name of a header that can be added to
// requests to probe the knative networking layer. Requests
// with this header will not be passed to the user container or
Expand Down
3 changes: 1 addition & 2 deletions pkg/network/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const (
probeConcurrency = 15
// probeTimeout defines the maximum amount of time a request will wait
probeTimeout = 1 * time.Second
probePath = "/healthz"
// initialDelay defines the delay before enqueuing a probing request the first time.
// It gives times for the change to propagate and prevents unnecessary retries.
initialDelay = 200 * time.Millisecond
Expand Down Expand Up @@ -368,7 +367,7 @@ func (m *Prober) processWorkItem() bool {
}

probeURL := deepCopy(item.url)
probeURL.Path = path.Join(probeURL.Path, probePath)
probeURL.Path = path.Join(probeURL.Path, network.ProbePath)

ctx, cancel := context.WithTimeout(item.context, probeTimeout)
defer cancel()
Expand Down
2 changes: 1 addition & 1 deletion pkg/reconciler/autoscaling/kpa/scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func paToProbeTarget(pa *pav1alpha1.PodAutoscaler) string {
svc := pkgnet.GetServiceHostname(pa.Status.ServiceName, pa.Namespace)
port := networking.ServicePort(pa.Spec.ProtocolType)

return fmt.Sprintf("http://%s:%d/healthz", svc, port)
return fmt.Sprintf("http://%s:%d/%s", svc, port, network.ProbePath)
}

// activatorProbe returns true if via probe it determines that the
Expand Down
2 changes: 1 addition & 1 deletion test/test_images/runtime/handlers/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import (
func InitHandlers(mux *http.ServeMux) {
h := network.NewProbeHandler(withHeaders(withRequestLog(runtimeHandler)))
mux.HandleFunc("/", h.ServeHTTP)
mux.HandleFunc("/healthz", withRequestLog(withKubeletProbeHeaderCheck))
mux.HandleFunc(network.ProbePath, withRequestLog(withKubeletProbeHeaderCheck))
}

// withRequestLog logs each request before handling it.
Expand Down