Documentation ¶
Overview ¶
Package workload provides a reconciler that for OAM workloads.
Index ¶
- func NoopTranslate(ctx context.Context, w resource.Workload) ([]resource.Object, error)
- func NoopWrapper(ctx context.Context, w resource.Workload, objs []resource.Object) ([]resource.Object, error)
- type ObjectTranslator
- type Reconciler
- type ReconcilerOption
- type TranslateFn
- type TranslationWrapper
- type Translator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NoopTranslate ¶
NoopTranslate does not translate the workload and does not return error.
Types ¶
type ObjectTranslator ¶
type ObjectTranslator struct {
TranslateFn
}
An ObjectTranslator is a concrete implementation of a Translator.
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.
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 ¶
A TranslateFn translates a workload into an object.
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.