controllers

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2024 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const AccountFinalizer = "accounts.nats.io/finalizer"

Variables

This section is empty.

Functions

func AsResult added in v0.2.4

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

AsResult uses err to return a ctrl.Result and error to the reconciler runtime, taking into account whether the error is temporary, terminal or neither. The fallback is to return an empty result with the causing error, resulting in the reconciler runtime logging the error and re-enqueuing the reconciliation.

func ConditionFailed

func ConditionFailed(reason, msgFmt string, args ...any) error

func ConditionUnknown

func ConditionUnknown(reason, msgFmt string, args ...any) error

func MarkCondition added in v0.2.4

func MarkCondition(err error, failure, unknown markConditionFunc)

MarkCondition uses err to mark the condition of the owning object. If err contains a conditionError, the condition will be marked as either failed or unknown, depending on the state of said conditionError.

func NewResultError added in v0.2.4

func NewResultError(result ctrl.Result, err error) error

NewResultError is used to terminate reconciliation and control whether the request should be re-enqueued by the result parameter.

func NewSecret

func NewSecret(name, namespace string, opts ...SecretOpt) v1.Secret

NewSecret creates a new secret with the given name and namespace. Other options can be passed in to set desired fields.

func TemporaryError added in v0.2.4

func TemporaryError(err error) error

TemporaryError is used to terminate reconciliation and will result in the request being re-enqueued.

func TerminalError added in v0.2.4

func TerminalError(err error) error

TerminalError is used to terminate reconciliation and will not result in the request being re-enqueued.

Types

type AccountReconciler

type AccountReconciler struct {
	*BaseReconciler
	AccountsV1Alpha1 accountsclientsets.AccountsV1alpha1Interface
	SysAccountLoader *nsc.SystemAccountLoader
}

AccountReconciler reconciles an Account object

func (*AccountReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.13.0/pkg/reconcile

func (*AccountReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type BaseReconciler

type BaseReconciler struct {
	client.Client
	Scheme        *runtime.Scheme
	CoreV1        corev1.CoreV1Interface
	EventRecorder record.EventRecorder
}

type OperatorReconciler

type OperatorReconciler struct {
	client.Client
	Scheme            *runtime.Scheme
	CV1Interface      corev1.CoreV1Interface
	AccountsClientSet accountsclientsets.AccountsV1alpha1Interface
}

OperatorReconciler reconciles a Operator object

func (*OperatorReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.13.0/pkg/reconcile

func (*OperatorReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type SecretOpt

type SecretOpt func(*v1.Secret)

func WithAnnotations

func WithAnnotations(annotations map[string]string) SecretOpt

WithAnnotations sets the annotations of the ObjectMeta in the secret.

func WithData

func WithData(data map[string][]byte) SecretOpt

WithData sets the data of the secret.

func WithImmutable

func WithImmutable(immutable bool) SecretOpt

WithImmutable sets the immutable field of the secret.

func WithLabels

func WithLabels(labels map[string]string) SecretOpt

WithLabels sets the labels of the ObjectMeta in the secret.

func WithStringData

func WithStringData(data map[string]string) SecretOpt

WithStringData sets the string data of the secret.

type SigningKeyReconciler

type SigningKeyReconciler struct {
	client.Client
	Scheme            *runtime.Scheme
	CV1Interface      corev1.CoreV1Interface
	AccountsClientSet accountsclientsets.AccountsV1alpha1Interface
}

SigningKeyReconciler reconciles a SigningKey object

func (*SigningKeyReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.13.0/pkg/reconcile

func (*SigningKeyReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

type UserReconciler

type UserReconciler struct {
	*BaseReconciler
	AccountsClientSet accountsclientsets.AccountsV1alpha1Interface
	EventRecorder     record.EventRecorder
}

UserReconciler reconciles a User object

func (*UserReconciler) Reconcile

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

Reconcile is part of the main kubernetes reconciliation loop which aims to move the current state of the cluster closer to the desired state.

For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.13.0/pkg/reconcile

func (*UserReconciler) SetupWithManager

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

SetupWithManager sets up the controller with the Manager.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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