[gRPC/http2 auto-detect] Support auto-detection in queue proxy
- Dominant language
- Go
- Stars
- 6.1k
- Forks
- 1.2k
- Avg merge
- 2d 7h
- Merged PRs (30d)
- 2
Description
## Describe the feature
This is part of #4283.
As part of supporting http2 auto-detect, we need to make changes in health probes, queue proxy, and activator. Below are some notes created by @igorbelianski on the work that needs to be done in queue proxy & activator.
### Data Path Notes
#### Public service ingress construction
Service that is exposed to user and backed by either Activator or Queue proxy depending on "direct operational mode)
[pkg/reconciler/serverlessservice/resources/services.go](https://github.com/knative/serving/tree/master/pkg/reconciler/serverlessservice/resources/services.go)
```
func MakePublicService
(based on h2c flag it uses different backend port 8012 or 8013 see func targetPort()
```
#### Private service ingress construction
Service exposed to activator to access Queue proxy
[pkg/reconciler/serverlessservice/resources/services.go](https://github.com/knative/serving/tree/master/pkg/reconciler/serverlessservice/resources/services.go)
```
func MakePrivateService(sks *v1alpha1.ServerlessService) *corev1.Service {
(based on h2c flag it uses different backend port 8012 or 8013 see func targetPort()
```
#### Activator always listens on both 8012 an 8013 constructs 2 distinct servers:
[cmd/activator/main.go](https://github.com/knative/serving/tree/master/cmd/activator/main.go)
```
servers := map[string]*http.Server{
"http1": pkgnet.NewServer(":"+strconv.Itoa(networking.BackendHTTPPort), ah),
"h2c": pkgnet.NewServer(":"+strconv.Itoa(networking.BackendHTTP2Port), ah),
"profile": profiling.NewServer(profilingHandler),
}
```
#### Queue proxy container construction
While construction queue proxy container we make a static choice on the port 8012/8013
[pkg/reconciler/revision/resources/queue.go](https://github.com/knative/serving/tree/master/pkg/reconciler/revision/resources/queue.go)
```
func makeQueueContainer(rev *v1.Revision, cfg *config.Config) (*corev1.Container, error) {
```
Queue proxy implementation picks port from `env.UserPort`
https://github.com/knative/serving/blob/master/cmd/queue/main.go#L273
Contributor guide
Research direction
Start with the service construction in pkg/reconciler/serverlessservice/resources/services.go, then read cmd/activator/main.go, pkg/reconciler/revision/resources/queue.go, and the queue entry point near cmd/queue/main.go:273. Trace how the h2c flag and backend ports 8012/8013 are selected. Done means the queue proxy and activator path support the requested HTTP/2 auto-detection without the current static port choice.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, kubernetes
- Domain
- backend, networking
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100