templatecontroller

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: 19 Imported by: 0

Documentation

Overview

Package templatecontroller implements a TemplateReconciler that can reconcile Access Templates in a general sense.

Index

Constants

This section is empty.

Variables

This section is empty.

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 TemplateReconciler

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

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

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

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

	// Frequency to re-reconcile successfully reconciled templates
	ReconciliationInterval time.Duration
	// contains filtered or unexported fields
}

TemplateReconciler is configured to watch for a particular type (TemplateType) of Access Template and then execute the reconciler logic against them.

Unlike Access Requests, we don't believe that Templates need significant enough validation logic that they warrant their own IBuilder class.

func NewTemplateReconciler

func NewTemplateReconciler(
	mgr manager.Manager,
	res v1alpha1.ITemplateResource,
	interval int,
) *TemplateReconciler

NewTemplateReconciler returns a pointer to a TemplateReconciler.

func (*TemplateReconciler) GetAPIReader

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

GetAPIReader conforms to the internal.status.hasStatusReconciler interface.

func (*TemplateReconciler) Reconcile

func (r *TemplateReconciler) 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 (*TemplateReconciler) SetupWithManager

func (r *TemplateReconciler) 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