-
Notifications
You must be signed in to change notification settings - Fork 159
/
status.go
29 lines (22 loc) · 888 Bytes
/
status.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package helpers
import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
func IsStatusConditionPresentAndTrue(conditions []metav1.Condition, conditionType string, generation int64) bool {
return IsStatusConditionPresentAndEqual(conditions, conditionType, metav1.ConditionTrue, generation)
}
func IsStatusConditionPresentAndFalse(conditions []metav1.Condition, conditionType string, generation int64) bool {
return IsStatusConditionPresentAndEqual(conditions, conditionType, metav1.ConditionFalse, generation)
}
func IsStatusConditionPresentAndEqual(conditions []metav1.Condition, conditionType string, status metav1.ConditionStatus, generation int64) bool {
for _, condition := range conditions {
if condition.Type != conditionType {
continue
}
if condition.ObservedGeneration != generation {
return false
}
return condition.Status == status
}
return false
}