Documentation ¶
Overview ¶
Package controller offers embeddable structs for putting in your controller, to help with conforming to GitOps Toolkit conventions.
Index ¶
- type Events
- type Metrics
- func (m Metrics) RecordConditionMetric(ctx context.Context, obj readinessMetricsable, conditionType string)
- func (m Metrics) RecordDuration(ctx context.Context, obj readinessMetricsable, startTime time.Time)
- func (m Metrics) RecordReadinessMetric(ctx context.Context, obj readinessMetricsable)
- func (m Metrics) RecordSuspend(ctx context.Context, obj readinessMetricsable, suspend bool)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Events ¶
type Events struct { Scheme *runtime.Scheme EventRecorder kuberecorder.EventRecorder ExternalEventRecorder *events.Recorder }
Events is a helper struct that adds the capability of sending events to the Kubernetes API and to the GitOps Toolkit notification controller. You use it by embedding it in your reconciler struct:
type MyTypeReconciler { client.Client // ... etc. controller.Events }
You initialise a suitable value with MakeEvents; in most cases the value only needs to be initialized once per controller, as the specialised logger and object reference data are gathered from the arguments provided to the Eventf method.
func MakeEvents ¶
type Metrics ¶
Metrics adds the capability for recording GOTK-standard metrics to a reconciler. Use by embedding into the reconciler struct:
type MyTypeReconciler struct { client.Client // ... controller.Metrics }
then you can call either or both of RecordDuration and RecordReadinessMetric. API types used in GOTK will usually already be suitable for passing (as a pointer) as the second argument to `RecordReadinessMetric`.
When initialising controllers in main.go, use MustMakeMetrics to create a working Metrics value; you can supply the same value to all reconcilers.