From c717b3cacad00ec8ea5415a2246994ac3adf7ae0 Mon Sep 17 00:00:00 2001
From: Paul Holzinger <paul.holzinger@web.de>
Date: Tue, 24 Nov 2020 14:56:35 +0100
Subject: Allow static ip and mac with rootless cni network

Make sure we pass the ip and mac address as CNI_ARGS to
the cnitool which is executed in the rootless-cni-infra
container.

Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
---
 pkg/specgen/container_validate.go | 2 +-
 pkg/specgen/pod_validate.go       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

(limited to 'pkg/specgen')

diff --git a/pkg/specgen/container_validate.go b/pkg/specgen/container_validate.go
index a0d36f865..81cb8b78d 100644
--- a/pkg/specgen/container_validate.go
+++ b/pkg/specgen/container_validate.go
@@ -30,7 +30,7 @@ func exclusiveOptions(opt1, opt2 string) error {
 // input for creating a container.
 func (s *SpecGenerator) Validate() error {
 
-	if rootless.IsRootless() {
+	if rootless.IsRootless() && len(s.CNINetworks) == 0 {
 		if s.StaticIP != nil || s.StaticIPv6 != nil {
 			return ErrNoStaticIPRootless
 		}
diff --git a/pkg/specgen/pod_validate.go b/pkg/specgen/pod_validate.go
index 7c81f3f9f..518adb32f 100644
--- a/pkg/specgen/pod_validate.go
+++ b/pkg/specgen/pod_validate.go
@@ -20,7 +20,7 @@ func exclusivePodOptions(opt1, opt2 string) error {
 // Validate verifies the input is valid
 func (p *PodSpecGenerator) Validate() error {
 
-	if rootless.IsRootless() {
+	if rootless.IsRootless() && len(p.CNINetworks) == 0 {
 		if p.StaticIP != nil {
 			return ErrNoStaticIPRootless
 		}
-- 
cgit v1.2.3-54-g00ecf