status

package
v0.0.0-...-445da97 Latest Latest
Warning

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

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

Documentation

Overview

Package status provides primitives for extracting standardized conditions from unstructured objects.

# Standardized Conditions The package generates standardize conditions for core kubernetes resources. The Status conditions are grouped into these categories: - Level - Terminal - Progress

Level Conditions: Conditions that indicate stability, availability of affected objects. The controller in most cases does not have any pending work reconciling the .spec. The controller continues to react to spec changes and external inputs. - ConditionReady - ConditionSettled

Terminal Conditions: Conditions that indicate terminal conditions for the resource. Usually the controller does not do any more work and does not react to external inputs. Spec changes may be honored. - ConditionFailed - ConditionCompleted - ConditionTerminating

Progress Conditions: These conditions indicating progress. Indicates controller is actively working on the resource. - ConditionProgress

# Resources Custom client side logic is added to handle a set of core kubernetes resources. This is implemented in legacy_status.go For resources not matching legacy resource list and custom resources we attempt to look for standard conditions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasBeenObserved

func HasBeenObserved(u *unstructured.Unstructured) bool

HasBeenObserved returns True if .status.observedGeneration exists and matches .metadata.generation

func StableOrTerminal

func StableOrTerminal(resources []ResourceStatus) bool

StableOrTerminal returns True if all of the resources are stable or terminal

Types

type Condition

type Condition struct {
	// Type condition type
	Type ConditionType
	// Status String that describes the condition status
	Status string // metav1.ConditionStatus
	// Reason one work CamleCase reason
	Reason string
	// Message Human readable reason string
	Message string
}

Condition condition object computed by status package

func GetCondition

func GetCondition(cs []Condition, ct ConditionType) *Condition

GetCondition Returns the condition matching the type

func GetConditions

func GetConditions(u *unstructured.Unstructured) ([]Condition, error)

GetConditions Return a list of standardizes conditions for the given unstructured object

func (*Condition) SetReasonMessage

func (s *Condition) SetReasonMessage(reason, message string)

SetReasonMessage set

type ConditionType

type ConditionType string

ConditionType condition types

const (

	// ConditionReady Indicates the object is resource for use
	ConditionReady ConditionType = "Ready"
	// ConditionSettled Indicates the controller is done reconciling the spec
	// This is not implemented yet
	ConditionSettled ConditionType = "Settled"

	// ConditionFailed The resource is in failed condition and the controller will not process it further
	ConditionFailed ConditionType = "Failed"
	// ConditionCompleted The resource is done doing what it intends. Example Job, Pods can have completed state.
	ConditionCompleted ConditionType = "Completed"
	// Terminating Indicates the resource is being deleted.
	ConditionTermination ConditionType = "Terminating"

	// ConditionProgress Indicates the controller is still working to satisfy the intent in the resource spec.
	ConditionProgress ConditionType = "Progress"
)

Condition types

type GetConditionsFn

type GetConditionsFn func(*unstructured.Unstructured) ([]Condition, error)

GetConditionsFn status getter

func GetGenericConditionsFn

func GetGenericConditionsFn(u *unstructured.Unstructured) GetConditionsFn

GetGenericConditionsFn Return a function that returns condition for an unstructured object

func GetLegacyConditionsFn

func GetLegacyConditionsFn(u *unstructured.Unstructured) GetConditionsFn

GetLegacyConditionsFn Return condition getter function

type ResourceStatus

type ResourceStatus struct {
	// Resource unstructured object whose resource is being described
	Resource *unstructured.Unstructured // Deletion in progress
	// Conditions list of extracted conditions from Resource
	Conditions []Condition
	// Errror Any error encountered extracting status for this Resource
	Error error
}

ResourceStatus resource status

type Result

type Result struct {
	// Resources list of resource status
	Resources []ResourceStatus
}

Result contains the Status Result

type Status

type Status struct {
	// DynamicClient is the client used to talk
	// with the cluster
	DynamicClient client.Client
	// Out stores the output
	Out io.Writer
	// Resources is a list of resource configurations
	Resources clik8s.ResourceConfigs
	// Commit is a git commit object
	Commit *object.Commit
}

Status returns the status for rollouts

func (*Status) Do

func (a *Status) Do() Result

Do works on the list of resources and computes status for the resources.

func (*Status) OutputResult

func (a *Status) OutputResult(resources []ResourceStatus)

OutputResult print to output writer

Jump to

Keyboard shortcuts

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