Documentation ¶
Index ¶
- Constants
- func SetCondition(o Conditioner, new Condition)
- type Condition
- type ConditionSeverity
- type ConditionType
- type Conditioner
- type Conditions
- type PositiveConditionBuilder
- func (b *PositiveConditionBuilder) MakeFalseCondition(conditionType ConditionType, severity ConditionSeverity, ...) Condition
- func (b *PositiveConditionBuilder) MakeTrueCondition(conditionType ConditionType, observedGeneration int64) Condition
- func (b *PositiveConditionBuilder) MakeUnknownCondition(conditionType ConditionType, observedGeneration int64, reason string, ...) Condition
- type PositiveConditionBuilderInterface
- type ReadyConditionBuilder
- func (b *ReadyConditionBuilder) Deleting(observedGeneration int64) Condition
- func (b *ReadyConditionBuilder) ReadyCondition(severity ConditionSeverity, observedGeneration int64, reason string, ...) Condition
- func (b *ReadyConditionBuilder) Reconciling(observedGeneration int64) Condition
- func (b *ReadyConditionBuilder) Succeeded(observedGeneration int64) Condition
- type ReadyConditionImpactingError
Constants ¶
const ( ReasonReconciling = "Reconciling" ReasonWaitingForOwner = "WaitingForOwner" ReasonDeleting = "Deleting" ReasonReconciliationFailedPermanently = "ReconciliationFailedPermanently" ReasonAzureResourceNotFound = "AzureResourceNotFound" ReasonSecretNotFound = "SecretNotFound" ReasonReferenceNotFound = "ReferenceNotFound" ReasonSecretWriteFailure = "FailedWritingSecret" )
const ( // ConditionTypeReady is a condition indicating if the resource is ready or not. // A ready resource is one that has been successfully provisioned to Azure according to the // resource spec. It has reached the goal state. This usually means that the resource is ready // to use, but the exact meaning of Ready may vary slightly from resource to resource. Resources with // caveats to Ready's meaning will call that out in the resource specific documentation. ConditionTypeReady = "Ready" )
const ReasonSucceeded = "Succeeded"
Variables ¶
This section is empty.
Functions ¶
func SetCondition ¶
func SetCondition(o Conditioner, new Condition)
SetCondition sets the provided Condition on the Conditioner. The condition is only set if the new condition is in a different state than the existing condition of the same type.
Types ¶
type Condition ¶
type Condition struct { // Type of condition. // +kubebuilder:validation:Required Type ConditionType `json:"type"` // Status of the condition, one of True, False, or Unknown. // +kubebuilder:validation:Required Status metav1.ConditionStatus `json:"status"` // Severity with which to treat failures of this type of condition. // For conditions which have positive polarity (Status == True is their normal/healthy state), this will be omitted when Status == True // For conditions which have negative polarity (Status == False is their normal/healthy state), this will be omitted when Status == False. // This is omitted in all cases when Status == Unknown // +kubebuilder:validation:Optional Severity ConditionSeverity `json:"severity,omitempty"` // LastTransitionTime is the last time the condition transitioned from one status to another. // +kubebuilder:validation:Required LastTransitionTime metav1.Time `json:"lastTransitionTime"` // ObservedGeneration is the .metadata.generation that the condition was set based upon. For instance, if // .metadata.generation is currently 12, but the .status.condition[x].observedGeneration is 9, the condition is out of date // with respect to the current state of the instance. // +kubebuilder:validation:Optional ObservedGeneration int64 `json:"observedGeneration,omitempty"` // Reason for the condition's last transition. // Reasons are upper CamelCase (PascalCase) with no spaces. A reason is always provided, this field will not be empty. // +kubebuilder:validation:Required Reason string `json:"reason"` // Message is a human readable message indicating details about the transition. This field may be empty. // +kubebuilder:validation:Optional Message string `json:"message,omitempty"` }
Condition defines an extension to status (an observation) of a resource +kubebuilder:object:generate=true
func GetCondition ¶
func GetCondition(o Conditioner, conditionType ConditionType) (Condition, bool)
GetCondition gets the Condition with the specified type from the provided Conditioner. Returns the Condition and true if a Condition with the specified type is found, or an empty Condition and false if not.
func (*Condition) DeepCopy ¶
DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.
func (*Condition) DeepCopyInto ¶
DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.
func (Condition) IsEquivalent ¶
IsEquivalent returns true if this condition is equivalent to the passed in condition. Two conditions are equivalent if all of their fields EXCEPT LastTransitionTime are the same.
func (Condition) ShouldOverwrite ¶
ShouldOverwrite determines if this condition should overwrite the other condition.
type ConditionSeverity ¶
type ConditionSeverity string
ConditionSeverity expresses the severity of a Condition.
const ( // ConditionSeverityError specifies that a failure of a condition type // should be viewed as an error. Errors are fatal to reconciliation and // mean that the user must take some action to resolve // the problem before reconciliation will be attempted again. ConditionSeverityError ConditionSeverity = "Error" // ConditionSeverityWarning specifies that a failure of a condition type // should be viewed as a warning. Warnings are informational. The operator // may be able to retry and resolve the warning without any action from the user, but // in some cases user action to resolve the warning will be required. ConditionSeverityWarning ConditionSeverity = "Warning" // ConditionSeverityInfo specifies that a failure of a condition type // should be viewed as purely informational. Things are working. // This is the happy path. ConditionSeverityInfo ConditionSeverity = "Info" // ConditionSeverityNone specifies that there is no condition severity. // For conditions which have positive polarity (Status == True is their normal/healthy state), this will set when Status == True // For conditions which have negative polarity (Status == False is their normal/healthy state), this will be set when Status == False. // Conditions in Status == Unknown always have a severity of None as well. // This is the default state for conditions. ConditionSeverityNone ConditionSeverity = "" )
type ConditionType ¶
type ConditionType string
type Conditioner ¶
type Conditioner interface { GetConditions() Conditions SetConditions(conditions Conditions) }
TODO: Hah, name...
type Conditions ¶
type Conditions []Condition
func (Conditions) FindIndexByType ¶
func (c Conditions) FindIndexByType(conditionType ConditionType) (int, bool)
FindIndexByType returns the index of the condition with the given ConditionType if it exists. If the Condition with the specified ConditionType is doesn't exist, the second boolean parameter is false.
type PositiveConditionBuilder ¶
type PositiveConditionBuilder struct { Ready *ReadyConditionBuilder // contains filtered or unexported fields }
PositiveConditionBuilder makes positive polarity conditions. A positive polarity condition is a condition where Status==True is the "happy path" state, and Status==False is a failure state.
func NewPositiveConditionBuilder ¶
func NewPositiveConditionBuilder(clock clock.Clock) *PositiveConditionBuilder
NewPositiveConditionBuilder creates a new PositiveConditionBuilder for creating positive polarity conditions.
func (*PositiveConditionBuilder) MakeFalseCondition ¶
func (b *PositiveConditionBuilder) MakeFalseCondition(conditionType ConditionType, severity ConditionSeverity, observedGeneration int64, reason string, message string) Condition
MakeFalseCondition makes a condition whose Status is False. A severity, reason, and message must be provided.
func (*PositiveConditionBuilder) MakeTrueCondition ¶
func (b *PositiveConditionBuilder) MakeTrueCondition(conditionType ConditionType, observedGeneration int64) Condition
MakeTrueCondition makes a condition whose Status is True
func (*PositiveConditionBuilder) MakeUnknownCondition ¶
func (b *PositiveConditionBuilder) MakeUnknownCondition(conditionType ConditionType, observedGeneration int64, reason string, message string) Condition
MakeUnknownCondition makes a condition whose Status is Unknown. A reason and message must be provided. No severity is required as conditions in Status Unknown do not have a known severity either.
type PositiveConditionBuilderInterface ¶
type PositiveConditionBuilderInterface interface { MakeTrueCondition(conditionType ConditionType, observedGeneration int64) Condition MakeFalseCondition(conditionType ConditionType, severity ConditionSeverity, observedGeneration int64, reason string, message string) Condition MakeUnknownCondition(conditionType ConditionType, observedGeneration int64, reason string, message string) Condition }
TODO: name?
type ReadyConditionBuilder ¶
type ReadyConditionBuilder struct {
// contains filtered or unexported fields
}
func NewReadyConditionBuilder ¶
func NewReadyConditionBuilder(builder PositiveConditionBuilderInterface) *ReadyConditionBuilder
func (*ReadyConditionBuilder) Deleting ¶
func (b *ReadyConditionBuilder) Deleting(observedGeneration int64) Condition
func (*ReadyConditionBuilder) ReadyCondition ¶
func (b *ReadyConditionBuilder) ReadyCondition(severity ConditionSeverity, observedGeneration int64, reason string, message string) Condition
func (*ReadyConditionBuilder) Reconciling ¶
func (b *ReadyConditionBuilder) Reconciling(observedGeneration int64) Condition
func (*ReadyConditionBuilder) Succeeded ¶
func (b *ReadyConditionBuilder) Succeeded(observedGeneration int64) Condition
type ReadyConditionImpactingError ¶
type ReadyConditionImpactingError struct { Severity ConditionSeverity Reason string // contains filtered or unexported fields }
ReadyConditionImpactingError is an error that requires notification in the Ready condition
func AsReadyConditionImpactingError ¶
func AsReadyConditionImpactingError(err error) (*ReadyConditionImpactingError, bool)
func NewReadyConditionImpactingError ¶
func NewReadyConditionImpactingError(cause error, severity ConditionSeverity, reason string) *ReadyConditionImpactingError
NewReadyConditionImpactingError creates a new ReadyConditionImpactingError
func (*ReadyConditionImpactingError) Cause ¶
func (e *ReadyConditionImpactingError) Cause() error
func (*ReadyConditionImpactingError) Error ¶
func (e *ReadyConditionImpactingError) Error() string
func (*ReadyConditionImpactingError) Format ¶
func (e *ReadyConditionImpactingError) Format(s fmt.State, verb rune)
This was adapted from the function in errors
func (*ReadyConditionImpactingError) Is ¶
func (e *ReadyConditionImpactingError) Is(err error) bool