Documentation
¶
Overview ¶
Package app provides a sample controller demonstrating component-level prerequisites.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var AddToScheme = sharedapp.AddToScheme
AddToScheme registers the ExampleApp types with the given scheme.
Functions ¶
This section is empty.
Types ¶
type Controller ¶
type Controller struct {
client.Client
Scheme *runtime.Scheme
Recorder record.EventRecorder
Metrics component.Recorder
NewConfigMapResource func(*ExampleApp) (component.Resource, error)
NewDeploymentResource func(*ExampleApp) (component.Resource, error)
}
Controller reconciles an ExampleApp using two components:
- "infra" manages a ConfigMap and reports the InfraReady condition.
- "app" manages a Deployment and depends on InfraReady via a prerequisite.
The controller reconciles both components in sequence. The app component will not proceed until the infra component's condition is True.
func (*Controller) BuildAppComponent ¶ added in v0.16.0
func (r *Controller) BuildAppComponent(owner *ExampleApp) (*component.Component, error)
BuildAppComponent assembles the app component: a Deployment reporting the AppReady condition, gated behind the InfraReady prerequisite. The DependsOn prerequisite is the point of this example, so the controller and tests build the component the same way.
func (*Controller) BuildInfraComponent ¶ added in v0.16.0
func (r *Controller) BuildInfraComponent(owner *ExampleApp) (*component.Component, error)
BuildInfraComponent assembles the infra component: a single ConfigMap reporting the InfraReady condition, with no prerequisites. The controller and tests share this so the reconciled component and the golden snapshot stay in lockstep.
func (*Controller) Reconcile ¶
func (r *Controller) Reconcile(ctx context.Context, owner *ExampleApp) (err error)
Reconcile builds and reconciles the infra and app components in order.
Both components share the same ReconcileContext and stage their conditions on the owner in memory; a single deferred FlushStatus at the end of reconciliation persists both conditions in one API call. That is what prevents the sequential components from racing two separate status updates against the same owner and hitting conflicts.
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.