Documentation
¶
Overview ¶
Package app provides a sample controller demonstrating mutations and gating.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AddToScheme = sharedapp.AddToScheme
AddToScheme registers the ExampleApp types with the given scheme.
Functions ¶
func BuildComponent ¶ added in v0.16.0
func BuildComponent( owner *ExampleApp, newDeployment func(*ExampleApp) (component.Resource, error), newConfigMap func(*ExampleApp) (component.Resource, error), ) (*component.Component, error)
BuildComponent assembles the reconciled component for the given owner from the supplied resource factories. It is the single source of truth for how the Deployment and ConfigMap are composed into one component, shared by the controller's reconcile path and by component-level golden tests so both exercise the exact same assembly.
The factories are passed in rather than imported so this package stays free of a dependency on the resources package (which already imports this one). The controller injects its production factories; tests pass the same ones via resources.NewDeploymentResource / resources.NewConfigMapResource.
The ConfigMap is gated at the resource level: when metrics are disabled the framework deletes it.
Types ¶
type Controller ¶
type Controller struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
Metrics component.Recorder
NewDeploymentResource func(*ExampleApp) (component.Resource, error)
NewConfigMapResource func(*ExampleApp) (component.Resource, error)
}
Controller reconciles an ExampleApp by managing a Deployment and a ConfigMap within a single component. The ConfigMap is gated on EnableMetrics, so it is created only when metrics are enabled and deleted when they are disabled.
func (*Controller) Reconcile ¶
func (r *Controller) Reconcile(ctx context.Context, owner *ExampleApp) (err error)
Reconcile builds and reconciles a single component containing both resources.
type ExampleApp ¶
type ExampleApp = sharedapp.ExampleApp
ExampleApp re-exports the shared CRD type so callers in this package need no import alias.
type ExampleAppList ¶
type ExampleAppList = sharedapp.ExampleAppList
ExampleAppList re-exports the shared list type.
type ExampleAppSpec ¶
type ExampleAppSpec = sharedapp.ExampleAppSpec
ExampleAppSpec re-exports the shared spec type.
type ExampleAppStatus ¶
type ExampleAppStatus = sharedapp.ExampleAppStatus
ExampleAppStatus re-exports the shared status type.