status

package
v0.0.0-...-152d8e3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Overview

Inspired by https://github.com/knative/pkg/tree/97c7258e3a98b81459936bc7a29dc6a9540fa357/apis, but we chose to diverge due to the unacceptably large dependency closure of knative/pkg.

Inspired by https://github.com/knative/pkg/tree/97c7258e3a98b81459936bc7a29dc6a9540fa357/apis, but we chose to diverge due to the unacceptably large dependency closure of knative/pkg.

+k8s:deepcopy-gen=package,register +kubebuilder:object:generate=false

Index

Constants

View Source
const (
	// ConditionReady specifies that the resource is ready.
	// For long-running resources.
	ConditionReady = "Ready"
	// ConditionSucceeded specifies that the resource has finished.
	// For resource which run to completion.
	ConditionSucceeded = "Succeeded"
)
View Source
const (
	MetricLabelGroup           = "group"
	MetricLabelKind            = "kind"
	MetricLabelNamespace       = "namespace"
	MetricLabelName            = "name"
	MetricLabelConditionType   = "type"
	MetricLabelConditionStatus = "status"
)
View Source
const (
	MetricNamespace = "operator"
	MetricSubsystem = "status_condition"
)

Variables

View Source
var ConditionCount = prometheus.NewGaugeVec(
	prometheus.GaugeOpts{
		Namespace: MetricNamespace,
		Subsystem: MetricSubsystem,
		Name:      "count",
		Help:      "The number of an condition for a given object, type and status. e.g. Alarm := Available=False > 0",
	},
	[]string{
		MetricLabelNamespace,
		MetricLabelName,
		MetricLabelGroup,
		MetricLabelKind,
		MetricLabelConditionType,
		MetricLabelConditionStatus,
	},
)

Cardinality is limited to # objects * # conditions

View Source
var ConditionDuration = prometheus.NewHistogramVec(
	prometheus.HistogramOpts{
		Namespace: MetricNamespace,
		Subsystem: MetricSubsystem,
		Name:      "transition_seconds",
		Help:      "The amount of time a condition was in a given state before transitioning. e.g. Alarm := P99(Updated=False) > 5 minutes",
	},
	[]string{
		MetricLabelGroup,
		MetricLabelKind,
		MetricLabelConditionType,
		MetricLabelConditionStatus,
	},
)

Cardinality is limited to # objects * # conditions * # objectives

Functions

This section is empty.

Types

type Condition

type Condition metav1.Condition

Condition aliases the upstream type and adds additional helper methods

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.

func (*Condition) GetStatus

func (c *Condition) GetStatus() metav1.ConditionStatus

func (*Condition) IsFalse

func (c *Condition) IsFalse() bool

func (*Condition) IsTrue

func (c *Condition) IsTrue() bool

func (*Condition) IsUnknown

func (c *Condition) IsUnknown() bool

type ConditionSet

type ConditionSet struct {
	ConditionTypes
	// contains filtered or unexported fields
}

ConditionSet provides methods for evaluating Conditions. +k8s:deepcopy-gen=false

func (ConditionSet) Clear

func (c ConditionSet) Clear(t string) error

RemoveCondition removes the non normal condition that matches the ConditionType Not implemented for normal conditions

func (ConditionSet) Get

func (c ConditionSet) Get(t string) *Condition

GetCondition finds and returns the Condition that matches the ConditionType previously set on Conditions.

func (ConditionSet) IsTrue

func (c ConditionSet) IsTrue(conditionTypes ...string) bool

True returns true if all condition types are true.

func (ConditionSet) List

func (c ConditionSet) List() []Condition

func (ConditionSet) Root

func (c ConditionSet) Root() *Condition

Root returns the root Condition, typically "Ready" or "Succeeded"

func (ConditionSet) Set

func (c ConditionSet) Set(condition Condition) (modified bool)

Set sets or updates the Condition on Conditions for Condition.Type. If there is an update, Conditions are stored back sorted.

func (ConditionSet) SetFalse

func (r ConditionSet) SetFalse(conditionType string, reason, message string) (modified bool)

SetFalse sets the status of t and the root condition to False.

func (ConditionSet) SetTrue

func (c ConditionSet) SetTrue(conditionType string) (modified bool)

SetTrue sets the status of t to true with the reason, and then marks the root condition to true if all other dependents are also true.

func (ConditionSet) SetTrueWithReason

func (c ConditionSet) SetTrueWithReason(conditionType string, reason, message string) (modified bool)

SetTrueWithReason sets the status of t to true with the reason, and then marks the root condition to true if all other dependents are also true.

func (ConditionSet) SetUnknown

func (r ConditionSet) SetUnknown(conditionType string) (modified bool)

SetUnknown sets the status of conditionType to Unknown and also sets the root condition to Unknown if no other dependent condition is in an error state.

type ConditionType

type ConditionType string

ConditionType is a upper-camel-cased condition type.

type ConditionTypes

type ConditionTypes struct {
	// contains filtered or unexported fields
}

ConditionTypes is an abstract collection of the possible ConditionType values that a particular resource might expose. It also holds the "root condition" for that resource, which we define to be one of Ready or Succeeded depending on whether it is a Living or Batch process respectively.

func NewReadyConditions

func NewReadyConditions(d ...string) ConditionTypes

NewReadyConditions returns a ConditionTypes to hold the conditions for the resource. ConditionReady is used as the root condition. The set of condition types provided are those of the terminal subconditions.

func NewSucceededConditions

func NewSucceededConditions(d ...string) ConditionTypes

NewSucceededConditions returns a ConditionTypes to hold the conditions for the batch resource. ConditionSucceeded is used as the root condition. The set of condition types provided are those of the terminal subconditions.

func (ConditionTypes) For

func (r ConditionTypes) For(object Object) ConditionSet

For creates a ConditionSet from an object using the original ConditionTypes as a reference. Status must be a pointer to a struct.

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func NewController

func NewController(client client.Client, forObject Object, eventRecorder record.EventRecorder) *Controller

func (*Controller) Reconcile

func (c *Controller) Reconcile(ctx context.Context, req reconcile.Request) (reconcile.Result, error)

func (*Controller) Register

func (c *Controller) Register(ctx context.Context, m manager.Manager) error

type Object

type Object interface {
	client.Object
	GetConditions() []Condition
	SetConditions([]Condition)
	StatusConditions() ConditionSet
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL