requestcontroller

package
v0.0.0-...-cd07ea3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2024 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package requestcontroller implements a RequestReconciler that can handle Access Requests in a general sense.

Index

Constants

This section is empty.

Variables

View Source
var DefaultVerifyResourcesRequeueInterval = (5 * time.Second)

DefaultVerifyResourcesRequeueInterval is the time inbetween reconcile attempts used when the resources have been created by the IBuilder CreateAccessResources() method, but the AccessResourcesAreReady() method returns False indicating that the resources have not yet completed their readiness checks.

Functions

This section is empty.

Types

type RequestContext

type RequestContext struct {
	context.Context
	// contains filtered or unexported fields
}

RequestContext represents a reconciliation request context.

type RequestReconciler

type RequestReconciler struct {
	client.Client
	Scheme *runtime.Scheme

	// RequestType informs the RequestReconciler what "Kind" of objects it
	// is going to Watch for, and how to retrive them from the Kubernetes API.
	RequestType v1alpha1.IRequestResource

	// Builder provides an IBuilder compatible object for handling the RequestType reconciliation
	Builder builders.IBuilder

	// APIReader should be generated with mgr.GetAPIReader() to create a non-cached client object.
	// This is used for certain Get() calls where we need to ensure we are getting the latest
	// version from the API, and not a cached object.
	//
	// See https://github.com/kubernetes-sigs/controller-runtime/issues/585#issuecomment-528102351
	//
	APIReader client.Reader

	// Frequency to re-reconcile successfully reconciled requests
	ReconciliationInterval time.Duration

	// Frequency to re-reconcile when the access resources have not become
	// available yet for an Access Request.
	VerifyResourcesRequeueInterval *time.Duration
}

RequestReconciler is configured watch for a particular type (RequestType) of Access Requests, and execute the reconciler logic against them with a particular Builder (Builder). The business logic of what happens in any type of Access Request as far as resource creation is all handled inside the Builder.

func (*RequestReconciler) GetAPIReader

func (r *RequestReconciler) GetAPIReader() client.Reader

GetAPIReader conforms to the internal.status.hasStatusReconciler interface.

func (*RequestReconciler) Reconcile

func (r *RequestReconciler) Reconcile(
	ctx context.Context,
	req ctrl.Request,
) (ctrl.Result, error)

Reconcile is a high level entrypoint triggered by Watches on particular Custom Resources within the cluster. This wrapper handles a few common startup behaviors, and introduces reconcile timing logging.

The real business-logic is in the reconcile() (lowercased) function.

func (*RequestReconciler) SetupWithManager

func (r *RequestReconciler) SetupWithManager(mgr ctrl.Manager) error

SetupWithManager sets up the controller with the Manager.

Jump to

Keyboard shortcuts

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