Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 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
16 changes: 14 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,10 @@ func (m *Prober) probeVerifier(item *workItem) prober.Verifier {
}
}
}

// Deep copies a URL into a new one
Comment thread
shreejad marked this conversation as resolved.
Outdated
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
}
6 changes: 4 additions & 2 deletions pkg/reconciler/autoscaling/kpa/scaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const (
scaleUnknown = -1
probePeriod = 1 * time.Second
probeTimeout = 45 * time.Second

// 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 @@ -112,11 +113,12 @@ func newScaler(ctx context.Context, psInformerFactory duck.InformerFactory, enqu
return ks
}

// Resolves the pa to hostname:port.
// Resolves the pa to the probing endpoint Eg. http://hostname:port/healthz
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)

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

// 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