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