Refactor to adopt k8s standardized Condition type
Updates to use metav1.Condition type and removes references for deprecated corev1.Condition* constants and uses the new k8s api/meta helpers in place of the old pkg/apis/meta types. Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
This commit is contained in:
@@ -26,6 +26,7 @@ import (
|
||||
"github.com/spf13/cobra"
|
||||
corev1 "k8s.io/api/core/v1"
|
||||
"k8s.io/apimachinery/pkg/api/errors"
|
||||
apimeta "k8s.io/apimachinery/pkg/api/meta"
|
||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||
"k8s.io/apimachinery/pkg/types"
|
||||
"k8s.io/apimachinery/pkg/util/wait"
|
||||
@@ -179,11 +180,11 @@ func isAlertReady(ctx context.Context, kubeClient client.Client,
|
||||
return false, err
|
||||
}
|
||||
|
||||
if c := meta.GetCondition(alert.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||
if c := apimeta.FindStatusCondition(alert.Status.Conditions, meta.ReadyCondition); c != nil {
|
||||
switch c.Status {
|
||||
case corev1.ConditionTrue:
|
||||
case metav1.ConditionTrue:
|
||||
return true, nil
|
||||
case corev1.ConditionFalse:
|
||||
case metav1.ConditionFalse:
|
||||
return false, fmt.Errorf(c.Message)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user