Documentation
¶
Index ¶
- func GetObjectType(obj interface{}) string
- type ClientWrapper
- type K8sClientWrapper
- func (k K8sClientWrapper) Create(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (k K8sClientWrapper) CreateIfNotExists(ctx context.Context, obj client.Object, opts ...client.CreateOption) error
- func (k K8sClientWrapper) DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
- func (k K8sClientWrapper) DeleteByKeyIgnoreNotFound(ctx context.Context, key client.ObjectKey, objectMeta client.Object, ...) error
- func (k K8sClientWrapper) GetIgnoreNotFound(ctx context.Context, key client.ObjectKey, objectMeta client.Object, ...) (bool, error)
- func (k K8sClientWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) ([]runtime.Object, error)
- func (k K8sClientWrapper) Sync(ctx context.Context, obj client.Object, opts ...SyncOption) error
- func (k K8sClientWrapper) SyncStatus(ctx context.Context, obj client.Object, opts ...SyncOption) error
- type SyncOption
- type SyncOptions
- type SyncTarget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetObjectType ¶
func GetObjectType(obj interface{}) string
Types ¶
type ClientWrapper ¶
type ClientWrapper interface {
// Sync ensures that the object is up to date in the cluster.
// Object is created if it does not exist and updated if it exists but is different.
// Returns nil if object is in sync.
Sync(ctx context.Context, blueprint client.Object, opts ...SyncOption) error
// SyncStatus ensures that the status subresource of the object is up to date in the cluster.
// Object must exist, otherwise an error is returned.
// Returns nil if object is in sync.
SyncStatus(ctx context.Context, blueprint client.Object, opts ...SyncOption) error
// Create creates object.
// Returns nil if object is created otherwise returns error.
Create(ctx context.Context, blueprint client.Object, opts ...client.CreateOption) error
// CreateIfNotExists creates object if not exists.
// Returns nil if object is created or exists otherwise returns error.
CreateIfNotExists(ctx context.Context, blueprint client.Object, opts ...client.CreateOption) error
// GetIgnoreNotFound gets object.
// Returns true if object exists otherwise returns false.
// Returns nil if object is retrieved or not found otherwise returns error.
GetIgnoreNotFound(ctx context.Context, key client.ObjectKey, objectMeta client.Object, opts ...client.GetOption) (bool, error)
// DeleteByKeyIgnoreNotFound deletes object by key.
// The object is fetched from the cluster first, so the object passed in
// only needs to carry the type, not the actual content.
// Returns nil if object is deleted or not found otherwise returns error.
DeleteByKeyIgnoreNotFound(ctx context.Context, key client.ObjectKey, objectMeta client.Object, opts ...client.DeleteOption) error
// DeleteAllOf deletes all objects of the given type.
// Returns nil if objects are deleted otherwise returns error.
DeleteAllOf(ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption) error
// List returns list of runtime objects.
// Returns nil if list is retrieved otherwise returns error.
List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) ([]runtime.Object, error)
}
type K8sClientWrapper ¶
type K8sClientWrapper struct {
// contains filtered or unexported fields
}
func (K8sClientWrapper) Create ¶
func (k K8sClientWrapper) Create( ctx context.Context, obj client.Object, opts ...client.CreateOption, ) error
func (K8sClientWrapper) CreateIfNotExists ¶
func (k K8sClientWrapper) CreateIfNotExists( ctx context.Context, obj client.Object, opts ...client.CreateOption, ) error
func (K8sClientWrapper) DeleteAllOf ¶
func (k K8sClientWrapper) DeleteAllOf( ctx context.Context, obj client.Object, opts ...client.DeleteAllOfOption, ) error
func (K8sClientWrapper) DeleteByKeyIgnoreNotFound ¶
func (k K8sClientWrapper) DeleteByKeyIgnoreNotFound( ctx context.Context, key client.ObjectKey, objectMeta client.Object, opts ...client.DeleteOption, ) error
func (K8sClientWrapper) GetIgnoreNotFound ¶
func (K8sClientWrapper) List ¶
func (k K8sClientWrapper) List(ctx context.Context, list client.ObjectList, opts ...client.ListOption) ([]runtime.Object, error)
func (K8sClientWrapper) Sync ¶
func (k K8sClientWrapper) Sync( ctx context.Context, obj client.Object, opts ...SyncOption, ) error
func (K8sClientWrapper) SyncStatus ¶
func (k K8sClientWrapper) SyncStatus( ctx context.Context, obj client.Object, opts ...SyncOption, ) error
type SyncOption ¶
type SyncOption interface {
ApplyToSync(*SyncOptions)
}
type SyncOptions ¶
type SyncOptions struct {
// MergeLabels can be used to merge labels from existing object to the new one
MergeLabels bool
// MergeAnnotations can be used to merge annotations from existing object to the new one
MergeAnnotations bool
// PreserveFinalizers can be used to keep the finalizers of the existing object on update,
// so that finalizers owned by other controllers are not stripped
PreserveFinalizers bool
// SuppressDiff can be used to suppress printing diff when object is not in sync
SuppressDiff bool
// DiffOpts can be used to customize comparison when object is not in sync
DiffOpts []cmp.Option
// DeleteOpts can be used to customize deletion when object is recreated
DeleteOpts []client.DeleteOption
// ForceRecreate deletes and re-creates the object instead of updating it when it is not in sync.
// This applies to every kind, so it is caller's responsibility.
ForceRecreate bool
}
func (*SyncOptions) ApplyOptions ¶
func (o *SyncOptions) ApplyOptions(opts []SyncOption)
func (*SyncOptions) ApplyToSync ¶
func (o *SyncOptions) ApplyToSync(so *SyncOptions)
type SyncTarget ¶
Click to show internal directories.
Click to hide internal directories.