2019-08-23 18:34:23 -07:00
|
|
|
package policy
|
|
|
|
|
2020-06-25 09:52:27 -07:00
|
|
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
|
|
|
|
2020-01-25 14:53:12 +05:30
|
|
|
//Contains Check if strint is contained in a list of string
|
|
|
|
func containString(list []string, element string) bool {
|
|
|
|
for _, e := range list {
|
|
|
|
if e == element {
|
|
|
|
return true
|
|
|
|
}
|
2019-08-23 18:34:23 -07:00
|
|
|
}
|
2020-01-25 14:53:12 +05:30
|
|
|
return false
|
2019-08-23 18:34:23 -07:00
|
|
|
}
|
2020-06-25 09:52:27 -07:00
|
|
|
|
|
|
|
func isRunningPod(obj unstructured.Unstructured) bool {
|
|
|
|
objMap := obj.UnstructuredContent()
|
|
|
|
phase, ok, err := unstructured.NestedString(objMap, "status", "phase")
|
|
|
|
if !ok || err != nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
|
|
|
|
return phase == "Running"
|
|
|
|
}
|