summaryrefslogtreecommitdiff
path: root/libpod/runtime_pod_infra_linux.go
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@pm.me>2020-02-03 11:17:32 -0500
committerMatthew Heon <mheon@redhat.com>2020-02-04 10:07:14 -0500
commit07a8ab09e05052e6776395ba3b0275d7f9921ef2 (patch)
tree24bc3a17d337aae463b74421532c78132921fc50 /libpod/runtime_pod_infra_linux.go
parent28eb296653f78f462c07e3fe6b156bc093ff44c6 (diff)
downloadpodman-07a8ab09e05052e6776395ba3b0275d7f9921ef2.tar.gz
podman-07a8ab09e05052e6776395ba3b0275d7f9921ef2.tar.bz2
podman-07a8ab09e05052e6776395ba3b0275d7f9921ef2.zip
Add backend code for pod network options
This adds network-related options to the pod in the database. We are going to add the CLI frontend in further patches. In short, this should greatly improve the ability of pods to configure networking, once the CLI parsing is added. Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'libpod/runtime_pod_infra_linux.go')
-rw-r--r--libpod/runtime_pod_infra_linux.go28
1 files changed, 26 insertions, 2 deletions
diff --git a/libpod/runtime_pod_infra_linux.go b/libpod/runtime_pod_infra_linux.go
index 6a27c2800..1b1421ca8 100644
--- a/libpod/runtime_pod_infra_linux.go
+++ b/libpod/runtime_pod_infra_linux.go
@@ -94,14 +94,38 @@ func (r *Runtime) makeInfraContainer(ctx context.Context, p *Pod, imgName, imgID
options = append(options, withIsInfra())
// Since user namespace sharing is not implemented, we only need to check if it's rootless
- networks := make([]string, 0)
netmode := "bridge"
if isRootless {
netmode = "slirp4netns"
}
// PostConfigureNetNS should not be set since user namespace sharing is not implemented
// and rootless networking no longer supports post configuration setup
- options = append(options, WithNetNS(p.config.InfraContainer.PortBindings, false, netmode, networks))
+ options = append(options, WithNetNS(p.config.InfraContainer.PortBindings, false, netmode, p.config.InfraContainer.Networks))
+
+ if p.config.InfraContainer.StaticIP != nil {
+ options = append(options, WithStaticIP(p.config.InfraContainer.StaticIP))
+ }
+ if p.config.InfraContainer.StaticMAC != nil {
+ options = append(options, WithStaticMAC(p.config.InfraContainer.StaticMAC))
+ }
+ if p.config.InfraContainer.UseImageResolvConf {
+ options = append(options, WithUseImageResolvConf())
+ }
+ if len(p.config.InfraContainer.DNSServer) > 0 {
+ options = append(options, WithDNS(p.config.InfraContainer.DNSServer))
+ }
+ if len(p.config.InfraContainer.DNSSearch) > 0 {
+ options = append(options, WithDNSSearch(p.config.InfraContainer.DNSSearch))
+ }
+ if len(p.config.InfraContainer.DNSOption) > 0 {
+ options = append(options, WithDNSOption(p.config.InfraContainer.DNSOption))
+ }
+ if p.config.InfraContainer.UseImageHosts {
+ options = append(options, WithUseImageHosts())
+ }
+ if len(p.config.InfraContainer.HostAdd) > 0 {
+ options = append(options, WithHosts(p.config.InfraContainer.HostAdd))
+ }
return r.newContainer(ctx, g.Config, options...)
}