utils

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// PlatformConfiguration points to a configmap that maintain information about the installation.
	PlatformConfiguration = "platform"
)

Variables

This section is empty.

Functions

func Create

func Create(ctx context.Context, r 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, r 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 GetCallerInfo

func GetCallerInfo(skip int) (fileName, funcName string, line int)

func GetCallerLine

func GetCallerLine() string

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 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 SetOwner

func SetOwner(r Reconciler, parent, child metav1.Object)

SetOwner is a helper method to make sure the given object contains an object reference to the object provided. This behavior is instrumental to guarantee correct garbage collection of resources especially when resources control other resources in a multilevel hierarchy (think deployment-> repilcaset->pod).

func Stop

func Stop() (ctrl.Result, error)

func Update

func Update(ctx context.Context, r 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, r Reconciler, obj client.Object) error

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

func UseDefaultPlatformConfiguration added in v1.0.14

func UseDefaultPlatformConfiguration(ctx context.Context, r Reconciler, namespace string) error

Types

type Configuration added in v1.0.14

type Configuration struct {
	GrafanaEndpoint string

	PrometheusEndpoint string
}
var DefaultConfiguration Configuration

func GetPlatformConfiguration added in v1.0.14

func GetPlatformConfiguration(ctx context.Context, r Reconciler, namespace string) (Configuration, error)

GetPlatformConfiguration loads the platform configuration. The configuration must be pre-installed in the platform-configuration config map. (see chart/platform).

type Reconciler

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

	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 PVC.
	//
	// 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