Need to test storage driver of container runtime

pull/8581/head
Anders F Björklund 2020-06-30 18:56:30 +02:00
parent eaeb5f6060
commit b3e5e709fa
2 changed files with 20 additions and 8 deletions

View File

@ -60,6 +60,10 @@ func generateTarball(kubernetesVersion, containerRuntime, tarballFilename string
return errors.Wrap(err, "creating kic driver")
}
if err := verifyStorage(containerRuntime); err != nil {
return errors.Wrap(err, "verifying storage")
}
// Now, get images to pull
imgs, err := images.Kubeadm("", kubernetesVersion)
if err != nil {
@ -128,6 +132,20 @@ func generateTarball(kubernetesVersion, containerRuntime, tarballFilename string
return copyTarballToHost(tarballFilename)
}
func verifyStorage(containerRuntime string) error {
if containerRuntime == "docker" || containerRuntime == "containerd" {
if err := verifyDockerStorage(); err != nil {
return errors.Wrap(err, "Docker storage type is incompatible")
}
}
if containerRuntime == "cri-o" {
if err := verifyPodmanStorage(); err != nil {
return errors.Wrap(err, "Podman storage type is incompatible")
}
}
return nil
}
// returns the right command to pull image for a specific runtime
func imagePullCommand(containerRuntime, img string) *exec.Cmd {
if containerRuntime == "docker" {

View File

@ -64,12 +64,6 @@ func main() {
fmt.Printf("error cleaning up minikube at start up: %v \n", err)
}
if err := verifyDockerStorage(); err != nil {
exit("Docker storage type is incompatible: %v \n", err)
}
if err := verifyPodmanStorage(); err != nil {
exit("Podman storage type is incompatible: %v \n", err)
}
if k8sVersions == nil {
var err error
k8sVersions, err = RecentK8sVersions()
@ -104,7 +98,7 @@ func main() {
}
func verifyDockerStorage() error {
cmd := exec.Command("docker", "info", "-f", "{{.Info.Driver}}")
cmd := exec.Command("docker", "exec", profile, "docker", "info", "-f", "{{.Info.Driver}}")
var stderr bytes.Buffer
cmd.Stderr = &stderr
output, err := cmd.Output()
@ -119,7 +113,7 @@ func verifyDockerStorage() error {
}
func verifyPodmanStorage() error {
cmd := exec.Command("sudo", "podman", "info", "-f", "json")
cmd := exec.Command("docker", "exec", profile, "sudo", "podman", "info", "-f", "json")
var stderr bytes.Buffer
cmd.Stderr = &stderr
output, err := cmd.Output()