diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-12-02 20:00:48 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-02 20:00:48 +0100 |
commit | b203e6d0f07d2c473c8249d0de173a2ca7176990 (patch) | |
tree | c8caa18d420db8acf321a36036576b8b653fc297 /pkg/domain/infra/abi/generate.go | |
parent | 4ff0ba4c8731e3dc1d56010f80468260104f3abc (diff) | |
parent | f415b3055290b383c76d98127ec168ddea629680 (diff) | |
download | podman-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.go | 12 |
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 } |