Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check for iptables file before determining container is running #8565

Merged
merged 2 commits into from
Jun 26, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions pkg/drivers/kic/oci/oci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
priyawadhwa marked this conversation as resolved.
Show resolved Hide resolved
return fmt.Errorf("iptables file doesn't exist, see #8179")
}
glog.Infof("the created container %q has a running status.", p.Name)
return nil
}
Expand Down Expand Up @@ -576,3 +579,16 @@ 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
// TODO: https://github.com/kubernetes/minikube/issues/8179
func iptablesFileExists(ociBin string, nameOrID string) bool {
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
}