package executor import "strings" var configFilePath = "/root/.kube/config" func CheckPodStatus(specific string, supreme string) bool { if !BasicCommandExists("kubectl") { log.Error("kubectl命令不存在,无法查看Pod状态,请查看!") } executor, err := SingleLineCommandExecutor([]string{ "kubectl", "-n", supreme, "get", "pod", specific, "-o", "jsonpath='{.status.phase}'", }) if err != nil { return false } for _, resultLine := range executor { if strings.HasPrefix(resultLine, "Running") { return true } } return false }