Documentation ¶
Overview ¶
Package conditions is a mix-in for custom resource types that adds in standard condition accessors. WARNING: this cannot be used with standard kube-ecosystem codegen tooling, which does not yet understand generics. It is mostly useful for tests.
Index ¶
- type HasConditions
- type StatusConditions
- type StatusWithConditions
- func (s StatusWithConditions[S]) FindStatusCondition(conditionType string) *metav1.Condition
- func (s *StatusWithConditions[S]) GetStatusConditions() *[]metav1.Condition
- func (s StatusWithConditions[S]) IsStatusConditionChanged(conditionType string, condition *metav1.Condition) bool
- func (s StatusWithConditions[S]) IsStatusConditionFalse(conditionType string) bool
- func (s StatusWithConditions[S]) IsStatusConditionPresentAndEqual(conditionType string, status metav1.ConditionStatus) bool
- func (s StatusWithConditions[S]) IsStatusConditionTrue(conditionType string) bool
- func (s StatusWithConditions[S]) RemoveStatusCondition(conditionType string)
- func (s StatusWithConditions[S]) SetStatusCondition(condition metav1.Condition)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HasConditions ¶
type HasConditions interface { comparable GetStatusConditions() *[]metav1.Condition }
type StatusConditions ¶
type StatusConditions struct { // Conditions for the current state of the resource. // +optional Conditions []metav1.Condition `json:"conditions,omitempty" patchStrategy:"merge" patchMergeKey:"type" protobuf:"bytes,1,rep,name=conditions"` }
func (*StatusConditions) GetStatusConditions ¶
func (c *StatusConditions) GetStatusConditions() *[]metav1.Condition
GetStatusConditions returns a pointer to all status conditions.
type StatusWithConditions ¶
type StatusWithConditions[S HasConditions] struct { // +optional Status S `json:"status,omitempty"` }
func (StatusWithConditions[S]) FindStatusCondition ¶
func (s StatusWithConditions[S]) FindStatusCondition(conditionType string) *metav1.Condition
FindStatusCondition finds the conditionType in conditions.
func (*StatusWithConditions[S]) GetStatusConditions ¶
func (s *StatusWithConditions[S]) GetStatusConditions() *[]metav1.Condition
GetStatusConditions returns all status conditions.
func (StatusWithConditions[S]) IsStatusConditionChanged ¶
func (s StatusWithConditions[S]) IsStatusConditionChanged(conditionType string, condition *metav1.Condition) bool
IsStatusConditionChanged returns true if the passed in condition is different from the condition of the same type.
func (StatusWithConditions[S]) IsStatusConditionFalse ¶
func (s StatusWithConditions[S]) IsStatusConditionFalse(conditionType string) bool
IsStatusConditionFalse returns true when the conditionType is present and set to `metav1.ConditionFalse`
func (StatusWithConditions[S]) IsStatusConditionPresentAndEqual ¶
func (s StatusWithConditions[S]) IsStatusConditionPresentAndEqual(conditionType string, status metav1.ConditionStatus) bool
IsStatusConditionPresentAndEqual returns true when conditionType is present and equal to status.
func (StatusWithConditions[S]) IsStatusConditionTrue ¶
func (s StatusWithConditions[S]) IsStatusConditionTrue(conditionType string) bool
IsStatusConditionTrue returns true when the conditionType is present and set to `metav1.ConditionTrue`
func (StatusWithConditions[S]) RemoveStatusCondition ¶
func (s StatusWithConditions[S]) RemoveStatusCondition(conditionType string)
RemoveStatusCondition removes the corresponding conditionType from conditions. conditions must be non-nil.
func (StatusWithConditions[S]) SetStatusCondition ¶
func (s StatusWithConditions[S]) SetStatusCondition(condition metav1.Condition)
SetStatusCondition sets the corresponding condition in conditions to newCondition. conditions must be non-nil.
- if the condition of the specified type already exists (all fields of the existing condition are updated to newCondition, LastTransitionTime is set to now if the new status differs from the old status)
- if a condition of the specified type does not exist (LastTransitionTime is set to now() if unset, and newCondition is appended)