runtime

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2023 License: AGPL-3.0 Imports: 12 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func EventReason

func EventReason(obj client.Object, err error) string

EventReason sets the syncer result reason for kind

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 SyncType

type SyncType string

SyncType is for controlling syncer performance

type Syncer

type Syncer interface {
	Sync(context.Context) (SyncResult, error)
	ObjectOwner() runtime.Object
}

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

Jump to

Keyboard shortcuts

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