e2e test support microk8s

microk8s run kubelet service as `snap.microk8s.daemon-kubelet.service`, instead of `kubelet.service`.
so e2e should use `systemctl list-units *kubelet* --state=running` to find out kubelet service of microk8s.
This commit is contained in:
Pu Wang 2020-09-13 16:11:50 +08:00 committed by GitHub
parent 66334f02e8
commit 40f2d1b8ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -375,7 +375,7 @@ func getCRIClient() (internalapi.RuntimeService, internalapi.ImageManagerService
// TODO: Find a uniform way to deal with systemctl/initctl/service operations. #34494
func findRunningKubletServiceName() string {
stdout, err := exec.Command("sudo", "systemctl", "list-units", "kubelet*", "--state=running").CombinedOutput()
stdout, err := exec.Command("sudo", "systemctl", "list-units", "*kubelet*", "--state=running").CombinedOutput()
framework.ExpectNoError(err)
regex := regexp.MustCompile("(kubelet-\\w+)")
matches := regex.FindStringSubmatch(string(stdout))