Skip to content

Commit

Permalink
Issue kubernetes#12658: Special case port mapping publish on macOS
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Grigorenko <[email protected]>
  • Loading branch information
kgibm committed Jun 7, 2022
1 parent d381a43 commit 7df74d3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pkg/drivers/kic/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,8 +472,13 @@ func generatePortMappings(portMappings ...PortMapping) []string {
for _, pm := range portMappings {
// let docker pick a host port by leaving it as ::
// example --publish=127.0.0.17::8443 will get a random host port for 8443
publish := fmt.Sprintf("--publish=%s::%d", pm.ListenAddress, pm.ContainerPort)
result = append(result, publish)
if runtime.GOOS == "darwin" {
publish := fmt.Sprintf("--publish=%d", pm.ContainerPort)
result = append(result, publish)
} else {
publish := fmt.Sprintf("--publish=%s::%d", pm.ListenAddress, pm.ContainerPort)
result = append(result, publish)
}
}
return result
}
Expand Down

0 comments on commit 7df74d3

Please sign in to comment.