Documentation ¶
Index ¶
- Constants
- Variables
- func AreEqual(c1, c2 *capi.Condition) bool
- func AreEquivalent(c1, c2 *capi.Condition) bool
- func ExpectedFalseErrorMessage(cr Object, conditionType capi.ConditionType) string
- func ExpectedStatusErrorMessage(cr Object, conditionType capi.ConditionType, ...) string
- func ExpectedTrueErrorMessage(cr Object, conditionType capi.ConditionType) string
- func GetControlPlaneReady(cluster *capi.Cluster) (capi.Condition, bool)
- func GetCreating(object Object) (capi.Condition, bool)
- func GetInfrastructureReady(cluster *capi.Cluster) (capi.Condition, bool)
- func GetReplicasReady(machinePool *capiexp.MachinePool) (capi.Condition, bool)
- func GetUpgrading(object Object) (capi.Condition, bool)
- func IsControlPlaneReadyFalse(cluster *capi.Cluster, checkOptions ...CheckOption) bool
- func IsControlPlaneReadyTrue(cluster *capi.Cluster) bool
- func IsControlPlaneReadyUnknown(cluster *capi.Cluster) bool
- func IsCreatingFalse(object Object, checkOptions ...CheckOption) bool
- func IsCreatingTrue(object Object) bool
- func IsCreatingUnknown(object Object) bool
- func IsFalse(condition *capi.Condition, checkOptions ...CheckOption) bool
- func IsInfrastructureReadyFalse(object Object, checkOptions ...CheckOption) bool
- func IsInfrastructureReadyTrue(object Object) bool
- func IsInfrastructureReadyUnknown(object Object) bool
- func IsNodePoolsReadyFalse(cluster *capi.Cluster, checkOptions ...CheckOption) bool
- func IsNodePoolsReadyTrue(cluster *capi.Cluster) bool
- func IsNodePoolsReadyUnknown(cluster *capi.Cluster) bool
- func IsReadyFalse(object Object, checkOptions ...CheckOption) bool
- func IsReadyTrue(object Object) bool
- func IsReadyUnknown(object Object) bool
- func IsReplicasReadyFalse(machinePool *capiexp.MachinePool, checkOptions ...CheckOption) bool
- func IsReplicasReadyTrue(machinePool *capiexp.MachinePool) bool
- func IsReplicasReadyUnknown(machinePool *capiexp.MachinePool) bool
- func IsTrue(condition *capi.Condition) bool
- func IsUnexpectedConditionStatus(err error) bool
- func IsUnknown(condition *capi.Condition) bool
- func IsUnsupported(from capiconditions.Getter, t capi.ConditionType) bool
- func IsUnsupportedConditionStatus(err error) bool
- func IsUpgradingFalse(object Object, checkOptions ...CheckOption) bool
- func IsUpgradingTrue(object Object) bool
- func IsUpgradingUnknown(object Object) bool
- func UnexpectedConditionStatusErrorMessage(cr Object, t capi.ConditionType) string
- func UnsupportedConditionStatusErrorMessage(cr Object, t capi.ConditionType) string
- type CheckOption
- func WithCreationCompletedReason() CheckOption
- func WithExistingObjectReason() CheckOption
- func WithReason(reason string) CheckOption
- func WithSeverity(severity capi.ConditionSeverity) CheckOption
- func WithSeverityError() CheckOption
- func WithSeverityInfo() CheckOption
- func WithSeverityWarning() CheckOption
- func WithUpgradeCompletedReason() CheckOption
- func WithUpgradeNotStartedReason() CheckOption
- func WithWaitingForReplicasReadyReason() CheckOption
- func WithoutSeverity() CheckOption
- type Object
Constants ¶
const ( // ControlPlaneReady is a condition type that tells if tenant cluster's // control plane object is in Ready condition, by mirroring Ready condition // from the control plane CR which is usually referenced by ControlPlaneRef // property in the CR Spec. // // For example, for Cluster CR it currently mirrors AzureMachine Ready // condition (when we start reconciling tenant cluster control plane with // Cluster API types, control plane type). // // Examples: // // import capiconditions "sigs.k8s.io/cluster-api/util/conditions" // // // Set ControlPlaneReady for Cluster CR by mirroring Ready condition // // from AzureMachine CR. // capiconditions.SetMirror(cluster, conditions.ControlPlaneReady, azureMachine) // // // Set ControlPlaneReady for MachinePool CR by mirroring // // Ready condition from AzureMachinePool CR. // capiconditions.SetMirror(machinePool, conditions.ControlPlaneReady, azureMachinePool) // ControlPlaneReady = capi.ControlPlaneReadyCondition // ControlPlaneReferenceNotSetReason is a condition reason that is set when // ControlPlaneReady is set with status False because control plane reference // is not set on Cluster object. When using this reason, the condition // severity should be set to Warning. ControlPlaneReferenceNotSetReason = "ControlPlaneReferenceNotSet" // ControlPlaneObjectNotFoundReason is a condition reason that is set when // ControlPlaneReady is set with status False because control plane object // is not found, but control plane reference is set. When using this reason, // the condition severity should be set to Warning. ControlPlaneObjectNotFoundReason = "ControlPlaneObjectNotFound" // Waiting time during which ControlPlaneReady is set to False with // severity Info. After this threshold time, severity Warning is used. WaitingForControlPlaneWarningThresholdTime = 10 * time.Minute )
const ( // Creating is a condition type that tells if a cluster, a node pool, a // tenant cluster control plane, or something else that needs a Creating // condition is currently being created. Creating capi.ConditionType = "Creating" // CreationCompletedReason is set when the creation has been completed // successfully. CreationCompletedReason = "CreationCompleted" // ExistingClusterReason is used when setting a Creating condition for the // first time on an object that was created before conditions support was // implemented. ExistingObjectReason = "ExistingObject" )
const ( // InfrastructureReady is a condition type that tells if provider // infrastructure for the object is in Ready condition, by mirroring Ready // condition from the corresponding provider-specific CR which is usually // referenced by InfrastructureRef property in the CR Spec. // // For example, for Cluster CR it mirrors AzureCluster Ready condition and // for MachinePool CR it mirrors AzureMachinePool Ready condition. // // Examples: // // import capiconditions "sigs.k8s.io/cluster-api/util/conditions" // // // Set InfrastructureReady for Cluster CR by mirroring Ready // // condition from AzureCluster CR. // capiconditions.SetMirror(cluster, conditions.InfrastructureReady, azureCluster) // // // Set InfrastructureReady for MachinePool CR by mirroring // // Ready condition from AzureMachinePool CR. // capiconditions.SetMirror(machinePool, conditions.InfrastructureReady, azureMachinePool) // InfrastructureReady = capi.InfrastructureReadyCondition // InfrastructureReferenceNotSetReason is a condition reason that is set // when InfrastructureReady is set with status False because object does // not have infrastructure reference set. When using this reason, the // condition severity should be set to Warning. InfrastructureReferenceNotSetReason = "InfrastructureReferenceNotSet" // InfrastructureObjectNotFoundReason is a condition reason that is set // when InfrastructureReady is set with status False because corresponding // provider-specific infrastructure object is not found, but infrastructure // reference is set. When using this reason, the condition severity should // be set to Warning. InfrastructureObjectNotFoundReason = "InfrastructureObjectNotFound" // Waiting time during which InfrastructureReady is set to False with // severity Info. After this threshold time, severity Warning is used. WaitingForInfrastructureWarningThresholdTime = 10 * time.Minute )
const ( // NodePoolsReady is a condition type that tells if tenant cluster node // pools are in Ready condition, by aggregating Ready conditions for all // node pool objects. NodePoolsReady capi.ConditionType = "NodePoolsReady" // NodePoolsNotFoundReason is a condition reason that is set when // NodePoolsReady is set with status False because node pool objects (e.g. // MachinePool CRs or MachineDeployment CRs) are not found. NodePoolsNotFoundReason = "NodePoolObjectsNotFound" )
const ( // Upgrading is a condition type that tells if a cluster, a node pool, a // tenant cluster control plane, or something else that needs an Upgrading // condition is currently being upgraded. Upgrading capi.ConditionType = "Upgrading" // UpgradeCompletedReason is set when the upgrade has been completed // successfully. UpgradeCompletedReason = "UpgradeCompleted" // UpgradeNotStartedReason is set when the upgrade has not started yet. // This is usually during or after creation, but can also be after // restoring a CR from the backup. UpgradeNotStartedReason = "UpgradeNotStarted" // UpgradePendingReason is set when the upgrade has not started yet, // but it is pending and it will start soon, because owner object has // Upgrading condition with status set to True. UpgradePendingReason = "UpgradePending" )
Variables ¶
var UnexpectedConditionStatusError = µerror.Error{
Kind: "UnexpectedConditionStatus",
}
var UnsupportedConditionStatusError = µerror.Error{
Kind: "UnsupportedConditionStatus",
}
Functions ¶
func AreEqual ¶
AreEqual checks if two conditions are equal (identical).
If both are nil, it returns true. If only one of them is nil, it returns false. If both are different than nil, it compares all fields: Type, Status, Severity, Reason, LastTransitionTime and Message.
func AreEquivalent ¶
AreEquivalent compares specified conditions.
If both are nil, it returns true. If only one of them is nil, it returns false. If both are different than nil, it compares Type, Status, Severity and Reason fields, while it ignores LastTransitionTime and Message.
func ExpectedFalseErrorMessage ¶
func ExpectedFalseErrorMessage(cr Object, conditionType capi.ConditionType) string
func ExpectedStatusErrorMessage ¶
func ExpectedStatusErrorMessage(cr Object, conditionType capi.ConditionType, expectedStatus corev1.ConditionStatus) string
func ExpectedTrueErrorMessage ¶
func ExpectedTrueErrorMessage(cr Object, conditionType capi.ConditionType) string
func GetControlPlaneReady ¶
GetControlPlaneReady tries to get ControlPlaneReady condition from the specified Cluster CR. If the ControlPlaneReady condition was found, it returns a copy of the condition and true, otherwise it returns an empty struct and false.
func GetCreating ¶
GetCreating tries to get Creating condition from the specified object. If the Creating condition was found, it returns a copy of the condition and true, otherwise it returns an empty struct and false.
func GetInfrastructureReady ¶
GetInfrastructureReady tries to get InfrastructureReady condition from the specified Cluster CR. If the InfrastructureReady condition was found, it returns a copy of the condition and true, otherwise it returns an empty struct and false.
func GetReplicasReady ¶ added in v0.3.0
func GetReplicasReady(machinePool *capiexp.MachinePool) (capi.Condition, bool)
GetReplicasReady tries to get ReplicasReady condition from the specified MachinePool CR. If the ReplicasReady condition was found, it returns a copy of the condition and true, otherwise it returns an empty struct and false.
func GetUpgrading ¶
GetUpgrading tries to get Upgrading condition from the specified object. If the Upgrading condition was found, it returns a copy of the condition and true, otherwise it returns an empty struct and false.
func IsControlPlaneReadyFalse ¶
func IsControlPlaneReadyFalse(cluster *capi.Cluster, checkOptions ...CheckOption) bool
IsControlPlaneReadyFalse checks if specified cluster is not in ControlPlaneReady condition (if ControlPlaneReady condition is set with status False) and if optionally specified checks are successful.
func IsControlPlaneReadyTrue ¶
IsControlPlaneReadyTrue checks if specified cluster is in ControlPlaneReady condition (if ControlPlaneReady condition is set with status True).
func IsControlPlaneReadyUnknown ¶
IsControlPlaneReadyUnknown checks if it is unknown whether the specified cluster is in ControlPlaneReady condition or not (if ControlPlaneReady condition is not set, or it is set with status Unknown).
func IsCreatingFalse ¶
func IsCreatingFalse(object Object, checkOptions ...CheckOption) bool
IsCreatingFalse checks if specified object is not in Creating condition (if Creating condition is set with status False) and if optionally specified checks are successful.
Examples:
IsCreatingFalse(cluster) IsCreatingFalse(cluster, WithCreationCompletedReason()) IsCreatingFalse(cluster, WithExistingObjectReason())
func IsCreatingTrue ¶
IsCreatingTrue checks if specified object is in Creating condition (if Creating condition is set with status True).
func IsCreatingUnknown ¶
IsCreatingUnknown checks if it is unknown whether the specified object is in Creating condition or not (if Creating condition is not set, or it is set with status Unknown).
func IsFalse ¶
func IsFalse(condition *capi.Condition, checkOptions ...CheckOption) bool
IsFalse checks if specified condition is not nil and has Status set to False.
func IsInfrastructureReadyFalse ¶
func IsInfrastructureReadyFalse(object Object, checkOptions ...CheckOption) bool
IsInfrastructureReadyFalse checks if specified object is not in InfrastructureReady condition (if InfrastructureReady condition is set with status False) and if optionally specified checks are successful.
func IsInfrastructureReadyTrue ¶
IsInfrastructureReadyTrue checks if specified object is in InfrastructureReady condition (if InfrastructureReady condition is set with status True).
func IsInfrastructureReadyUnknown ¶
IsInfrastructureReadyUnknown checks if it is unknown whether the specified object is in InfrastructureReady condition or not (if InfrastructureReady condition is not set, or it is set with status Unknown).
func IsNodePoolsReadyFalse ¶
func IsNodePoolsReadyFalse(cluster *capi.Cluster, checkOptions ...CheckOption) bool
IsNodePoolsReadyFalse checks if specified object is not in NodePoolsReady condition (if NodePoolsReady condition is set with status False) and if optionally specified checks are successful.
func IsNodePoolsReadyTrue ¶
IsNodePoolsReadyTrue checks if specified cluster is in NodePoolsReady condition (if NodePoolsReady condition is set with status True).
func IsNodePoolsReadyUnknown ¶
IsNodePoolsReadyUnknown checks if it is unknown whether the specified cluster is in NodePoolsReady condition or not (if NodePoolsReady condition is not set, or it is set with status Unknown).
func IsReadyFalse ¶
func IsReadyFalse(object Object, checkOptions ...CheckOption) bool
IsReadyFalse checks if specified object is not in Ready condition (if Ready condition is set with status False).
func IsReadyTrue ¶
IsReadyTrue checks if specified object is in Ready condition (if Ready condition is set with status True).
func IsReadyUnknown ¶
IsReadyUnknown checks if it is unknown whether the specified object is in Ready condition or not (if Ready condition is not set, or it is set with status Unknown).
func IsReplicasReadyFalse ¶ added in v0.3.0
func IsReplicasReadyFalse(machinePool *capiexp.MachinePool, checkOptions ...CheckOption) bool
IsReplicasReadyFalse checks if specified MachinePool is not in ReplicasReady condition (if ReplicasReady condition is set with status False) and if optionally specified checks are successful.
func IsReplicasReadyTrue ¶ added in v0.3.0
func IsReplicasReadyTrue(machinePool *capiexp.MachinePool) bool
IsReplicasReadyTrue checks if specified MachinePool is in ReplicasReady condition (if ReplicasReady condition is set with status True).
func IsReplicasReadyUnknown ¶ added in v0.3.0
func IsReplicasReadyUnknown(machinePool *capiexp.MachinePool) bool
IsReplicasReadyUnknown checks if it is unknown whether the specified MachinePool is in ReplicasReady condition or not (if ReplicasReady condition is not set, or it is set with status Unknown).
func IsUnexpectedConditionStatus ¶
IsUnexpectedConditionStatus asserts UnexpectedConditionStatusError.
func IsUnknown ¶
IsUnknown checks if specified condition is either nil or has Status set to Unknown.
func IsUnsupported ¶
func IsUnsupported(from capiconditions.Getter, t capi.ConditionType) bool
func IsUnsupportedConditionStatus ¶
IsInvalidCondition asserts invalidConditionError.
func IsUpgradingFalse ¶
func IsUpgradingFalse(object Object, checkOptions ...CheckOption) bool
IsUpgradingFalse checks if specified object is not in Upgrading condition (if Upgrading condition is set with status False) and if optionally specified checks are successful.
Examples:
IsUpgradingFalse(cluster) IsUpgradingFalse(cluster, WithUpgradeCompletedReason()) IsUpgradingFalse(cluster, WithUpgradeNotStartedReason())
func IsUpgradingTrue ¶
IsUpgradingTrue checks if specified object is in Upgrading condition (if Upgrading condition is set with status True).
func IsUpgradingUnknown ¶
IsUpgradingUnknown checks if it is unknown whether the specified object is in Upgrading condition or not (if Upgrading condition is not set, or it is set with status Unknown).
func UnexpectedConditionStatusErrorMessage ¶
func UnexpectedConditionStatusErrorMessage(cr Object, t capi.ConditionType) string
func UnsupportedConditionStatusErrorMessage ¶
func UnsupportedConditionStatusErrorMessage(cr Object, t capi.ConditionType) string
Types ¶
type CheckOption ¶
func WithCreationCompletedReason ¶
func WithCreationCompletedReason() CheckOption
WithCreationCompletedReason returns a CheckOption that checks if condition reason is set to CreationCompleted.
func WithExistingObjectReason ¶
func WithExistingObjectReason() CheckOption
WithExistingObjectReason returns a CheckOption that checks if condition reason is set to ExistingObject.
func WithReason ¶
func WithReason(reason string) CheckOption
WithReason returns a CheckOption that checks if condition reason is set to the specified value.
func WithSeverity ¶
func WithSeverity(severity capi.ConditionSeverity) CheckOption
WithSeverity returns a CheckOption that checks if condition severity is set to the specified value.
func WithSeverityError ¶
func WithSeverityError() CheckOption
WithSeverityError returns a CheckOption that checks if condition severity is set to Error.
func WithSeverityInfo ¶
func WithSeverityInfo() CheckOption
WithSeverityInfo returns a CheckOption that checks if condition severity is set to Info.
func WithSeverityWarning ¶
func WithSeverityWarning() CheckOption
WithSeverityWarning returns a CheckOption that checks if condition severity is set to Warning.
func WithUpgradeCompletedReason ¶
func WithUpgradeCompletedReason() CheckOption
WithUpgradeCompletedReason returns a CheckOption that checks if condition reason is set to UpgradeCompleted.
func WithUpgradeNotStartedReason ¶
func WithUpgradeNotStartedReason() CheckOption
WithUpgradeNotStartedReason returns a CheckOption that checks if condition reason is set to UpgradeNotStarted.
func WithWaitingForReplicasReadyReason ¶ added in v0.3.0
func WithWaitingForReplicasReadyReason() CheckOption
WithWaitingForReplicasReadyReason returns a CheckOption that checks if condition reason is set to WaitingForReplicasReady.
func WithoutSeverity ¶
func WithoutSeverity() CheckOption
WithoutSeverity returns a CheckOption that checks if condition severity is not set.