...

Package v1

import "github.com/openshift/custom-resource-status/conditions/v1"
Overview
Index

Overview ▾

Package v1 provides version v1 of the types and functions necessary to manage and inspect a slice of conditions. It is opinionated in the condition types provided but leaves it to the user to define additional types as necessary.

func IsStatusConditionFalse

func IsStatusConditionFalse(conditions []Condition, conditionType ConditionType) bool

IsStatusConditionFalse returns true when the conditionType is present and set to `corev1.ConditionFalse`

func IsStatusConditionPresentAndEqual

func IsStatusConditionPresentAndEqual(conditions []Condition, conditionType ConditionType, status corev1.ConditionStatus) bool

IsStatusConditionPresentAndEqual returns true when conditionType is present and equal to status.

func IsStatusConditionTrue

func IsStatusConditionTrue(conditions []Condition, conditionType ConditionType) bool

IsStatusConditionTrue returns true when the conditionType is present and set to `corev1.ConditionTrue`

func IsStatusConditionUnknown

func IsStatusConditionUnknown(conditions []Condition, conditionType ConditionType) bool

IsStatusConditionUnknown returns true when the conditionType is present and set to `corev1.ConditionUnknown`

func RemoveStatusCondition

func RemoveStatusCondition(conditions *[]Condition, conditionType ConditionType)

RemoveStatusCondition removes the corresponding conditionType from conditions.

func SetStatusCondition

func SetStatusCondition(conditions *[]Condition, newCondition Condition)

SetStatusCondition sets the corresponding condition in conditions to newCondition.

func SetStatusConditionNoHeartbeat

func SetStatusConditionNoHeartbeat(conditions *[]Condition, newCondition Condition)

SetStatusConditionNoHearbeat sets the corresponding condition in conditions to newCondition without setting lastHeartbeatTime.

type Condition

Condition represents the state of the operator's reconciliation functionality. +k8s:deepcopy-gen=true

type Condition struct {
    Type ConditionType `json:"type" description:"type of condition ie. Available|Progressing|Degraded."`

    Status corev1.ConditionStatus `json:"status" description:"status of the condition, one of True, False, Unknown"`

    // +optional
    Reason string `json:"reason,omitempty" description:"one-word CamelCase reason for the condition's last transition"`

    // +optional
    Message string `json:"message,omitempty" description:"human-readable message indicating details about last transition"`

    // +optional
    LastHeartbeatTime metav1.Time `json:"lastHeartbeatTime" description:"last time we got an update on a given condition"`

    // +optional
    LastTransitionTime metav1.Time `json:"lastTransitionTime" description:"last time the condition transit from one status to another"`
}

func FindStatusCondition

func FindStatusCondition(conditions []Condition, conditionType ConditionType) *Condition

FindStatusCondition finds the conditionType in conditions.

func (*Condition) DeepCopy

func (in *Condition) DeepCopy() *Condition

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Condition.

func (*Condition) DeepCopyInto

func (in *Condition) DeepCopyInto(out *Condition)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type ConditionType

ConditionType is the state of the operator's reconciliation functionality.

type ConditionType string
const (
    // ConditionAvailable indicates that the resources maintained by the operator,
    // is functional and available in the cluster.
    ConditionAvailable ConditionType = "Available"

    // ConditionProgressing indicates that the operator is actively making changes to the resources maintained by the
    // operator
    ConditionProgressing ConditionType = "Progressing"

    // ConditionDegraded indicates that the resources maintained by the operator are not functioning completely.
    // An example of a degraded state would be if not all pods in a deployment were running.
    // It may still be available, but it is degraded
    ConditionDegraded ConditionType = "Degraded"

    // ConditionUpgradeable indicates whether the resources maintained by the operator are in a state that is safe to upgrade.
    // When `False`, the resources maintained by the operator should not be upgraded and the
    // message field should contain a human readable description of what the administrator should do to
    // allow the operator to successfully update the resources maintained by the operator.
    ConditionUpgradeable ConditionType = "Upgradeable"
)