exampleapp

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package exampleapp provides a sample controller implementation using the component framework.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExampleController

type ExampleController struct {
	Client   client.Client
	Scheme   *runtime.Scheme
	Recorder record.EventRecorder
	Metrics  component.Recorder
}

ExampleController is a mock controller demonstrating the Component framework's usage. It orchestrates resource creation with Feature Mutations and uses the ComponentBuilder to assemble a behavioral unit for reconciliation.

func (*ExampleController) Reconcile

func (r *ExampleController) Reconcile(ctx context.Context, owner *ExamplePlatform) error

Reconcile performs the component-based reconciliation flow. It shows how to: 1. Configure resources with version-aware Feature Mutations. 2. Assemble those resources into a named Component. 3. Use ReconcileContext to execute standardized framework reconciliation.

type ExamplePlatform

type ExamplePlatform struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   ExamplePlatformSpec   `json:"spec,omitempty"`
	Status ExamplePlatformStatus `json:"status,omitempty"`
}

ExamplePlatform is a mock of a Custom Resource that owns our component. It implements the component.OperatorCRD interface, providing access to status conditions and basic metadata, which the Component Framework uses for reporting reconciliation progress.

func (*ExamplePlatform) DeepCopyObject

func (cp *ExamplePlatform) DeepCopyObject() runtime.Object

DeepCopyObject implements runtime.Object.

func (*ExamplePlatform) GetKind

func (cp *ExamplePlatform) GetKind() string

GetKind returns the resource kind, used for condition messaging and logging.

func (*ExamplePlatform) GetStatusConditions

func (cp *ExamplePlatform) GetStatusConditions() *[]metav1.Condition

GetStatusConditions returns the list of conditions from the status, implementing OperatorCRD.

type ExamplePlatformSpec

type ExamplePlatformSpec struct {
	// Version of the application to deploy, used for Feature Mutation gating.
	Version string `json:"version,omitempty"`
	// EnableTracing determines if the tracing feature should be enabled.
	// This demonstrates the use of additional boolean conditions in Feature Mutations.
	EnableTracing bool `json:"enableTracing,omitempty"`
	// Suspended determines if the component should be scaled down or deleted.
	Suspended bool `json:"suspended,omitempty"`
}

ExamplePlatformSpec defines the desired state of the mock resource.

type ExamplePlatformStatus

type ExamplePlatformStatus struct {
	// Conditions is a list of status conditions, managed by the Component Framework.
	Conditions []metav1.Condition `json:"conditions,omitempty"`
}

ExamplePlatformStatus defines the observed state of the mock resource.

Jump to

Keyboard shortcuts

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