mirror of
https://github.com/containers/podman.git
synced 2025-11-29 17:48:05 +08:00
Use node hostname in kube play when hostNetwork=true
When the hostNetwork option is set to true in the k8s yaml, set the pod's hostname to the name of the machine/node as is done in k8s. Also set the utsns to host. Signed-off-by: Urvashi Mohnani <umohnani@redhat.com>
This commit is contained in:
@@ -146,6 +146,7 @@ type PodCreateOptions struct {
|
||||
VolumesFrom []string `json:"volumes_from,omitempty"`
|
||||
SecurityOpt []string `json:"security_opt,omitempty"`
|
||||
Sysctl []string `json:"sysctl,omitempty"`
|
||||
Uts string `json:"uts,omitempty"`
|
||||
}
|
||||
|
||||
// PodLogsOptions describes the options to extract pod logs.
|
||||
@@ -362,6 +363,12 @@ func ToPodSpecGen(s specgen.PodSpecGenerator, p *PodCreateOptions) (*specgen.Pod
|
||||
return nil, err
|
||||
}
|
||||
s.Ipc = out
|
||||
|
||||
out, err = specgen.ParseNamespace(p.Uts)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
s.UtsNs = out
|
||||
s.Hostname = p.Hostname
|
||||
s.ExitPolicy = p.ExitPolicy
|
||||
s.Labels = p.Labels
|
||||
|
||||
Reference in New Issue
Block a user