Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion pkg/activator/net/revision_backends.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type dests struct {
const (
probeTimeout time.Duration = 300 * time.Millisecond
defaultProbeFrequency time.Duration = 200 * time.Millisecond
probePath = "/_internal/knative/activator/probe"
probePath = "/healthz"
)

// revisionWatcher watches the podIPs and ClusterIP of the service for a revision. It implements the logic
Expand Down
15 changes: 13 additions & 2 deletions pkg/network/status/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net"
"net/http"
"net/url"
"path"
"reflect"
"sync"
"sync/atomic"
Expand All @@ -43,8 +44,9 @@ import (
const (
// probeConcurrency defines how many probing calls can be issued simultaneously
probeConcurrency = 15
//probeTimeout defines the maximum amount of time a request will wait
// probeTimeout defines the maximum amount of time a request will wait
probeTimeout = 1 * time.Second
probePath = "/healthz"
)

var dialContext = (&net.Dialer{Timeout: probeTimeout}).DialContext
Expand Down Expand Up @@ -356,10 +358,13 @@ func (m *Prober) processWorkItem() bool {
return dialContext(ctx, network, net.JoinHostPort(item.podIP, item.podPort))
}}

probeUrl := deepCopy(item.url)
probeUrl.Path = path.Join(probeUrl.Path, probePath)

ok, err := prober.Do(
item.context,
transport,
item.url.String(),
probeUrl.String(),
prober.WithHeader(network.UserAgentKey, network.IngressReadinessUserAgent),
prober.WithHeader(network.ProbeHeaderName, network.ProbeHeaderValue),
m.probeVerifier(item))
Expand Down Expand Up @@ -427,3 +432,9 @@ func (m *Prober) probeVerifier(item *workItem) prober.Verifier {
}
}
}

func deepCopy(in *url.URL) *url.URL {
// Safe to ignore the error since this is a deep copy
newUrl, _ := url.Parse(in.String())
return newUrl
}
11 changes: 10 additions & 1 deletion pkg/reconciler/autoscaling/kpa/scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"context"
"fmt"
"net/http"
"net/url"
"path"
"time"

"knative.dev/pkg/apis/duck"
Expand Down Expand Up @@ -47,6 +49,8 @@ const (
scaleUnknown = -1
probePeriod = 1 * time.Second
probeTimeout = 45 * time.Second
probePath = "/healthz"

// The time after which the PA will be re-enqueued.
// This number is small, since `handleScaleToZero` below will
// re-enqueue for the configured grace period.
Expand Down Expand Up @@ -116,7 +120,12 @@ func newScaler(ctx context.Context, psInformerFactory duck.InformerFactory, enqu
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/", svc, port)

// Safe to ignore error since we know the string is a valid URL
httpDest, _ := url.Parse(fmt.Sprintf("http://%s:%d/", svc, port))
httpDest.Path = path.Join(httpDest.Path, probePath)

return httpDest.String()
}
Comment thread
shreejad marked this conversation as resolved.
Outdated

// activatorProbe returns true if via probe it determines that the
Expand Down
2 changes: 1 addition & 1 deletion test/config/security/policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ spec:
triggerRules:
- excludedPaths:
- prefix: /metrics
- prefix: /_internal/knative/activator/probe
- prefix: /healthz
principalBinding: USE_ORIGIN