Documentation
¶
Overview ¶
Package controller implements the main Kubernetes controller for managing the OpenShift Lightspeed operator lifecycle.
This package contains the OLSConfigReconciler, which is the central orchestrator for the entire operator. It coordinates reconciliation across all components (appserver/lcore, postgres, console) and manages the OLSConfig custom resource.
The controller code is organized into multiple files:
- olsconfig_controller.go: Core type definition, Reconcile(), and SetupWithManager()
- olsconfig_helpers.go: Interface implementations, status management, and annotation logic
- olsconfig_watchers.go: Watcher predicate helpers for secrets and configmaps
- operator_assets.go: Operator infrastructure resources (ServiceMonitor, NetworkPolicy)
Key Responsibilities:
- Reconcile the OLSConfig custom resource
- Coordinate component reconciliation (console, postgres, appserver/lcore)
- Manage status conditions and CR status updates
- Set up resource watchers for automatic updates (secrets, configmaps)
- Manage operator-level resources (service monitors, network policies)
The main reconciliation flow:
- Reconcile operator-level resources (service monitor, network policy)
- Handle finalizer logic (cleanup on deletion, add on creation)
- Fetch and validate OLSConfig CR
- Annotate external resources for change tracking
- Phase 1: Reconcile independent resources (ConfigMaps, Secrets, ServiceAccounts, etc.)
- Phase 2: Reconcile deployments and dependent resources (Services, TLS certs, etc.)
- Update status conditions based on deployment readiness
The OLSConfigReconciler implements the reconciler.Reconciler interface, allowing it to be passed to component packages for isolated reconciliation without circular dependencies.
Index ¶
- type OLSConfigReconciler
- func (r *OLSConfigReconciler) GetAppServerImage() string
- func (r *OLSConfigReconciler) GetConsoleUIImage() string
- func (r *OLSConfigReconciler) GetDataverseExporterImage() string
- func (r *OLSConfigReconciler) GetLCoreImage() string
- func (r *OLSConfigReconciler) GetLCoreServerMode() bool
- func (r *OLSConfigReconciler) GetLogger() logr.Logger
- func (r *OLSConfigReconciler) GetNamespace() string
- func (r *OLSConfigReconciler) GetOpenShiftMCPServerImage() string
- func (r *OLSConfigReconciler) GetOpenShiftMajor() string
- func (r *OLSConfigReconciler) GetOpenshiftMinor() string
- func (r *OLSConfigReconciler) GetPostgresImage() string
- func (r *OLSConfigReconciler) GetScheme() *runtime.Scheme
- func (r *OLSConfigReconciler) GetWatcherConfig() interface{}
- func (r *OLSConfigReconciler) IsPrometheusAvailable() bool
- func (r *OLSConfigReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
- func (r *OLSConfigReconciler) ReconcileNetworkPolicyForOperator(ctx context.Context) error
- func (r *OLSConfigReconciler) ReconcileServiceMonitorForOperator(ctx context.Context) error
- func (r *OLSConfigReconciler) SetupWithManager(mgr ctrl.Manager) error
- func (r *OLSConfigReconciler) UpdateStatusCondition(ctx context.Context, olsconfig *olsv1alpha1.OLSConfig, ...) error
- func (r *OLSConfigReconciler) UseLCore() bool
- type ResourceGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OLSConfigReconciler ¶
type OLSConfigReconciler struct {
client.Client
Logger logr.Logger
Options utils.OLSConfigReconcilerOptions
WatcherConfig *utils.WatcherConfig
}
OLSConfigReconciler reconciles a OLSConfig object. This controller is fully event-driven and does not use periodic reconciliation. All changes are detected via watches:
- Owned resources (Deployments, Services, etc.) via Owns()
- External resources (Secrets, ConfigMaps) via Watches() with custom predicates
Controller-runtime handles error retries with exponential backoff.
func (*OLSConfigReconciler) GetAppServerImage ¶
func (r *OLSConfigReconciler) GetAppServerImage() string
func (*OLSConfigReconciler) GetConsoleUIImage ¶
func (r *OLSConfigReconciler) GetConsoleUIImage() string
func (*OLSConfigReconciler) GetDataverseExporterImage ¶
func (r *OLSConfigReconciler) GetDataverseExporterImage() string
func (*OLSConfigReconciler) GetLCoreImage ¶
func (r *OLSConfigReconciler) GetLCoreImage() string
func (*OLSConfigReconciler) GetLCoreServerMode ¶
func (r *OLSConfigReconciler) GetLCoreServerMode() bool
func (*OLSConfigReconciler) GetLogger ¶
func (r *OLSConfigReconciler) GetLogger() logr.Logger
func (*OLSConfigReconciler) GetNamespace ¶
func (r *OLSConfigReconciler) GetNamespace() string
func (*OLSConfigReconciler) GetOpenShiftMCPServerImage ¶
func (r *OLSConfigReconciler) GetOpenShiftMCPServerImage() string
func (*OLSConfigReconciler) GetOpenShiftMajor ¶
func (r *OLSConfigReconciler) GetOpenShiftMajor() string
func (*OLSConfigReconciler) GetOpenshiftMinor ¶
func (r *OLSConfigReconciler) GetOpenshiftMinor() string
func (*OLSConfigReconciler) GetPostgresImage ¶
func (r *OLSConfigReconciler) GetPostgresImage() string
func (*OLSConfigReconciler) GetScheme ¶
func (r *OLSConfigReconciler) GetScheme() *runtime.Scheme
func (*OLSConfigReconciler) GetWatcherConfig ¶
func (r *OLSConfigReconciler) GetWatcherConfig() interface{}
func (*OLSConfigReconciler) IsPrometheusAvailable ¶
func (r *OLSConfigReconciler) IsPrometheusAvailable() bool
func (*OLSConfigReconciler) Reconcile ¶
For more details, check Reconcile and its Result here: - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.17.3/pkg/reconcile
func (*OLSConfigReconciler) ReconcileNetworkPolicyForOperator ¶
func (r *OLSConfigReconciler) ReconcileNetworkPolicyForOperator(ctx context.Context) error
func (*OLSConfigReconciler) ReconcileServiceMonitorForOperator ¶
func (r *OLSConfigReconciler) ReconcileServiceMonitorForOperator(ctx context.Context) error
func (*OLSConfigReconciler) SetupWithManager ¶
func (r *OLSConfigReconciler) SetupWithManager(mgr ctrl.Manager) error
SetupWithManager sets up the controller with the Manager.
func (*OLSConfigReconciler) UpdateStatusCondition ¶
func (r *OLSConfigReconciler) UpdateStatusCondition(ctx context.Context, olsconfig *olsv1alpha1.OLSConfig, newStatus olsv1alpha1.OLSConfigStatus, inCluster ...bool) error
UpdateStatusCondition updates the complete status of the OLSConfig Custom Resource instance. Uses retry with conflict handling to ensure the update succeeds even under concurrent modifications.
func (*OLSConfigReconciler) UseLCore ¶
func (r *OLSConfigReconciler) UseLCore() bool
type ResourceGroup ¶
ResourceGroup holds a collection of Kubernetes resources of the same type
Directories
¶
| Path | Synopsis |
|---|---|
|
Package appserver provides reconciliation logic for the OpenShift Lightspeed application server component.
|
Package appserver provides reconciliation logic for the OpenShift Lightspeed application server component. |
|
Package console provides reconciliation logic for the OpenShift Console UI plugin that integrates OpenShift Lightspeed into the OpenShift web console.
|
Package console provides reconciliation logic for the OpenShift Console UI plugin that integrates OpenShift Lightspeed into the OpenShift web console. |
|
Package lcore provides reconciliation logic for the LightSpeed Core (LCore) component.
|
Package lcore provides reconciliation logic for the LightSpeed Core (LCore) component. |
|
Package postgres provides reconciliation logic for the PostgreSQL database component used by OpenShift Lightspeed for conversation cache storage.
|
Package postgres provides reconciliation logic for the PostgreSQL database component used by OpenShift Lightspeed for conversation cache storage. |
|
Package reconciler defines the interface contract between the main OLSConfigReconciler and component-specific reconcilers (appserver, postgres, console).
|
Package reconciler defines the interface contract between the main OLSConfigReconciler and component-specific reconcilers (appserver, postgres, console). |
|
Package utils provides shared utility functions, types, and constants used across the OpenShift Lightspeed operator components.
|
Package utils provides shared utility functions, types, and constants used across the OpenShift Lightspeed operator components. |