diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2020-08-31 13:49:03 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-31 13:49:03 -0400 |
commit | 0c076dbce5fcdc3e1994df099db77c7d51a51dec (patch) | |
tree | 74d452debff1340f1279d0e08a613c05607af999 /pkg/domain | |
parent | 3352e8b0e6bb77344a4470ef86b2d2dc6262a668 (diff) | |
parent | 9ec8a60eae8987f06d1971634c438586534d2987 (diff) | |
download | podman-0c076dbce5fcdc3e1994df099db77c7d51a51dec.tar.gz podman-0c076dbce5fcdc3e1994df099db77c7d51a51dec.tar.bz2 podman-0c076dbce5fcdc3e1994df099db77c7d51a51dec.zip |
Merge pull request #7496 from zhangguanzhang/play-kube-handle-hostAliases
handle play kube with pod.spec.hostAliases
Diffstat (limited to 'pkg/domain')
-rw-r--r-- | pkg/domain/infra/abi/play.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/pkg/domain/infra/abi/play.go b/pkg/domain/infra/abi/play.go index 729cd143c..31ad51672 100644 --- a/pkg/domain/infra/abi/play.go +++ b/pkg/domain/infra/abi/play.go @@ -144,6 +144,16 @@ func (ic *ContainerEngine) playKubePod(ctx context.Context, podName string, podY podOptions = append(podOptions, libpod.WithPodHostNetwork()) } + if podYAML.Spec.HostAliases != nil { + hosts := make([]string, 0, len(podYAML.Spec.HostAliases)) + for _, hostAlias := range podYAML.Spec.HostAliases { + for _, host := range hostAlias.Hostnames { + hosts = append(hosts, host+":"+hostAlias.IP) + } + } + podOptions = append(podOptions, libpod.WithPodHosts(hosts)) + } + nsOptions, err := generate.GetNamespaceOptions(strings.Split(createconfig.DefaultKernelNamespaces, ",")) if err != nil { return nil, err |