mirror of
https://github.com/kyverno/kyverno.git
synced 2024-12-14 11:57:48 +00:00
13 lines
313 B
Go
13 lines
313 B
Go
package policy
|
|
|
|
import "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
|
|
|
|
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"
|
|
}
|