summaryrefslogtreecommitdiff
path: root/pkg/domain/infra/abi/generate.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2021-12-02 20:00:48 +0100
committerGitHub <noreply@github.com>2021-12-02 20:00:48 +0100
commitb203e6d0f07d2c473c8249d0de173a2ca7176990 (patch)
treec8caa18d420db8acf321a36036576b8b653fc297 /pkg/domain/infra/abi/generate.go
parent4ff0ba4c8731e3dc1d56010f80468260104f3abc (diff)
parentf415b3055290b383c76d98127ec168ddea629680 (diff)
downloadpodman-b203e6d0f07d2c473c8249d0de173a2ca7176990.tar.gz
podman-b203e6d0f07d2c473c8249d0de173a2ca7176990.tar.bz2
podman-b203e6d0f07d2c473c8249d0de173a2ca7176990.zip
Merge pull request #12365 from mtrmac/random
Don't use a global RNG, and avoid conflicts, when generating NodePorts
Diffstat (limited to 'pkg/domain/infra/abi/generate.go')
-rw-r--r--pkg/domain/infra/abi/generate.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/generate.go b/pkg/domain/infra/abi/generate.go
index 0defa1923..68bb351bf 100644
--- a/pkg/domain/infra/abi/generate.go
+++ b/pkg/domain/infra/abi/generate.go
@@ -139,7 +139,11 @@ func (ic *ContainerEngine) GenerateKube(ctx context.Context, nameOrIDs []string,
podContent = append(podContent, b)
if options.Service {
- b, err := generateKubeYAML(libpod.GenerateKubeServiceFromV1Pod(po, []k8sAPI.ServicePort{}))
+ svc, err := libpod.GenerateKubeServiceFromV1Pod(po, []k8sAPI.ServicePort{})
+ if err != nil {
+ return nil, err
+ }
+ b, err := generateKubeYAML(svc)
if err != nil {
return nil, err
}
@@ -177,7 +181,11 @@ func getKubePods(ctx context.Context, pods []*libpod.Pod, getService bool) ([][]
pos = append(pos, b)
if getService {
- b, err := generateKubeYAML(libpod.GenerateKubeServiceFromV1Pod(po, sp))
+ svc, err := libpod.GenerateKubeServiceFromV1Pod(po, sp)
+ if err != nil {
+ return nil, nil, err
+ }
+ b, err := generateKubeYAML(svc)
if err != nil {
return nil, nil, err
}