summaryrefslogtreecommitdiff
path: root/libpod/kube.go
diff options
context:
space:
mode:
authorMiloslav Trmač <mitr@redhat.com>2021-11-19 09:36:40 +0100
committerMatthew Heon <mheon@redhat.com>2021-12-06 15:48:31 -0500
commitd2602039e77300d9e5c76786aac997ed586d5038 (patch)
treea9b3b02d1443e5c923d48d8f64c1e27ffcdbc3cf /libpod/kube.go
parentd9527638845d6eb756885e858a7c27670b8ca687 (diff)
downloadpodman-d2602039e77300d9e5c76786aac997ed586d5038.tar.gz
podman-d2602039e77300d9e5c76786aac997ed586d5038.tar.bz2
podman-d2602039e77300d9e5c76786aac997ed586d5038.zip
Move a comment to the relevant place
Signed-off-by: Miloslav Trmač <mitr@redhat.com>
Diffstat (limited to 'libpod/kube.go')
-rw-r--r--libpod/kube.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/libpod/kube.go b/libpod/kube.go
index b34734513..4be31bd4b 100644
--- a/libpod/kube.go
+++ b/libpod/kube.go
@@ -269,6 +269,7 @@ func GenerateKubeServiceFromV1Pod(pod *v1.Pod, servicePorts []v1.ServicePort) YA
func containerPortsToServicePorts(containerPorts []v1.ContainerPort) []v1.ServicePort {
sps := make([]v1.ServicePort, 0, len(containerPorts))
for _, cp := range containerPorts {
+ // Legal nodeport range is 30000-32767
nodePort := 30000 + rand.Intn(32767-30000+1)
servicePort := v1.ServicePort{
Protocol: cp.Protocol,
@@ -286,7 +287,7 @@ func containerPortsToServicePorts(containerPorts []v1.ContainerPort) []v1.Servic
// inclusive list of serviceports to expose
func containersToServicePorts(containers []v1.Container) []v1.ServicePort {
// Without the call to rand.Seed, a program will produce the same sequence of pseudo-random numbers
- // for each execution. Legal nodeport range is 30000-32767
+ // for each execution.
rand.Seed(time.Now().UnixNano())
sps := make([]v1.ServicePort, 0, len(containers))