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

Modify queue-proxy to support Firecracker microVMs #2

Open
wants to merge 1 commit 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
2 changes: 1 addition & 1 deletion pkg/queue/sharedmain/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func mainHandler(
stats *netstats.RequestStats,
logger *zap.SugaredLogger,
) (http.Handler, *pkghandler.Drainer) {
target := net.JoinHostPort("127.0.0.1", env.UserPort)
target := net.JoinHostPort(env.GuestAddr, env.GuestPort)

httpProxy := pkghttp.NewHeaderPruningReverseProxy(target, pkghttp.NoHostOverride, activator.RevisionHeaders, false /* use HTTP */)
httpProxy.Transport = transport
Expand Down
23 changes: 22 additions & 1 deletion pkg/queue/sharedmain/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ import (
"go.uber.org/zap"
"knative.dev/serving/pkg/queue/certificate"

corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"

"knative.dev/networking/pkg/certificates"
netstats "knative.dev/networking/pkg/http/stats"
Expand Down Expand Up @@ -108,6 +110,10 @@ type config struct {
TracingConfigSampleRate float64 `split_words:"true"` // optional
TracingConfigZipkinEndpoint string `split_words:"true"` // optional

// vHive configuration
GuestAddr string `split_words:"true" required:"true"`
GuestPort string `split_words:"true" required:"true"`

Env
}

Expand Down Expand Up @@ -224,6 +230,22 @@ func Main(opts ...Option) error {
}
}()

servingProbe := &corev1.Probe{
SuccessThreshold: 1,
ProbeHandler: corev1.ProbeHandler{
TCPSocket: &corev1.TCPSocketAction{
Host: env.GuestAddr,
Port: intstr.FromString(env.GuestPort),
},
},
}

var err error
env.ServingReadinessProbe, err = readiness.EncodeProbe(servingProbe)
if err != nil {
logger.Fatalw("Failed to create stats reporter", zap.Error(err))
}

// Setup probe to run for checking user-application healthiness.
probe := func() bool { return true }
if env.ServingReadinessProbe != "" {
Expand Down Expand Up @@ -251,7 +273,6 @@ func Main(opts ...Option) error {

tlsServers := make(map[string]*http.Server)
var certWatcher *certificate.CertWatcher
var err error

if tlsEnabled {
tlsServers["main"] = mainServer(":"+env.QueueServingTLSPort, mainHandler)
Expand Down