Pass HostNetwork value to docker container

This fixes a bug when in host value is specified in api object,
but it is ignored by docker

Closes: #512
Related-To: #512

Change-Id: I57e66a19124d1d0a295396491dbd22e2e2193d31
This commit is contained in:
Kostiantyn Kalynovskyi 2021-04-02 21:34:43 +00:00
parent 34282759af
commit c17246b006
3 changed files with 8 additions and 7 deletions

View File

@ -151,11 +151,12 @@ func (c *clientV1Alpha1) runAirship() error {
c.conf.Spec.Image,
c.conf.Spec.Airship.Cmd)
err = cont.RunCommand(RunCommandOptions{
Privileged: c.conf.Spec.Airship.Privileged,
Cmd: c.conf.Spec.Airship.Cmd,
Mounts: convertDockerMount(c.conf.Spec.StorageMounts),
EnvVars: envs,
Input: decoratedInput,
Privileged: c.conf.Spec.Airship.Privileged,
Cmd: c.conf.Spec.Airship.Cmd,
Mounts: convertDockerMount(c.conf.Spec.StorageMounts),
EnvVars: envs,
Input: decoratedInput,
HostNetwork: c.conf.Spec.HostNetwork,
})
if err != nil {
return err

View File

@ -51,7 +51,7 @@ type Container interface {
// RunCommandOptions options for RunCommand
type RunCommandOptions struct {
Privileged bool
HostNewtork bool
HostNetwork bool
Cmd []string
EnvVars []string

View File

@ -202,7 +202,7 @@ func (c *DockerContainer) getConfig(opts RunCommandOptions) (container.Config, c
Mounts: mounts,
Privileged: opts.Privileged,
}
if opts.HostNewtork {
if opts.HostNetwork {
hCfg.NetworkMode = "host"
}
return cCfg, hCfg, nil