Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

Commit

Permalink
Bind 30080 to 30081 in the case of sandbox (#313)
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Apolinario <[email protected]>

Co-authored-by: Eduardo Apolinario <[email protected]>
  • Loading branch information
eapolinario and eapolinario authored Apr 20, 2022
1 parent 283ca58 commit 6e92a88
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cmd/demo/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ func startDemo(ctx context.Context, cli docker.Docker, reader io.Reader) (*bufio
}

fmt.Printf("%v booting flyte-demo container\n", emoji.FactoryWorker)
exposedPorts, portBindings, _ := docker.GetSandboxPorts()
exposedPorts, portBindings, _ := docker.GetDemoPorts()
ID, err := docker.StartContainer(ctx, cli, volumes, exposedPorts, portBindings, docker.FlyteSandboxClusterName,
demoImage, sandboxDefaultConfig.Env)

Expand Down
2 changes: 1 addition & 1 deletion cmd/demo/start_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ var fakePod = corev1.Pod{
}

func TestStartDemoFunc(t *testing.T) {
p1, p2, _ := docker.GetSandboxPorts()
p1, p2, _ := docker.GetDemoPorts()
assert.Nil(t, util.SetupFlyteDir())
assert.Nil(t, os.MkdirAll(f.FilePathJoin(f.UserHomeDir(), ".flyte", "k3s"), os.ModePerm))
assert.Nil(t, ioutil.WriteFile(docker.Kubeconfig, []byte(content), os.ModePerm))
Expand Down
15 changes: 15 additions & 0 deletions pkg/docker/docker_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,21 @@ func RemoveSandbox(ctx context.Context, cli Docker, reader io.Reader) error {

// GetSandboxPorts will return sandbox ports
func GetSandboxPorts() (map[nat.Port]struct{}, map[nat.Port][]nat.PortBinding, error) {
return nat.ParsePortSpecs([]string{
// Notice that two host ports are mapped to the same container port in the case of Flyteconsole, this is done to
// support the generated URLs produced by pyflyte run
"0.0.0.0:30080:30081", // Flyteconsole Port.
"0.0.0.0:30081:30081", // Flyteadmin Port
"0.0.0.0:30082:30082", // K8s Dashboard Port
"0.0.0.0:30084:30084", // Minio API Port
"0.0.0.0:30086:30086", // K8s cluster
"0.0.0.0:30088:30088", // Minio Console Port
"0.0.0.0:30089:30089", // Postgres Port
})
}

// GetDemoPorts will return demo ports
func GetDemoPorts() (map[nat.Port]struct{}, map[nat.Port][]nat.PortBinding, error) {
return nat.ParsePortSpecs([]string{
"0.0.0.0:30080:30080", // Flyteconsole Port
"0.0.0.0:30081:30081", // Flyteadmin Port
Expand Down

0 comments on commit 6e92a88

Please sign in to comment.