workload

package
v0.6.0 Latest Latest
Warning

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

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

Documentation

Overview

Package workload provides a reconciler that for OAM workloads.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NoopTranslate

func NoopTranslate(ctx context.Context, w resource.Workload) ([]resource.Object, error)

NoopTranslate does not translate the workload and does not return error.

func NoopWrapper

func NoopWrapper(ctx context.Context, w resource.Workload, objs []resource.Object) ([]resource.Object, error)

NoopWrapper does not wrap the workload translation and does not return error.

Types

type ObjectTranslator

type ObjectTranslator struct {
	TranslateFn
}

An ObjectTranslator is a concrete implementation of a Translator.

func (*ObjectTranslator) Translate

Translate a workload into other objects.

type Reconciler

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

A Reconciler reconciles an OAM workload type by packaging it into a KubernetesApplication.

func NewReconciler

func NewReconciler(m ctrl.Manager, workload resource.WorkloadKind, o ...ReconcilerOption) *Reconciler

NewReconciler returns a Reconciler that reconciles an OAM workload type by packaging it into a KubernetesApplication.

func (*Reconciler) Reconcile

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

Reconcile an OAM workload type by packaging it into a 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.

func WithApplyOptions

func WithApplyOptions(a ...resource.ApplyOption) ReconcilerOption

WithApplyOptions specifies options to pass to the applicator.

func WithLogger

func WithLogger(l logging.Logger) ReconcilerOption

WithLogger specifies how the Reconciler should log messages.

func WithRecorder

func WithRecorder(er event.Recorder) ReconcilerOption

WithRecorder specifies how the Reconciler should record events.

func WithTranslator

func WithTranslator(t Translator) ReconcilerOption

WithTranslator specifies how the Reconciler should translate the workload.

type TranslateFn

type TranslateFn func(context.Context, resource.Workload) ([]resource.Object, error)

A TranslateFn translates a workload into an object.

func (TranslateFn) Translate

func (fn TranslateFn) Translate(ctx context.Context, w resource.Workload) ([]resource.Object, error)

Translate workload into object or objects with no wrappers.

type TranslationWrapper

type TranslationWrapper func(context.Context, resource.Workload, []resource.Object) ([]resource.Object, error)

A TranslationWrapper wraps the output of a workload translation in another object or adds addition object.

type Translator

type Translator interface {
	Translate(context.Context, resource.Workload) ([]resource.Object, error)
}

A Translator is responsible for packaging workloads into other objects.

func NewObjectTranslatorWithWrappers

func NewObjectTranslatorWithWrappers(t TranslateFn, wp ...TranslationWrapper) Translator

NewObjectTranslatorWithWrappers returns a Translator that translates and wraps a workload.

Jump to

Keyboard shortcuts

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