From adb10783d9117bbbb8311079b26a08b8c3bd0b64 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 27 Apr 2020 12:57:09 +0200 Subject: spec, pod: honor --dns Signed-off-by: Giuseppe Scrivano --- pkg/specgen/generate/pod_create.go | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'pkg') diff --git a/pkg/specgen/generate/pod_create.go b/pkg/specgen/generate/pod_create.go index 292f9b155..babfba9bc 100644 --- a/pkg/specgen/generate/pod_create.go +++ b/pkg/specgen/generate/pod_create.go @@ -46,6 +46,13 @@ func createPodOptions(p *specgen.PodSpecGenerator) ([]libpod.PodCreateOption, er if len(p.HostAdd) > 0 { options = append(options, libpod.WithPodHosts(p.HostAdd)) } + if len(p.DNSServer) > 0 { + var dnsServers []string + for _, d := range p.DNSServer { + dnsServers = append(dnsServers, d.String()) + } + options = append(options, libpod.WithPodDNS(dnsServers)) + } if len(p.DNSOption) > 0 { options = append(options, libpod.WithPodDNSOption(p.DNSOption)) } -- cgit v1.2.3-54-g00ecf From c2f77a281f40c4219a8bcc266d6f3a8245cc5920 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 27 Apr 2020 13:12:12 +0200 Subject: specgen: relax test to accept default network Signed-off-by: Giuseppe Scrivano --- pkg/specgen/pod_validate.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/specgen/pod_validate.go b/pkg/specgen/pod_validate.go index f2f90e58d..98d59549e 100644 --- a/pkg/specgen/pod_validate.go +++ b/pkg/specgen/pod_validate.go @@ -62,7 +62,7 @@ func (p *PodSpecGenerator) Validate() error { return exclusivePodOptions("NoInfra", "NoManageResolvConf") } } - if p.NetNS.NSMode != Bridge { + if p.NetNS.NSMode != "" && p.NetNS.NSMode != Bridge && p.NetNS.NSMode != Default { if len(p.PortMappings) > 0 { return errors.New("PortMappings can only be used with Bridge mode networking") } -- cgit v1.2.3-54-g00ecf From e589c2219f0e608b01b66d54856b40cc6de94693 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 27 Apr 2020 13:19:05 +0200 Subject: pkg, pods: honor --ignore for pod stop Signed-off-by: Giuseppe Scrivano --- pkg/domain/infra/abi/pods.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 7732d5aa3..2d1c09670 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -145,7 +145,7 @@ func (ic *ContainerEngine) PodStop(ctx context.Context, namesOrIds []string, opt reports []*entities.PodStopReport ) pods, err := getPodsByContext(options.All, options.Latest, namesOrIds, ic.Libpod) - if err != nil { + if err != nil && !(options.Ignore && errors.Cause(err) == define.ErrNoSuchPod) { return nil, err } for _, p := range pods { -- cgit v1.2.3-54-g00ecf From 4028215b6a83cc8bd059ad1e902dc3e6a39e1b74 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 27 Apr 2020 13:41:08 +0200 Subject: pkg, pods: not lose pod start/restart errors Signed-off-by: Giuseppe Scrivano --- pkg/domain/infra/abi/pods.go | 2 ++ 1 file changed, 2 insertions(+) (limited to 'pkg') diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 2d1c09670..49f9f2771 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -180,6 +180,7 @@ func (ic *ContainerEngine) PodRestart(ctx context.Context, namesOrIds []string, errs, err := p.Restart(ctx) if err != nil { report.Errs = []error{err} + reports = append(reports, &report) continue } if len(errs) > 0 { @@ -207,6 +208,7 @@ func (ic *ContainerEngine) PodStart(ctx context.Context, namesOrIds []string, op errs, err := p.Start(ctx) if err != nil { report.Errs = []error{err} + reports = append(reports, &report) continue } if len(errs) > 0 { -- cgit v1.2.3-54-g00ecf From 1aaef86eb4e90ef6ce973a90a5a2b82aff78f4bf Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 27 Apr 2020 13:44:15 +0200 Subject: pkg, pods: pod rm honors --ignore Signed-off-by: Giuseppe Scrivano --- pkg/domain/infra/abi/pods.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'pkg') diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 49f9f2771..3a71a3253 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -228,7 +228,7 @@ func (ic *ContainerEngine) PodRm(ctx context.Context, namesOrIds []string, optio reports []*entities.PodRmReport ) pods, err := getPodsByContext(options.All, options.Latest, namesOrIds, ic.Libpod) - if err != nil { + if err != nil && !(options.Ignore && errors.Cause(err) == define.ErrNoSuchPod) { return nil, err } for _, p := range pods { -- cgit v1.2.3-54-g00ecf From 869a1a211a5e35c87eef36dc5fe8dd12c645d3c7 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Mon, 27 Apr 2020 14:02:46 +0200 Subject: pkg, pods: report pod rm errors Signed-off-by: Giuseppe Scrivano --- pkg/domain/infra/abi/pods.go | 1 + 1 file changed, 1 insertion(+) (limited to 'pkg') diff --git a/pkg/domain/infra/abi/pods.go b/pkg/domain/infra/abi/pods.go index 3a71a3253..7c06f9a4e 100644 --- a/pkg/domain/infra/abi/pods.go +++ b/pkg/domain/infra/abi/pods.go @@ -236,6 +236,7 @@ func (ic *ContainerEngine) PodRm(ctx context.Context, namesOrIds []string, optio err := ic.Libpod.RemovePod(ctx, p, true, options.Force) if err != nil { report.Err = err + reports = append(reports, &report) continue } reports = append(reports, &report) -- cgit v1.2.3-54-g00ecf