diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2021-07-16 07:53:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-16 07:53:43 -0400 |
commit | ce28dc3c4c3dba468ddb6f2a249c0c4bfc058805 (patch) | |
tree | 0f16371ff56a8323db480d010b0315e600c2a50b /pkg/specgen | |
parent | 3ba9f2a205787135b4e34e4d217df3ab9d0071b8 (diff) | |
parent | af40dfc2bf614aeb4191916cc2420068696eb776 (diff) | |
download | podman-ce28dc3c4c3dba468ddb6f2a249c0c4bfc058805.tar.gz podman-ce28dc3c4c3dba468ddb6f2a249c0c4bfc058805.tar.bz2 podman-ce28dc3c4c3dba468ddb6f2a249c0c4bfc058805.zip |
Merge pull request #10820 from jvanz/indfra-container-name-issue-10794
--infra-name command line argument
Diffstat (limited to 'pkg/specgen')
-rw-r--r-- | pkg/specgen/generate/pod_create.go | 4 | ||||
-rw-r--r-- | pkg/specgen/pod_validate.go | 3 | ||||
-rw-r--r-- | pkg/specgen/podspecgen.go | 6 |
3 files changed, 13 insertions, 0 deletions
diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index 4ffd8a37f..aab29499e 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -98,6 +98,10 @@ func createPodOptions(p *specgen.PodSpecGenerator, rt *libpod.Runtime) ([]libpod options = append(options, libpod.WithInfraImage(p.InfraImage)) } + if len(p.InfraName) > 0 { + options = append(options, libpod.WithInfraName(p.InfraName)) + } + if len(p.InfraCommand) > 0 { options = append(options, libpod.WithInfraCommand(p.InfraCommand)) } diff --git a/pkg/specgen/pod_validate.go b/pkg/specgen/pod_validate.go index c746bcd1a..bca7b6dbe 100644 --- a/pkg/specgen/pod_validate.go +++ b/pkg/specgen/pod_validate.go @@ -36,6 +36,9 @@ func (p *PodSpecGenerator) Validate() error { if len(p.InfraImage) > 0 { return exclusivePodOptions("NoInfra", "InfraImage") } + if len(p.InfraName) > 0 { + return exclusivePodOptions("NoInfra", "InfraName") + } if len(p.SharedNamespaces) > 0 { return exclusivePodOptions("NoInfra", "SharedNamespaces") } diff --git a/pkg/specgen/podspecgen.go b/pkg/specgen/podspecgen.go index 319345c71..02237afe9 100644 --- a/pkg/specgen/podspecgen.go +++ b/pkg/specgen/podspecgen.go @@ -43,6 +43,12 @@ type PodBasicConfig struct { // Conflicts with NoInfra=true. // Optional. InfraImage string `json:"infra_image,omitempty"` + // InfraName is the name that will be used for the infra container. + // If not set, the default set in the Libpod configuration file will be + // used. + // Conflicts with NoInfra=true. + // Optional. + InfraName string `json:"infra_name,omitempty"` // SharedNamespaces instructs the pod to share a set of namespaces. // Shared namespaces will be joined (by default) by every container // which joins the pod. |