await

package
v4.0.0-...-cce7961 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2024 License: Apache-2.0 Imports: 57 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultDeploymentTimeoutMins = 10
)
View Source
const (
	DefaultIngressTimeoutMins = 10
)
View Source
const (
	DefaultJobTimeoutMins = 10
)
View Source
const (
	DefaultPodTimeoutMins = 10
)
View Source
const (
	DefaultServiceTimeoutMins = 10
)
View Source
const (
	DefaultStatefulSetTimeoutMins = 10
)

Variables

This section is empty.

Functions

func Creation

Creation (as the usage, `await.Creation`, implies) will block until one of the following is true: (1) the Kubernetes resource is reported to be initialized; (2) the initialization timeout has occurred; or (3) an error has occurred while the resource was being initialized.

func Deletion

func Deletion(c DeleteConfig) error

Deletion (as the usage, `await.Deletion`, implies) will block until one of the following is true: (1) the Kubernetes resource is reported to be deleted; (2) the initialization timeout has occurred; or (3) an error has occurred while the resource was being deleted.

func IsDeleteRequiredFieldErr

func IsDeleteRequiredFieldErr(err error) bool

IsDeleteRequiredFieldErr is true if the user attempted to delete a Patch resource that was the sole manager of a required field.

func IsNamespaceNotFoundErr

func IsNamespaceNotFoundErr(err error) bool

IsNamespaceNotFoundErr returns true if the namespace wasn't found for a k8s client operation.

func IsResourceExistsErr

func IsResourceExistsErr(err error) bool

IsResourceExistsErr returns true if the resource already exists on the k8s cluster.

func NewEventAggregator

func NewEventAggregator(
	ctx context.Context,
	source condition.Source,
	logger logMessager,
	owner *unstructured.Unstructured,
) condition.Observer

NewEventAggregator creates a new condition.Observer subscribed to Kubernetes events related to the owner object. Event messages are logged at WARN severity if the event has type Warning; Normal events are discarded to reduce noise.

func Read

Read checks a resource, returning the object if it was created and initialized successfully.

func Update

Update updates an existing resource with new values. This client uses a Server-side Apply (SSA) patch by default, but also supports the older three-way JSON patch and the strategic merge patch as fallback options. See references [1], [2], [3].

nolint [1]: https://kubernetes.io/docs/tasks/run-application/update-api-object-kubectl-patch/#use-a-json-merge-patch-to-update-a-deployment [2]: https://kubernetes.io/docs/concepts/overview/object-management-kubectl/declarative-config/#how-apply-calculates-differences-and-merges-changes [3]: https://kubernetes.io/docs/reference/using-api/server-side-apply

Types

type AggregatedError

type AggregatedError interface {
	SubErrors() []string
}

AggregatedError represents an error with 0 or more sub-errors.

type Aggregator

type Aggregator[T runtime.Object] struct {
	// contains filtered or unexported fields
}

Aggregator is a generic, stateless condition.Observer intended for reporting informational messages about related resources during an Await.

func NewAggregator

func NewAggregator[T runtime.Object](
	observer condition.Observer,
	logger logMessager,
	callback func(logMessager, T) error,
) *Aggregator[T]

NewAggregator creates a new Aggregator for the given runtime type. The provided condition.Observer must be configured for the corresponding GVK.

func (*Aggregator[T]) Observe

func (i *Aggregator[T]) Observe(e watch.Event) error

func (*Aggregator[T]) Range

func (i *Aggregator[T]) Range(yield func(watch.Event) bool)

type CreateConfig

type CreateConfig struct {
	ProviderConfig
	Inputs  *unstructured.Unstructured
	Timeout float64
	Preview bool
}

type DeleteConfig

type DeleteConfig struct {
	ProviderConfig
	Inputs  *unstructured.Unstructured
	Outputs *unstructured.Unstructured
	Name    string
	Timeout float64
}

type PartialError

type PartialError interface {
	Object() *unstructured.Unstructured
}

PartialError represents an object that failed to complete its current operation.

type PodAggregator

type PodAggregator struct {
	// Synchronization
	sync.Mutex
	// contains filtered or unexported fields
}

PodAggregator tracks status for any Pods related to the owner resource, and writes warning/error messages to a channel that can be consumed by a resource awaiter.

func NewPodAggregator

func NewPodAggregator(owner *unstructured.Unstructured, lister lister) *PodAggregator

NewPodAggregator returns an initialized PodAggregator.

func (*PodAggregator) Read

func (pa *PodAggregator) Read() checkerlog.Messages

Read lists existing Pods and returns any related warning/error messages.

func (*PodAggregator) ResultChan

func (pa *PodAggregator) ResultChan() <-chan checkerlog.Messages

ResultChan returns a reference to the message channel used by the PodAggregator to communicate warning/error messages to a resource awaiter.

func (*PodAggregator) Start

func (pa *PodAggregator) Start(informChan <-chan watch.Event)

Start initiates the aggregation logic and is executed as a goroutine which should be stopped through a call to Stop

func (*PodAggregator) Stop

func (pa *PodAggregator) Stop()

Stop safely stops a PodAggregator and underlying watch client.

type PreviewError

type PreviewError interface {
	Object() *unstructured.Unstructured
}

PreviewError represents a preview operation that failed.

type ProviderConfig

type ProviderConfig struct {
	Context           context.Context
	Host              host.HostClient
	URN               resource.URN
	InitialAPIVersion string
	FieldManager      string
	ClusterVersion    *cluster.ServerVersion
	ServerSideApply   bool

	ClientSet   *clients.DynamicClientSet
	DedupLogger *logging.DedupLogger
	Resources   k8sopenapi.Resources
	// contains filtered or unexported fields
}

type ReadConfig

type ReadConfig struct {
	ProviderConfig
	Inputs          *unstructured.Unstructured
	Name            string
	ReadFromCluster bool
}

type UpdateConfig

type UpdateConfig struct {
	ProviderConfig
	OldInputs  *unstructured.Unstructured
	OldOutputs *unstructured.Unstructured
	Inputs     *unstructured.Unstructured
	Timeout    float64
	Preview    bool
	// IgnoreChanges is a list of fields to ignore when diffing the old and new objects.
	IgnoreChanges []string
}

Directories

Path Synopsis
Package condition contains interfaces and primitives for use with our await logic.
Package condition contains interfaces and primitives for use with our await logic.

Jump to

Keyboard shortcuts

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