summaryrefslogtreecommitdiff
path: root/pkg
diff options
context:
space:
mode:
Diffstat (limited to 'pkg')
-rw-r--r--pkg/domain/infra/abi/play.go10
-rw-r--r--pkg/spec/createconfig.go10
2 files changed, 20 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
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{}