summaryrefslogtreecommitdiff
path: root/pkg/specgen
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-04-22 08:50:32 -0400
committerGitHub <noreply@github.com>2022-04-22 08:50:32 -0400
commitad3da638ce17439a7adbf2aa7e1b4017d583f660 (patch)
tree4a975c6d37e9a3dad98b8e2f3119f58650589d5c /pkg/specgen
parent1bafde2d226067257d430c367ec2c53208d3eeeb (diff)
parente0f5bf279bd6aba1b018c2a2d7d31ee5a5f7b70b (diff)
downloadpodman-ad3da638ce17439a7adbf2aa7e1b4017d583f660.tar.gz
podman-ad3da638ce17439a7adbf2aa7e1b4017d583f660.tar.bz2
podman-ad3da638ce17439a7adbf2aa7e1b4017d583f660.zip
Merge pull request #13918 from Luap99/hosts
use etchosts package from c/common
Diffstat (limited to 'pkg/specgen')
-rw-r--r--pkg/specgen/container_validate.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/pkg/specgen/container_validate.go b/pkg/specgen/container_validate.go
index 42b70e334..e06cd9a29 100644
--- a/pkg/specgen/container_validate.go
+++ b/pkg/specgen/container_validate.go
@@ -38,6 +38,13 @@ func (s *SpecGenerator) Validate() error {
if len(s.PortMappings) > 0 || s.PublishExposedPorts {
return errors.Wrap(define.ErrNetworkOnPodContainer, "published or exposed ports must be defined when the pod is created")
}
+ if len(s.HostAdd) > 0 {
+ return errors.Wrap(define.ErrNetworkOnPodContainer, "extra host entries must be specified on the pod")
+ }
+ }
+
+ if s.NetNS.IsContainer() && len(s.HostAdd) > 0 {
+ return errors.Wrap(ErrInvalidSpecConfig, "cannot set extra host entries when the container is joined to another containers network namespace")
}
//