sync

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2021 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SyncObjectWithCluster

func SyncObjectWithCluster(specObj crclient.Object, api ClusterAPI) (crclient.Object, error)

SyncObjectWithCluster synchronises the state of specObj to the cluster, creating or updating the cluster object as required. If specObj is in sync with the cluster, returns the object as it exists on the cluster. Returns a NotInSyncError if an update is required, UnrecoverableSyncError if object provided is invalid, or generic error if an unexpected error is encountered

Types

type ClusterAPI

type ClusterAPI struct {
	Client crclient.Client
	Scheme *runtime.Scheme
	Logger logr.Logger
	Ctx    context.Context
}

type NotInSyncError

type NotInSyncError struct {
	Reason NotInSyncReason
	Object crclient.Object
}

NotInSyncError is returned when a spec object is out-of-sync with its cluster counterpart

func NewNotInSync

func NewNotInSync(obj crclient.Object, reason NotInSyncReason) *NotInSyncError

NewNotInSync wraps creation of NotInSyncErrors for simplicity

func (*NotInSyncError) Error

func (e *NotInSyncError) Error() string

type NotInSyncReason

type NotInSyncReason string
const (
	UpdatedObjectReason NotInSyncReason = "Updated object"
	CreatedObjectReason NotInSyncReason = "Created object"
	DeletedObjectReason NotInSyncReason = "Deleted object"
	NeedRetryReason     NotInSyncReason = "Need to retry"
)

type UnrecoverableSyncError

type UnrecoverableSyncError struct {
	Cause error
}

UnrecoverableSyncError is returned when provided objects cannot be synced with the cluster due to an unexpected error (e.g. they are invalid according to the object's spec).

func (*UnrecoverableSyncError) Error

func (e *UnrecoverableSyncError) Error() string

Jump to

Keyboard shortcuts

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