trait

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2020 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package trait provides a reconciler OAM traits.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoopModifier

func NoopModifier(_ context.Context, _ runtime.Object, _ resource.Trait) error

NoopModifier makes no modifications and returns no errors.

func NoopModifyAccessor

func NoopModifyAccessor(ctx context.Context, obj runtime.Object, t resource.Trait, m ModifyFn) error

NoopModifyAccessor passes the provided object to the modifier as-is.

Types

type Modifier

type Modifier interface {
	Modify(context.Context, runtime.Object, resource.Trait) error
}

A Modifier is responsible for modifying or adding objects to a workload translation.

func NewWorkloadModifierWithAccessor

func NewWorkloadModifierWithAccessor(m ModifyFn, a ModifyAccessor) Modifier

NewWorkloadModifierWithAccessor is a modifier of a workload translation that uses an accessor.

type ModifyAccessor

type ModifyAccessor func(context.Context, runtime.Object, resource.Trait, ModifyFn) error

A ModifyAccessor obtains the object to be modified from a wrapping object.

type ModifyFn

type ModifyFn func(ctx context.Context, obj runtime.Object, t resource.Trait) error

A ModifyFn modifies or adds an object to a workload translation.

func (ModifyFn) Modify

func (fn ModifyFn) Modify(ctx context.Context, obj runtime.Object, t resource.Trait) error

Modify object in workload translation.

type Reconciler

type Reconciler struct {
	// contains filtered or unexported fields
}

A Reconciler reconciles OAM traits by modifying the object that a workload has been translated into.

func NewReconciler

func NewReconciler(m ctrl.Manager, trait resource.TraitKind, trans resource.ObjectKind, o ...ReconcilerOption) *Reconciler

NewReconciler returns a Reconciler that reconciles OAM traits by fetching their referenced workload's translation and applying modifications.

func (*Reconciler) Reconcile

func (r *Reconciler) Reconcile(req reconcile.Request) (reconcile.Result, error)

Reconcile an OAM trait type by modifying its referenced workload's KubernetesApplication.

type ReconcilerOption

type ReconcilerOption func(*Reconciler)

A ReconcilerOption configures a Reconciler.

func WithApplicator

func WithApplicator(a resource.Applicator) ReconcilerOption

WithApplicator specifies how the Reconciler should apply the workload translation modification.

func WithLogger

func WithLogger(l logging.Logger) ReconcilerOption

WithLogger specifies how the Reconciler should log messages.

func WithModifier

func WithModifier(m Modifier) ReconcilerOption

WithModifier specifies how the Reconciler should modify the workload translation.

func WithRecorder

func WithRecorder(er event.Recorder) ReconcilerOption

WithRecorder specifies how the Reconciler should record events.

type WorkloadModifier

type WorkloadModifier struct {
	ModifyFn
}

WorkloadModifier is a concrete implementation of a Modifier.

func (*WorkloadModifier) Modify

Modify modifies or adds an object in a workload translation.

Jump to

Keyboard shortcuts

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