summaryrefslogtreecommitdiff
path: root/pkg/specgen/generate/pod_create.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-08-10 10:23:18 +0000
committerGitHub <noreply@github.com>2022-08-10 10:23:18 +0000
commitaa13c73f7130e7f477a9e1af247b79b39b059923 (patch)
treea1866b6c655a0e1b809ff839bfed3adce7f51d28 /pkg/specgen/generate/pod_create.go
parentc4a35313c93b4384766af914bd1241bb77ebdbe5 (diff)
parent842c6c7c6748f8705698d25a29945f8437f1bed2 (diff)
downloadpodman-aa13c73f7130e7f477a9e1af247b79b39b059923.tar.gz
podman-aa13c73f7130e7f477a9e1af247b79b39b059923.tar.bz2
podman-aa13c73f7130e7f477a9e1af247b79b39b059923.zip
Merge pull request #14926 from cdoern/generateSpec
podman generate spec
Diffstat (limited to 'pkg/specgen/generate/pod_create.go')
-rw-r--r--pkg/specgen/generate/pod_create.go14
1 files changed, 14 insertions, 0 deletions
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go
index 4e6362c9b..d6063b9a0 100644
--- a/pkg/specgen/generate/pod_create.go
+++ b/pkg/specgen/generate/pod_create.go
@@ -2,6 +2,7 @@ package generate
import (
"context"
+ "encoding/json"
"fmt"
"net"
"os"
@@ -327,6 +328,19 @@ func PodConfigToSpec(rt *libpod.Runtime, spec *specgen.PodSpecGenerator, infraOp
}
spec.InfraContainerSpec = infraSpec
+ matching, err := json.Marshal(infraSpec)
+ if err != nil {
+ return nil, err
+ }
+
+ // track name before unmarshal so we do not overwrite w/ infra
+ name := spec.Name
+ err = json.Unmarshal(matching, spec)
+ if err != nil {
+ return nil, err
+ }
+
+ spec.Name = name
}
// need to reset hostname, name etc of both pod and infra