From 9ec8a60eae8987f06d1971634c438586534d2987 Mon Sep 17 00:00:00 2001 From: zhangguanzhang Date: Mon, 31 Aug 2020 22:12:35 +0800 Subject: handle play kube with pod.spec.hostAliases Signed-off-by: zhangguanzhang --- pkg/spec/createconfig.go | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'pkg/spec') diff --git a/pkg/spec/createconfig.go b/pkg/spec/createconfig.go index e0c875fe9..4887e9262 100644 --- a/pkg/spec/createconfig.go +++ b/pkg/spec/createconfig.go @@ -267,6 +267,16 @@ func (c *CreateConfig) getContainerCreateOptions(runtime *libpod.Runtime, pod *l options = append(options, runtime.WithPod(pod)) } + // handle some spec from the InfraContainer when it's a pod + if pod != nil && pod.HasInfraContainer() { + InfraCtr, err := pod.InfraContainer() + if err != nil { + return nil, err + } + // handle the pod.spec.hostAliases + options = append(options, libpod.WithHosts(InfraCtr.HostsAdd())) + } + if len(mounts) != 0 || len(namedVolumes) != 0 { destinations := []string{} -- cgit v1.2.3-54-g00ecf