Documentation ¶
Index ¶
- Variables
- func AggregateResult(obj *status.Object, subStatuses []status.ObjectStatus, ...) status.ObjectStatus
- func AnalyzeConditions(conditions []*metav1.Condition, analyzers []ConditionAnalyzer) []status.ConditionStatus
- func AnalyzeObjectConditions(obj *status.Object, analyzers []ConditionAnalyzer) ([]status.ConditionStatus, error)
- func AnalyzeObservedGeneration(obj *status.Object) []status.ConditionStatus
- func AnalyzeRawConditions(data []interface{}, analyzers []ConditionAnalyzer) ([]status.ConditionStatus, error)
- func ConditionStatusError(cond *metav1.Condition) status.ConditionStatus
- func ConditionStatusOk(cond *metav1.Condition) status.ConditionStatus
- func ConditionStatusProgressing(cond *metav1.Condition) status.ConditionStatus
- func ConditionStatusUnknown(cond *metav1.Condition) status.ConditionStatus
- func ConditionStatusUnknownWithError(cond *metav1.Condition, err error) status.ConditionStatus
- func ConditionStatusWarning(cond *metav1.Condition) status.ConditionStatus
- func DefaultAnalyzerInit(e *eval.Evaluator) eval.Analyzer
- func DefaultAnalyzers() []eval.AnalyzerInit
- func FromUnstructured(data map[string]interface{}, obj interface{}) error
- func GenericOwnerQuerySpec(obj *status.Object) eval.OwnerQuerySpec
- func SyntheticCondition(condType string, statusVal bool, reason, message string, ...) *metav1.Condition
- func SyntheticConditionError(condType, reason, message string) status.ConditionStatus
- func SyntheticConditionOk(condType, message string) status.ConditionStatus
- func SyntheticConditionProgressing(condType, reason, message string) status.ConditionStatus
- func SyntheticConditionWarning(condType, reason, message string) status.ConditionStatus
- type AlwaysGreenAnalyzer
- type AnalyzerRegister
- type ConditionAnalyzer
- type DeploymentAnalyzer
- type GenericAnalyzer
- type GenericConditionAnalyzer
- type Matcher
- type PVCAnalyzer
- type PodAnalyzer
- type RegexpMatcher
- type ReplicaSetAnalyzer
- type ServiceAnalyzer
- type StringMatcher
Constants ¶
This section is empty.
Variables ¶
var ( // DefaultAlwaysGreenAnalyzer is an analyzer that always returns OK status. // It's empty right now, but it can be configured to match specific kinds // we want to always consider OK. DefaultAlwaysGreenAnalyzer = AlwaysGreenAnalyzer{ Kinds: []schema.GroupKind{ {Group: "", Kind: "Namespace"}, }, } // ConditionStatusNoMatch is returned by condition analyzer when it's not // applicable to the condition. ConditionStatusNoMatch = status.ConditionStatus{} // Register is a global registry of analyzers. Register = &AnalyzerRegister{} )
var ( // CommonConditionsAnalyzer is a generic condition analyzer that can be used // for any condition type. It's one of the default analyzers. CommonConditionsAnalyzer = GenericConditionAnalyzer{ MatchAll: true, Conditions: NewStringMatchers("Ready"), ReversedPolarityConditions: append(NewRegexpMatchers("Degraded", "Pressure", "Detected"), NewStringMatchers("Progressing")...), ProgressingConditions: NewStringMatchers("Progressing"), WarningConditions: NewRegexpMatchers("Degraded", "Pressure", "Detected"), UnknownConditions: NewRegexpMatchers("Disabled"), } // DefaultConditionAnalyzers is a list of condition analyzers that are used // by default. They should be applicable to a broad range of resources. DefaultConditionAnalyzers = []ConditionAnalyzer{CommonConditionsAnalyzer} )
ignoredGroupKinds is a list of GroupKinds that are ignored by the default when evaluating sub-objects. These are mostly resources that are not interesting for the status evaluation.
Functions ¶
func AggregateResult ¶
func AggregateResult(obj *status.Object, subStatuses []status.ObjectStatus, conditions []status.ConditionStatus) status.ObjectStatus
func AnalyzeConditions ¶
func AnalyzeConditions(conditions []*metav1.Condition, analyzers []ConditionAnalyzer) []status.ConditionStatus
func AnalyzeObjectConditions ¶
func AnalyzeObjectConditions(obj *status.Object, analyzers []ConditionAnalyzer) ([]status.ConditionStatus, error)
AnalyzeObjectConditions analyzes the conditions of the object using the provided analyzers. It expects the conditions to be in the "status.conditions" field of the object.
func AnalyzeObservedGeneration ¶
func AnalyzeObservedGeneration(obj *status.Object) []status.ConditionStatus
GenericConditionAnalyzers adds additional conditions based on values of generation and observedGeneration fields.
func AnalyzeRawConditions ¶
func AnalyzeRawConditions(data []interface{}, analyzers []ConditionAnalyzer) ([]status.ConditionStatus, error)
func ConditionStatusError ¶
func ConditionStatusError(cond *metav1.Condition) status.ConditionStatus
func ConditionStatusOk ¶
func ConditionStatusOk(cond *metav1.Condition) status.ConditionStatus
func ConditionStatusProgressing ¶
func ConditionStatusProgressing(cond *metav1.Condition) status.ConditionStatus
func ConditionStatusUnknown ¶
func ConditionStatusUnknown(cond *metav1.Condition) status.ConditionStatus
func ConditionStatusUnknownWithError ¶
func ConditionStatusUnknownWithError(cond *metav1.Condition, err error) status.ConditionStatus
func ConditionStatusWarning ¶
func ConditionStatusWarning(cond *metav1.Condition) status.ConditionStatus
func DefaultAnalyzers ¶
func DefaultAnalyzers() []eval.AnalyzerInit
func FromUnstructured ¶
func GenericOwnerQuerySpec ¶
func GenericOwnerQuerySpec(obj *status.Object) eval.OwnerQuerySpec
func SyntheticCondition ¶
func SyntheticCondition(condType string, statusVal bool, reason, message string, lastTransitionTime time.Time) *metav1.Condition
SyntheticCondition creates a synthetic condition with the given values. It's used for cases when the condition is not present in the object but we want to indicate a particular status. For example, when the object is not reporting Ready condition, we can synthesize it based on other conditions.
func SyntheticConditionError ¶
func SyntheticConditionError(condType, reason, message string) status.ConditionStatus
func SyntheticConditionOk ¶
func SyntheticConditionOk(condType, message string) status.ConditionStatus
func SyntheticConditionProgressing ¶
func SyntheticConditionProgressing(condType, reason, message string) status.ConditionStatus
func SyntheticConditionWarning ¶
func SyntheticConditionWarning(condType, reason, message string) status.ConditionStatus
Types ¶
type AlwaysGreenAnalyzer ¶
AlwaysGreenAnalyzer is an analyzer that always returns OK status for the supported kinds.
func (AlwaysGreenAnalyzer) Analyze ¶
func (a AlwaysGreenAnalyzer) Analyze(obj *status.Object) status.ObjectStatus
type AnalyzerRegister ¶
type AnalyzerRegister struct {
// contains filtered or unexported fields
}
AnalyzerRegister is a registry of analyzers. It allows to register new analyzers and ignored GroupKinds.
func (*AnalyzerRegister) AnalyzerInits ¶
func (r *AnalyzerRegister) AnalyzerInits() []eval.AnalyzerInit
func (*AnalyzerRegister) Register ¶
func (r *AnalyzerRegister) Register(a ...eval.AnalyzerInit)
Register registers new analyzers.
func (*AnalyzerRegister) RegisterIgnoredKinds ¶
func (r *AnalyzerRegister) RegisterIgnoredKinds(gk ...schema.GroupKind)
func (*AnalyzerRegister) RegisterSimple ¶
func (r *AnalyzerRegister) RegisterSimple(as ...eval.Analyzer)
RegisterSimple registers analyzers without any additional configuration.
type ConditionAnalyzer ¶
type ConditionAnalyzer interface {
Analyze(*metav1.Condition) status.ConditionStatus
}
type DeploymentAnalyzer ¶
type DeploymentAnalyzer struct {
// contains filtered or unexported fields
}
func (DeploymentAnalyzer) Analyze ¶
func (a DeploymentAnalyzer) Analyze(obj *status.Object) status.ObjectStatus
type GenericAnalyzer ¶
type GenericAnalyzer struct {
// contains filtered or unexported fields
}
GenericAnalyzer is an analyzer is a generic implementation of an analyzer. It evaluates object conditions against conditionsAnalyzers. It also evaluates the sub-objects based on owner references.
func (*GenericAnalyzer) Analyze ¶
func (a *GenericAnalyzer) Analyze(obj *status.Object) status.ObjectStatus
type GenericConditionAnalyzer ¶
type GenericConditionAnalyzer struct { MatchAll bool Conditions []Matcher ReversedPolarityConditions []Matcher WarningConditions []Matcher ProgressingConditions []Matcher UnknownConditions []Matcher }
GenericConditionAnalyzer is a generic condition analyzer that can be used for any condition type. It can be configured to match all conditions or only specific ones. The analyzer can also be configured to reverse the polarity of the condition: by default, True is considered OK and False is considered Error. The ReversedPolarityTypes is used for conditions that should be treated the other way around: False is OK, True is Error, e.g. Degraded.
By default, when a condition is matched and the value is in unexpected state, it's considered as Error, unless the condition is matched by `WarningConditions`, `UnknownConditions` or `ProgressingConditions`, in which case the corresponding status is set.
func (GenericConditionAnalyzer) Analyze ¶
func (a GenericConditionAnalyzer) Analyze(cond *metav1.Condition) status.ConditionStatus
type Matcher ¶ added in v0.2.0
func NewRegexpMatchers ¶ added in v0.2.0
func NewStringMatchers ¶ added in v0.2.0
type PVCAnalyzer ¶ added in v0.2.0
type PVCAnalyzer struct {
// contains filtered or unexported fields
}
func (PVCAnalyzer) Analyze ¶ added in v0.2.0
func (a PVCAnalyzer) Analyze(obj *status.Object) status.ObjectStatus
type PodAnalyzer ¶
type PodAnalyzer struct {
// contains filtered or unexported fields
}
func (PodAnalyzer) Analyze ¶
func (a PodAnalyzer) Analyze(obj *status.Object) status.ObjectStatus
type RegexpMatcher ¶ added in v0.2.0
func (*RegexpMatcher) Match ¶ added in v0.2.0
func (m *RegexpMatcher) Match(s string) bool
type ReplicaSetAnalyzer ¶
type ReplicaSetAnalyzer struct {
// contains filtered or unexported fields
}
func (ReplicaSetAnalyzer) Analyze ¶
func (a ReplicaSetAnalyzer) Analyze(obj *status.Object) status.ObjectStatus
type ServiceAnalyzer ¶
type ServiceAnalyzer struct {
// contains filtered or unexported fields
}
func (ServiceAnalyzer) Analyze ¶
func (a ServiceAnalyzer) Analyze(obj *status.Object) status.ObjectStatus
type StringMatcher ¶ added in v0.2.0
type StringMatcher string
func (StringMatcher) Match ¶ added in v0.2.0
func (m StringMatcher) Match(s string) bool