summaryrefslogtreecommitdiff
path: root/pkg/adapter/pods.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2019-08-19 13:33:15 +0200
committerGitHub <noreply@github.com>2019-08-19 13:33:15 +0200
commit98dee275d04dafa087db12bc3f0593a078039cfb (patch)
tree51a0fbeae3dd23c6c29c4b74e6a6503557e74a39 /pkg/adapter/pods.go
parent438cbf4c8960db0b59a25a3fb38a778e24a69a40 (diff)
parent7aefc1ac33ba153f6177e9fe3c4da886de49a9e2 (diff)
downloadpodman-98dee275d04dafa087db12bc3f0593a078039cfb.tar.gz
podman-98dee275d04dafa087db12bc3f0593a078039cfb.tar.bz2
podman-98dee275d04dafa087db12bc3f0593a078039cfb.zip
Merge pull request #3836 from chenzhiwei/hostname
Allow customizing pod hostname
Diffstat (limited to 'pkg/adapter/pods.go')
-rw-r--r--pkg/adapter/pods.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/adapter/pods.go b/pkg/adapter/pods.go
index 1dd72babf..ded805de2 100644
--- a/pkg/adapter/pods.go
+++ b/pkg/adapter/pods.go
@@ -256,6 +256,10 @@ func (r *LocalRuntime) CreatePod(ctx context.Context, cli *cliconfig.PodCreateVa
options = append(options, libpod.WithPodName(cli.Name))
}
+ if cli.Flag("hostname").Changed {
+ options = append(options, libpod.WithPodHostname(cli.Hostname))
+ }
+
if cli.Infra {
options = append(options, libpod.WithInfraContainer())
nsOptions, err := shared.GetNamespaceOptions(strings.Split(cli.Share, ","))
@@ -476,6 +480,12 @@ func (r *LocalRuntime) PlayKubeYAML(ctx context.Context, c *cliconfig.KubePlayVa
podOptions = append(podOptions, libpod.WithPodName(podName))
// TODO for now we just used the default kernel namespaces; we need to add/subtract this from yaml
+ hostname := podYAML.Spec.Hostname
+ if hostname == "" {
+ hostname = podName
+ }
+ podOptions = append(podOptions, libpod.WithPodHostname(hostname))
+
nsOptions, err := shared.GetNamespaceOptions(strings.Split(shared.DefaultKernelNamespaces, ","))
if err != nil {
return nil, err