Add APIs for computing status based on fetching resource info from a

cluster
This commit is contained in:
Morten Torkildsen
2019-11-15 18:51:56 -08:00
parent e5382c59a2
commit a489f30183
15 changed files with 1371 additions and 13 deletions

View File

@@ -6,8 +6,8 @@ package status
import (
"fmt"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
corev1 "sigs.k8s.io/kustomize/pseudo/k8s/api/core/v1"
"sigs.k8s.io/kustomize/pseudo/k8s/apimachinery/pkg/apis/meta/v1/unstructured"
)
// GetConditionsFn defines the signature for functions to compute the
@@ -36,6 +36,8 @@ const (
tooFewAvailable = "LessAvailable"
tooFewUpdated = "LessUpdated"
tooFewReplicas = "LessReplicas"
onDeleteUpdateStrategy = "OnDelete"
)
// GetLegacyConditionsFn returns a function that can compute the status for the
@@ -71,7 +73,7 @@ func stsConditions(u *unstructured.Unstructured) (*Result, error) {
// updateStrategy==ondelete is a user managed statefulset.
updateStrategy := GetStringField(obj, ".spec.updateStrategy.type", "")
if updateStrategy == "ondelete" {
if updateStrategy == onDeleteUpdateStrategy {
return &Result{
Status: CurrentStatus,
Message: "StatefulSet is using the ondelete update strategy",