sigs.k8s.io/cluster-api@v1.6.3/api/v1alpha4/condition_types.go (about)

     1  /*
     2  Copyright 2020 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 v1alpha4
    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  	// +required
    60  	Type ConditionType `json:"type"`
    61  
    62  	// Status of the condition, one of True, False, Unknown.
    63  	// +required
    64  	Status corev1.ConditionStatus `json:"status"`
    65  
    66  	// Severity provides an explicit classification of Reason code, so the users or machines can immediately
    67  	// understand the current situation and act accordingly.
    68  	// The Severity field MUST be set only when Status=False.
    69  	// +optional
    70  	Severity ConditionSeverity `json:"severity,omitempty"`
    71  
    72  	// Last time the condition transitioned from one status to another.
    73  	// This should be when the underlying condition changed. If that is not known, then using the time when
    74  	// the API field changed is acceptable.
    75  	// +required
    76  	LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty"`
    77  
    78  	// The reason for the condition's last transition in CamelCase.
    79  	// The specific API may choose whether or not this field is considered a guaranteed API.
    80  	// This field may not be empty.
    81  	// +optional
    82  	Reason string `json:"reason,omitempty"`
    83  
    84  	// A human readable message indicating details about the transition.
    85  	// This field may be empty.
    86  	// +optional
    87  	Message string `json:"message,omitempty"`
    88  }
    89  
    90  // ANCHOR_END: Condition
    91  
    92  // ANCHOR: Conditions
    93  
    94  // Conditions provide observations of the operational state of a Cluster API resource.
    95  type Conditions []Condition
    96  
    97  // ANCHOR_END: Conditions