handle play kube with pod.spec.hostAliases

Signed-off-by: zhangguanzhang <zhangguanzhang@qq.com>
This commit is contained in:
zhangguanzhang
2020-08-31 22:12:35 +08:00
parent 3352e8b0e6
commit 9ec8a60eae
3 changed files with 68 additions and 1 deletions

View File

@ -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{}