status

package
v0.20.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2025 License: Apache-2.0 Imports: 20 Imported by: 14

Documentation

Overview

The status package provides implementations for discovering and updating the CommonStatus on an Addon.

Index

Constants

View Source
const (
	AbnormalReason = "ManifestsNotReady"
	NormalReason   = "Normal"
	ReadyType      = "Ready"
)

Variables

This section is empty.

Functions

func GetConditions

func GetConditions(instance runtime.Object) ([]metav1.Condition, error)

GetConditions pulls out the `status.conditions` field from runtime.Object

func NewAggregator

func NewAggregator(_ client.Client) *aggregator

NewAggregator provides an implementation of declarative.Reconciled that aggregates the status of deployed objects to configure the 'Healthy' field on an addon that derives from CommonStatus

TODO: Create a version that doesn't require the unused client arg

func NewBasic deprecated

func NewBasic(client client.Client) declarative.Status

NewBasic provides an implementation of declarative.Status that performs no preflight checks.

Deprecated: This function exists for backward compatibility, please use NewKstatusCheck

func NewBasicVersionChecks

func NewBasicVersionChecks(client client.Client, version string) (declarative.Status, error)

NewBasicVersionCheck provides an implementation of declarative.Status that performs version checks for the version of the operator that the manifest requires.

func NewKstatusAgregator

func NewKstatusAgregator(_ client.Client, _ *declarative.Reconciler) *kstatusAggregator

TODO: Create a version that doesn't need reconciler or client?

func NewKstatusCheck

func NewKstatusCheck(client client.Client, d *declarative.Reconciler) declarative.Status

TODO: Create a version that doesn't take (unusued) client & reconciler args

func NewOpenKstatusAgregator

func NewOpenKstatusAgregator(gvkCMs map[string]status.GetConditionsFn, gvkACMs map[string]AbnormalConditionsMethod) *kstatusAggregator

NewOpenKstatusAgregator creates a kstatusAggregator with support for supplied gvk string specific 'Compute' and 'AbnormalConditions' methods Compute and Abnormal conditions methods should be supplied in assocation with a string of an explicit k8s.io/apimachinery/pkg/runtime/schema.GroupVersionKind (GVK) string

e.g. computMethods := make(map[string]GetConditionsFn) abnormalConditionsMethods := make(map[string]AbnormalConditionsMethod)

resourceGVK := schema.GroupVersionKind{...} computMethods[resourceGVK.String()] = <user supplied gvk specific 'Compute' method> abnormalConditionsMethods[resourceGVK.String()] = <user supplied gvk specific Abnormal Conditions method>

statusBuilder := &declarative.StatusBuilder  {
	BuildStatusImpl: status.NewOpenKStatusAggregator(computeMethods, abnormalConditionsMethods),
}

...

return r.Reconciler.Init(

WithStatus(statusBuilder),

)

func NewVersionCheck

func NewVersionCheck(client client.Client, operatorVersionString string) (*versionCheck, error)

NewVersionCheck provides an implementation of declarative.Reconciled that checks the version of the operator if it is up to the version required by the manifest

func SetConditions

func SetConditions(instance runtime.Object, newConditions []metav1.Condition) error

SetConditions sets the newConditions to runtime.Object `status.conditions` field.

Types

type AbnormalConditionsMethod

type AbnormalConditionsMethod func(ctx context.Context, unstruct *unstructured.Unstructured) []status.Condition

Returns the set of abnormal conditions for a given resource. abnormal conditions reflect any condition indicating an other than nominal state

Jump to

Keyboard shortcuts

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