Documentation ¶
Index ¶
- Constants
- func Creation(c CreateConfig) (*unstructured.Unstructured, error)
- func Deletion(c DeleteConfig) error
- func IsDeleteRequiredFieldErr(err error) bool
- func IsNamespaceNotFoundErr(err error) bool
- func IsResourceExistsErr(err error) bool
- func NewEventAggregator(ctx context.Context, source condition.Source, logger logMessager, ...) condition.Observer
- func Read(c ReadConfig) (*unstructured.Unstructured, error)
- func Update(c UpdateConfig) (*unstructured.Unstructured, error)
- type AggregatedError
- type Aggregator
- type CreateConfig
- type DeleteConfig
- type PartialError
- type PodAggregator
- type PreviewError
- type ProviderConfig
- type ReadConfig
- type UpdateConfig
Constants ¶
const (
DefaultDeploymentTimeoutMins = 10
)
const (
DefaultIngressTimeoutMins = 10
)
const (
DefaultJobTimeoutMins = 10
)
const (
DefaultPodTimeoutMins = 10
)
const (
DefaultServiceTimeoutMins = 10
)
const (
DefaultStatefulSetTimeoutMins = 10
)
Variables ¶
This section is empty.
Functions ¶
func Creation ¶
func Creation(c CreateConfig) (*unstructured.Unstructured, error)
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 ¶
IsDeleteRequiredFieldErr is true if the user attempted to delete a Patch resource that was the sole manager of a required field.
func IsNamespaceNotFoundErr ¶
IsNamespaceNotFoundErr returns true if the namespace wasn't found for a k8s client operation.
func IsResourceExistsErr ¶
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 ¶
func Read(c ReadConfig) (*unstructured.Unstructured, error)
Read checks a resource, returning the object if it was created and initialized successfully.
func Update ¶
func Update(c UpdateConfig) (*unstructured.Unstructured, error)
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 ¶
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.
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 }