From 903686172d3b4c89d8a9fbe746c625dc24f8ede6 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Thu, 25 Jun 2020 17:56:09 -0700 Subject: [PATCH 1/2] Check for iptables file before determining container is running --- pkg/drivers/kic/oci/oci.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pkg/drivers/kic/oci/oci.go b/pkg/drivers/kic/oci/oci.go index a54f3ca43363..c1fed20db7e2 100644 --- a/pkg/drivers/kic/oci/oci.go +++ b/pkg/drivers/kic/oci/oci.go @@ -212,6 +212,9 @@ func CreateContainerNode(p CreateParams) error { if s != state.Running { return fmt.Errorf("temporary error created container %q is not running yet", p.Name) } + if !iptablesFileExists(p.OCIBinary, p.Name) { + return fmt.Errorf("iptables file doesn't exist, see #8179") + } glog.Infof("the created container %q has a running status.", p.Name) return nil } @@ -576,3 +579,19 @@ func ShutDown(ociBin string, name string) error { glog.Infof("Successfully shutdown container %s", name) return nil } + +// iptablesFileExists checks if /var/lib/dpkg/alternatives/iptables exists in minikube +// this file is necessary for the entrypoint script to pass +// see: https://github.com/kubernetes/minikube/issues/8179 +func iptablesFileExists(ociBin string, nameOrID string) bool { + if ociBin != Docker { + return true + } + file := "/var/lib/dpkg/alternatives/iptables" + _, err := runCmd(exec.Command(ociBin, "exec", nameOrID, "stat", file), false) + if err != nil { + glog.Warningf("error checking if %s exists: %v", file, err) + return false + } + return true +} From e32e2135edcaae2d754564f0ca594be64dd36e48 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Thu, 25 Jun 2020 19:39:59 -0700 Subject: [PATCH 2/2] review comments --- pkg/drivers/kic/oci/oci.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/pkg/drivers/kic/oci/oci.go b/pkg/drivers/kic/oci/oci.go index c1fed20db7e2..9ef0575f07ec 100644 --- a/pkg/drivers/kic/oci/oci.go +++ b/pkg/drivers/kic/oci/oci.go @@ -582,11 +582,8 @@ func ShutDown(ociBin string, name string) error { // iptablesFileExists checks if /var/lib/dpkg/alternatives/iptables exists in minikube // this file is necessary for the entrypoint script to pass -// see: https://github.com/kubernetes/minikube/issues/8179 +// TODO: https://github.com/kubernetes/minikube/issues/8179 func iptablesFileExists(ociBin string, nameOrID string) bool { - if ociBin != Docker { - return true - } file := "/var/lib/dpkg/alternatives/iptables" _, err := runCmd(exec.Command(ociBin, "exec", nameOrID, "stat", file), false) if err != nil {