feat: Python,Go func listen dual-stack (#2898)

* feat: py func listen dual-stack

Signed-off-by: Matej Vašek <mvasek@redhat.com>

* fix: Go host built image listens on any iface

Previously it was listening only on localhost

Signed-off-by: Matej Vašek <mvasek@redhat.com>

---------

Signed-off-by: Matej Vašek <mvasek@redhat.com>
This commit is contained in:
Matej Vašek 2025-07-01 02:38:52 +02:00 committed by GitHub
parent a93cbe6785
commit 65de4ac2fc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 2 deletions

View File

@ -179,7 +179,7 @@ func (b *Builder) Build(ctx context.Context, f fn.Function, platforms []fn.Platf
return err
}
buildEnvs["LISTEN_ADDRESS"] = "0.0.0.0:8080"
buildEnvs["LISTEN_ADDRESS"] = "[::]:8080"
for k, v := range buildEnvs {
cfg.Environment = append(cfg.Environment, api.EnvironmentSpec{Name: k, Value: v})
}

View File

@ -25,6 +25,7 @@ func (b goBuilder) Base() string {
func (b goBuilder) Configure(_ buildJob, _ v1.Platform, cf v1.ConfigFile) (v1.ConfigFile, error) {
// : Using Cmd rather than Entrypoint due to it being overrideable.
cf.Config.Cmd = []string{"/func/f"}
cf.Config.Env = append(cf.Config.Env, "LISTEN_ADDRESS=[::]:8080")
return cf, nil
}

View File

@ -31,7 +31,7 @@ func (b pythonBuilder) Configure(job buildJob, _ v1.Platform, cf v1.ConfigFile)
svcPath = filepath.Join("/func", svcRelPath) // eg /func/.func/builds/by-hash/$HASH
pythonPathEnv = fmt.Sprintf("PYTHONPATH=%v/lib", svcPath)
mainPath = fmt.Sprintf("%v/service/main.py", svcPath)
listenAddrEnv = "LISTEN_ADDRESS=0.0.0.0:8080"
listenAddrEnv = "LISTEN_ADDRESS=[::]:8080"
)
cf.Config.Env = append(cf.Config.Env, pythonPathEnv, listenAddrEnv)