sigs.k8s.io/cluster-api@v1.7.1/api/v1beta1/condition_types.go (about)

     1  /*
     2  Copyright 2021 The Kubernetes Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package v1beta1
    18  
    19  import (
    20  	corev1 "k8s.io/api/core/v1"
    21  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    22  )
    23  
    24  // ANCHOR: ConditionSeverity
    25  
    26  // ConditionSeverity expresses the severity of a Condition Type failing.
    27  type ConditionSeverity string
    28  
    29  const (
    30  	// ConditionSeverityError specifies that a condition with `Status=False` is an error.
    31  	ConditionSeverityError ConditionSeverity = "Error"
    32  
    33  	// ConditionSeverityWarning specifies that a condition with `Status=False` is a warning.
    34  	ConditionSeverityWarning ConditionSeverity = "Warning"
    35  
    36  	// ConditionSeverityInfo specifies that a condition with `Status=False` is informative.
    37  	ConditionSeverityInfo ConditionSeverity = "Info"
    38  
    39  	// ConditionSeverityNone should apply only to conditions with `Status=True`.
    40  	ConditionSeverityNone ConditionSeverity = ""
    41  )
    42  
    43  // ANCHOR_END: ConditionSeverity
    44  
    45  // ANCHOR: ConditionType
    46  
    47  // ConditionType is a valid value for Condition.Type.
    48  type ConditionType string
    49  
    50  // ANCHOR_END: ConditionType
    51  
    52  // ANCHOR: Condition
    53  
    54  // Condition defines an observation of a Cluster API resource operational state.
    55  type Condition struct {
    56  	// Type of condition in CamelCase or in foo.example.com/CamelCase.
    57  	// Many .condition.type values are consistent across resources like Available, but because arbitrary conditions
    58  	// can be useful (see .node.status.conditions), the ability to deconflict is important.
    59  	Type ConditionType `json:"type"`
    60  
    61  	// Status of the condition, one of True, False, Unknown.
    62  	Status corev1.ConditionStatus `json:"status"`
    63  
    64  	// Severity provides an explicit classification of Reason code, so the users or machines can immediately
    65  	// understand the current situation and act accordingly.
    66  	// The Severity field MUST be set only when Status=False.
    67  	// +optional
    68  	Severity ConditionSeverity `json:"severity,omitempty"`
    69  
    70  	// Last time the condition transitioned from one status to another.
    71  	// This should be when the underlying condition changed. If that is not known, then using the time when
    72  	// the API field changed is acceptable.
    73  	LastTransitionTime metav1.Time `json:"lastTransitionTime"`
    74  
    75  	// The reason for the condition's last transition in CamelCase.
    76  	// The specific API may choose whether or not this field is considered a guaranteed API.
    77  	// This field may not be empty.
    78  	// +optional
    79  	Reason string `json:"reason,omitempty"`
    80  
    81  	// A human readable message indicating details about the transition.
    82  	// This field may be empty.
    83  	// +optional
    84  	Message string `json:"message,omitempty"`
    85  }
    86  
    87  // ANCHOR_END: Condition
    88  
    89  // ANCHOR: Conditions
    90  
    91  // Conditions provide observations of the operational state of a Cluster API resource.
    92  type Conditions []Condition
    93  
    94  // ANCHOR_END: Conditions