@@ -181,6 +181,18 @@ func generateEntryPoint() []string {
181181 return entrypoint
182182}
183183
184+ // natPortsToK8sFormat transforms nat.PortMap
185+ // to Pods port pair format: $external_port:$internal_port
186+ func natPortsToK8sFormat (nat nat.PortMap ) []string {
187+ out := make ([]string , 0 )
188+ for port , portBinding := range nat {
189+ for _ , b := range portBinding {
190+ out = append (out , fmt .Sprintf ("%s:%s" , b .HostPort , strconv .Itoa (port .Int ())))
191+ }
192+ }
193+ return out
194+ }
195+
184196// generatePortBindings generates exposed ports and port bindings
185197// exposes default CL node port
186198// exposes custom_ports in format "host:docker" or map 1-to-1 if only "host" port is provided
@@ -302,10 +314,7 @@ func newNode(ctx context.Context, in *Input, pgOut *postgres.Output) (*NodeOut,
302314 Env : pods .EnvsFromMap (in .Node .EnvVars ),
303315 Requests : pods .ResourcesMedium (),
304316 Limits : pods .ResourcesMedium (),
305- Ports : []string {
306- fmt .Sprintf ("%d:%s" , in .Node .HTTPPort , DefaultHTTPPort ),
307- fmt .Sprintf ("%d:%s" , in .Node .P2PPort , DefaultP2PPort ),
308- },
317+ Ports : natPortsToK8sFormat (portBindings ),
309318 ContainerSecurityContext : & v1.SecurityContext {
310319 // these are specific things we need for staging cluster
311320 RunAsNonRoot : pods .Ptr (true ),
0 commit comments