Documentation ¶
Index ¶
Constants ¶
View Source
const ( // SyncTypeCreateOrUpdate - if not found will create, if existing will update the object SyncTypeCreateOrUpdate = SyncType("CreateOrUpdate") // SyncTypeCreateOrPatch - if not found will create, if existing will patch the object SyncTypeCreateOrPatch = SyncType("CreateOrPatch") // SyncTypeFoundToUpdate - if not found will do nothing, if existing will update the object SyncTypeFoundToUpdate = SyncType("FoundToUpdate") // SyncTypeFoundToPatch - if not found will do nothing, if existing will patch the object SyncTypeFoundToPatch = SyncType("FoundToUpPatch") )
Variables ¶
View Source
var ( // ErrOwnerDeleted is returned when the object owner is marked for deletion. ErrOwnerDeleted = fmt.Errorf("owner is deleted") // ErrIgnore is returned for ignored errors. // Ignored errors are treated by the syncer as successful syncs. ErrIgnore = fmt.Errorf("ignored error") )
Functions ¶
Types ¶
type ObjectSyncer ¶
type ObjectSyncer struct { Client client.Client Ctx context.Context Obj client.Object Owner client.Object MutateFn controllerutil.MutateFn SyncType SyncType // contains filtered or unexported fields }
ObjectSyncer is a Syncer for sync Objects only by passing a MutateFn.
func (*ObjectSyncer) ObjectOwner ¶
func (s *ObjectSyncer) ObjectOwner() runtime.Object
ObjectOwner returns the ObjectSyncer owner.
func (*ObjectSyncer) Sync ¶
func (s *ObjectSyncer) Sync(ctx context.Context) (SyncResult, error)
Sync does the actual syncing and implements the Syncer Sync method.
type SyncResult ¶
type SyncResult struct { Operation controllerutil.OperationResult EventType string EventReason string EventMessage string }
SyncResult is a result of an Sync.
func (*SyncResult) SetEventData ¶
func (r *SyncResult) SetEventData(eventType, reason, message string)
SetEventData sets event data on an SyncResult.
type Syncer ¶
Syncer is for sync Object's action.
func NewObjectSyncer ¶
func NewObjectSyncer(ctx context.Context, client client.Client, owner client.Object, MutateFn controllerutil.MutateFn, obj client.Object, syncType SyncType) Syncer
NewObjectSyncer creates a new kubernetes.Object syncer for object will set owner. And it can set SyncType. Mostly we should set CreateOrUpdate
Click to show internal directories.
Click to hide internal directories.