common

package
v1.0.31 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BackoffForK8sEndpoint = wait.Backoff{
	Duration: 1 * time.Second,
	Factor:   5,
	Jitter:   0.1,
	Steps:    3,
}
View Source
var BackoffForServiceEndpoint = wait.Backoff{
	Duration: 5 * time.Second,
	Factor:   5,
	Jitter:   0.1,
	Steps:    3,
}

Functions

func Create

func Create(ctx context.Context, reconciler Reconciler, parent, child client.Object) error

Create ignores existing objects. if the next reconciliation cycle happens faster than the API update, it is possible to reschedule the creation of a Job. To avoid that, get if the Job is already submitted.

func Delete

func Delete(ctx context.Context, reconciler Reconciler, obj client.Object)

Delete removes a Kubernetes object, ignoring the NotFound error. If any error exists, it is recorded in the reconciler's logger.

func ExternalEndpoint

func ExternalEndpoint(name, planName string) string

ExternalEndpoint creates an endpoint for accessing the service outside the cluster.

func GenerateName added in v1.0.24

func GenerateName(group metav1.Object, jobIndex int) string

GenerateName names the children of a given resource. The instances will be named as Master-1, Master-2, ... see https://github.com/CARV-ICS-FORTH/frisbee/issues/339

func InternalEndpoint

func InternalEndpoint(name string, planName string, port int64) string

InternalEndpoint creates an endpoint for accessing the service within the cluster.

func IsManagedByThisController

func IsManagedByThisController(obj metav1.Object, controller schema.GroupVersionKind) bool

IsManagedByThisController returns true if the object is managed by the specified controller. If it is managed by another controller, or no controller is being resolved, it returns false.

func ListChildren

func ListChildren(ctx context.Context, reconciler Reconciler, childJobs client.ObjectList, req types.NamespacedName) error

func Reconcile

func Reconcile(ctx context.Context, r Reconciler, req ctrl.Request, obj client.Object, requeue *bool) (ctrl.Result, error)

Reconcile provides the most common functions for all the Reconcilers. That includes acquisition of the CR object

and management of the CR (Custom Resource) finalizers.

Bool indicate whether the caller should return immediately (true) or continue (false). The reconciliation cycle is where the framework gives us back control after a watch has passed up an event.

func Requeue

func Requeue() (ctrl.Result, error)

Requeue will place the request in a queue, and will be immediately dequeued.

func RequeueAfter

func RequeueAfter(delay time.Duration) (ctrl.Result, error)

RequeueAfter will place the request in a queue, but it will be dequeue after the specified period.

func RequeueWithError

func RequeueWithError(err error) (ctrl.Result, error)

RequeueWithError will place the request in a queue, and will be immediately dequeued. State dequeuing the request, the controller will report the error.

func Stop

func Stop() (ctrl.Result, error)

func Update

func Update(ctx context.Context, reconciler Reconciler, obj client.Object) error

Update will update the metadata and the spec of the Object. If there is a conflict, it will retry again.

func UpdateStatus

func UpdateStatus(ctx context.Context, reconciler Reconciler, obj client.Object) error

UpdateStatus will update the status of the Object. If there is a conflict, it will retry again.

Types

type Reconciler

type Reconciler interface {
	GetClient() client.Client
	GetCache() cache.Cache

	GetEventRecorderFor(name string) record.EventRecorder

	Error(err error, msg string, keysAndValues ...interface{})
	Info(msg string, keysAndValues ...interface{})
	V(level int) logr.Logger

	Finalizer() string

	// Finalize deletes any external resources associated with the service
	// Examples finalizers include performing backups and deleting
	// resources that are not owned by this CR, like a EphemeralVolume.
	//
	// Ensure that delete implementation is idempotent and safe to invoke
	// multiple times for same object
	Finalize(object client.Object) error
}

Reconciler implements basic functionality that is common to every solid reconciler (e.g, finalizers).

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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