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

[wip] attempt pod addressability for the autoscaler #15388

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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: 5 additions & 4 deletions pkg/autoscaler/metrics/stats_scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import (
"golang.org/x/sync/errgroup"

netcfg "knative.dev/networking/pkg/config"
"knative.dev/networking/pkg/http/header"
pkgmetrics "knative.dev/pkg/metrics"
autoscalingv1alpha1 "knative.dev/serving/pkg/apis/autoscaling/v1alpha1"
"knative.dev/serving/pkg/apis/serving"
Expand Down Expand Up @@ -298,10 +299,10 @@ func (s *serviceScraper) scrapePods(window time.Duration) (Stat, error) {
return err
}

if s.usePassthroughLb {
req.Host = s.host
req.Header.Add("Knative-Direct-Lb", "true")
}
// if s.usePassthroughLb {
req.Host = s.host
req.Header.Add(header.PassthroughLoadbalancingKey, "true")
// }

stat, err := s.directClient.Do(req)
if err == nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/reconciler/serverlessservice/resources/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,8 @@ func MakePrivateService(sks *v1alpha1.ServerlessService, selector map[string]str
Port: targetPort(sks).IntVal,
TargetPort: targetPort(sks),
}},
Selector: selector,
Selector: selector,
ClusterIP: corev1.ClusterIPNone,
},
}
}
2 changes: 2 additions & 0 deletions pkg/reconciler/serverlessservice/resources/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ func privateSvcMod(s *corev1.Service) {
"app": "sadness",
}
}
s.Spec.ClusterIP = corev1.ClusterIPNone
s.Spec.Ports = append(s.Spec.Ports,
[]corev1.ServicePort{{
Name: servingv1.AutoscalingQueueMetricsPortName,
Expand Down Expand Up @@ -470,6 +471,7 @@ func TestMakePrivateService(t *testing.T) {
s.Labels["ava"] = "adore"
s.Labels[networking.SKSLabelKey] = "dream-tonight-cherub-rock-mayonnaise-hummer-disarm-rocket-soma-quiet"
s.Annotations = map[string]string{"cherub": "rock"}
s.Spec.ClusterIP = corev1.ClusterIPNone
}, privateSvcMod, func(s *corev1.Service) {
// And now patch port to be http2.
s.Spec.Ports[0] = corev1.ServicePort{
Expand Down
Loading