Documentation ¶
Index ¶
- func Delete(to Setter, t v1alpha1.ConditionType)
- func FalseCondition(t v1alpha1.ConditionType, reason string, severity v1alpha1.ConditionSeverity, ...) *v1alpha1.Condition
- func Get(from Getter, t v1alpha1.ConditionType) *v1alpha1.Condition
- func GetLastTransitionTime(from Getter, t v1alpha1.ConditionType) *metav1.Time
- func GetMessage(from Getter, t v1alpha1.ConditionType) string
- func GetReason(from Getter, t v1alpha1.ConditionType) string
- func GetSeverity(from Getter, t v1alpha1.ConditionType) *v1alpha1.ConditionSeverity
- func Has(from Getter, t v1alpha1.ConditionType) bool
- func IsFalse(from Getter, t v1alpha1.ConditionType) bool
- func IsTrue(from Getter, t v1alpha1.ConditionType) bool
- func IsUnknown(from Getter, t v1alpha1.ConditionType) bool
- func MarkFalse(to Setter, t v1alpha1.ConditionType, reason string, ...)
- func MarkTrue(to Setter, t v1alpha1.ConditionType)
- func MarkUnknown(to Setter, t v1alpha1.ConditionType, reason, messageFormat string, ...)
- func Set(to Setter, condition *v1alpha1.Condition)
- func SetAggregate(to Setter, targetCondition v1alpha1.ConditionType, from []Getter, ...)
- func SetMirror(to Setter, targetCondition v1alpha1.ConditionType, from Getter, ...)
- func SetSummary(to Setter, options ...MergeOption)
- func TrueCondition(t v1alpha1.ConditionType) *v1alpha1.Condition
- func UnknownCondition(t v1alpha1.ConditionType, reason string, messageFormat string, ...) *v1alpha1.Condition
- type ApplyOption
- type Getter
- type MergeOption
- type MirrorOptions
- type Patch
- type PatchOperation
- type PatchOperationType
- type Setter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Delete ¶
func Delete(to Setter, t v1alpha1.ConditionType)
Delete deletes the condition with the given type.
func FalseCondition ¶
func FalseCondition(t v1alpha1.ConditionType, reason string, severity v1alpha1.ConditionSeverity, messageFormat string, messageArgs ...interface{}) *v1alpha1.Condition
FalseCondition returns a condition with Status=False and the given type.
func Get ¶
func Get(from Getter, t v1alpha1.ConditionType) *v1alpha1.Condition
Get returns the condition with the given type, if the condition does not exists, it returns nil.
func GetLastTransitionTime ¶
func GetLastTransitionTime(from Getter, t v1alpha1.ConditionType) *metav1.Time
GetLastTransitionTime returns the condition Severity or nil if the condition does not exist (is nil).
func GetMessage ¶
func GetMessage(from Getter, t v1alpha1.ConditionType) string
GetMessage returns a nil safe string of Message.
func GetReason ¶
func GetReason(from Getter, t v1alpha1.ConditionType) string
GetReason returns a nil safe string of Reason for the condition with the given type.
func GetSeverity ¶
func GetSeverity(from Getter, t v1alpha1.ConditionType) *v1alpha1.ConditionSeverity
GetSeverity returns the condition Severity or nil if the condition does not exist (is nil).
func Has ¶
func Has(from Getter, t v1alpha1.ConditionType) bool
Has returns true if a condition with the given type exists.
func IsFalse ¶
func IsFalse(from Getter, t v1alpha1.ConditionType) bool
IsFalse is true if the condition with the given type is False, otherwise it return false if the condition is not False or if the condition does not exist (is nil).
func IsTrue ¶
func IsTrue(from Getter, t v1alpha1.ConditionType) bool
IsTrue is true if the condition with the given type is True, otherwise it return false if the condition is not True or if the condition does not exist (is nil).
func IsUnknown ¶
func IsUnknown(from Getter, t v1alpha1.ConditionType) bool
IsUnknown is true if the condition with the given type is Unknown or if the condition does not exist (is nil).
func MarkFalse ¶
func MarkFalse(to Setter, t v1alpha1.ConditionType, reason string, severity v1alpha1.ConditionSeverity, messageFormat string, messageArgs ...interface{})
MarkFalse sets Status=False for the condition with the given type.
func MarkTrue ¶
func MarkTrue(to Setter, t v1alpha1.ConditionType)
MarkTrue sets Status=True for the condition with the given type.
func MarkUnknown ¶
func MarkUnknown(to Setter, t v1alpha1.ConditionType, reason, messageFormat string, messageArgs ...interface{})
MarkUnknown sets Status=Unknown for the condition with the given type.
func Set ¶
Set sets the given condition.
NOTE: If a condition already exists, the LastTransitionTime is updated only if a change is detected in any of the following fields: Status, Reason, Severity and Message.
func SetAggregate ¶
func SetAggregate(to Setter, targetCondition v1alpha1.ConditionType, from []Getter, options ...MergeOption)
SetAggregate creates a new condition with the aggregation of all the the Ready condition from a list of dependent objects; if the Ready condition does not exists in one of the source object, the object is excluded from the aggregation; if none of the source object have ready condition, no target conditions is generated.
func SetMirror ¶
func SetMirror(to Setter, targetCondition v1alpha1.ConditionType, from Getter, options ...MirrorOptions)
SetMirror creates a new condition by mirroring the the Ready condition from a dependent object; if the Ready condition does not exists in the source object, no target conditions is generated.
func SetSummary ¶
func SetSummary(to Setter, options ...MergeOption)
SetSummary sets a Ready condition with the summary of all the conditions existing on an object. If the object does not have other conditions, no summary condition is generated.
func TrueCondition ¶
func TrueCondition(t v1alpha1.ConditionType) *v1alpha1.Condition
TrueCondition returns a condition with Status=True and the given type.
func UnknownCondition ¶
func UnknownCondition(t v1alpha1.ConditionType, reason string, messageFormat string, messageArgs ...interface{}) *v1alpha1.Condition
UnknownCondition returns a condition with Status=Unknown and the given type.
Types ¶
type ApplyOption ¶
type ApplyOption func(*applyOptions)
ApplyOption defines an option for applying a condition patch.
func WithForceOverwrite ¶
func WithForceOverwrite(v bool) ApplyOption
WithForceOverwrite In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller.
func WithOwnedConditions ¶
func WithOwnedConditions(t ...v1alpha1.ConditionType) ApplyOption
WithOwnedConditions allows to define condition types owned by the controller. In case of conflicts for the owned conditions, the patch helper will always use the value provided by the controller.
type Getter ¶
type Getter interface { client.Object // GetConditions returns the list of conditions for a cluster API object. GetConditions() v1alpha1.Conditions }
Getter interface defines methods that a Cluster API object should implement in order to use the conditions package for getting conditions.
type MergeOption ¶
type MergeOption func(*mergeOptions)
MergeOption defines an option for computing a summary of conditions.
func AddSourceRef ¶
func AddSourceRef() MergeOption
AddSourceRef instructs merge to add info about the originating object to the target Reason.
func WithConditions ¶
func WithConditions(t ...v1alpha1.ConditionType) MergeOption
WithConditions instructs merge about the condition types to consider when doing a merge operation; if this option is not specified, all the conditions (excepts Ready) will be considered. This is required so we can provide some guarantees about the semantic of the target condition without worrying about side effects if someone or something adds custom conditions to the objects.
NOTE: The order of conditions types defines the priority for determining the Reason and Message for the target condition. IMPORTANT: This options works only while generating the Summary condition.
func WithStepCounter ¶
func WithStepCounter() MergeOption
WithStepCounter instructs merge to add a "x of y completed" string to the message, where x is the number of conditions with Status=true and y is the number of conditions in scope.
func WithStepCounterIf ¶
func WithStepCounterIf(value bool) MergeOption
WithStepCounterIf adds a step counter if the value is true. This can be used e.g. to add a step counter only if the object is not being deleted.
IMPORTANT: This options works only while generating the Summary condition.
func WithStepCounterIfOnly ¶
func WithStepCounterIfOnly(t ...v1alpha1.ConditionType) MergeOption
WithStepCounterIfOnly ensure a step counter is show only if a subset of condition exists. This applies for example on Machines, where we want to use the step counter notation while provisioning the machine, but then we want to move away from this notation as soon as the machine is provisioned and e.g. a Machine health check condition is generated
IMPORTANT: This options requires WithStepCounter or WithStepCounterIf to be set. IMPORTANT: This options works only while generating the Summary condition.
type MirrorOptions ¶
type MirrorOptions func(*mirrorOptions)
MirrorOptions defines an option for mirroring conditions.
func WithFallbackValue ¶
func WithFallbackValue(fallbackValue bool, reason string, severity v1alpha1.ConditionSeverity, message string) MirrorOptions
WithFallbackValue specify a fallback value to use in case the mirrored condition does not exists; in case the fallbackValue is false, given values for reason, severity and message will be used.
type Patch ¶
type Patch []PatchOperation
Patch defines a list of operations to change a list of conditions into another.
func NewPatch ¶
NewPatch returns the list of Patch required to align source conditions to after conditions.
type PatchOperation ¶
type PatchOperation struct { Before *v1alpha1.Condition After *v1alpha1.Condition Op PatchOperationType }
PatchOperation define an operation that changes a single condition.
type PatchOperationType ¶
type PatchOperationType string
PatchOperationType defines patch operation types.
const ( // AddConditionPatch defines an add condition patch operation. AddConditionPatch PatchOperationType = "Add" // ChangeConditionPatch defines an change condition patch operation. ChangeConditionPatch PatchOperationType = "Change" // RemoveConditionPatch defines a remove condition patch operation. RemoveConditionPatch PatchOperationType = "Remove" )
type Setter ¶
type Setter interface { Getter SetConditions(v1alpha1.Conditions) }
Setter interface defines methods that a Cluster API object should implement in order to use the conditions package for setting conditions.