Skip to content

Commit 65de4ac

Browse files
authored
feat: Python,Go func listen dual-stack (knative#2898)
* feat: py func listen dual-stack Signed-off-by: Matej Vašek <[email protected]> * fix: Go host built image listens on any iface Previously it was listening only on localhost Signed-off-by: Matej Vašek <[email protected]> --------- Signed-off-by: Matej Vašek <[email protected]>
1 parent a93cbe6 commit 65de4ac

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

pkg/builders/s2i/builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ func (b *Builder) Build(ctx context.Context, f fn.Function, platforms []fn.Platf
179179
return err
180180
}
181181

182-
buildEnvs["LISTEN_ADDRESS"] = "0.0.0.0:8080"
182+
buildEnvs["LISTEN_ADDRESS"] = "[::]:8080"
183183
for k, v := range buildEnvs {
184184
cfg.Environment = append(cfg.Environment, api.EnvironmentSpec{Name: k, Value: v})
185185
}

pkg/oci/go_builder.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ func (b goBuilder) Base() string {
2525
func (b goBuilder) Configure(_ buildJob, _ v1.Platform, cf v1.ConfigFile) (v1.ConfigFile, error) {
2626
// : Using Cmd rather than Entrypoint due to it being overrideable.
2727
cf.Config.Cmd = []string{"/func/f"}
28+
cf.Config.Env = append(cf.Config.Env, "LISTEN_ADDRESS=[::]:8080")
2829
return cf, nil
2930
}
3031

pkg/oci/python_builder.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ func (b pythonBuilder) Configure(job buildJob, _ v1.Platform, cf v1.ConfigFile)
3131
svcPath = filepath.Join("/func", svcRelPath) // eg /func/.func/builds/by-hash/$HASH
3232
pythonPathEnv = fmt.Sprintf("PYTHONPATH=%v/lib", svcPath)
3333
mainPath = fmt.Sprintf("%v/service/main.py", svcPath)
34-
listenAddrEnv = "LISTEN_ADDRESS=0.0.0.0:8080"
34+
listenAddrEnv = "LISTEN_ADDRESS=[::]:8080"
3535
)
3636

3737
cf.Config.Env = append(cf.Config.Env, pythonPathEnv, listenAddrEnv)

0 commit comments

Comments
 (0)