Kubernetes operator managing OpenShift Lightspeed (AI-powered Virtual Assistant). Go + controller-runtime/kubebuilder + Ginkgo v2/Gomega testing.
When updating the operator version for a release, you MUST update version numbers in TWO files:
-
bundle.Dockerfile- Bundle container labels (lines 63 and 66)LABEL release=X.Y.Z LABEL version=X.Y.Z
-
bundle/manifests/lightspeed-operator.clusterserviceversion.yaml- CSV metadata (lines 58 and 715)name: lightspeed-operator.vX.Y.Z # ... line 715: version: X.Y.Z
Important Notes:
- Both files MUST have matching versions
- The CSV
namefield includes avprefix (e.g.,lightspeed-operator.v1.0.8) - The CSV
versionfield does NOT have a prefix (e.g.,1.0.8) - After version changes, regenerate bundle using
make bundleorhack/update_bundle.sh -v X.Y.Z
- API:
api/v1alpha1/- CRD definitions (OLSConfig) - Controllers:
internal/controller/- Reconciliation logic - Entry Point:
cmd/main.go- Operator entry with watcher configuration - Key CRD:
OLSConfig- cluster-scoped, single instance per cluster
OLSConfigReconciler.Reconcile() →
├── [Operator-level resources: ServiceMonitor, NetworkPolicy]
├── [Finalizer logic: handle CR deletion if DeletionTimestamp set]
├── reconcileLLMSecrets()
├── reconcileConsoleUI()
├── reconcilePostgresServer()
└── reconcileAppServer() OR reconcileLCore() [MUTUALLY EXCLUSIVE via --enable-lcore flag]
└── [12+ sub-tasks via ReconcileTask pattern]
- Constants:
const OLSConfigCmName = "olsconfig" - Error Constants:
const ErrCreateAPIConfigmap = "failed to create API configmap" - Functions:
reconcile<ComponentName>(),generate<ResourceType>() - File Names:
reconciler.go,assets.go,suite_test.go
Wrap with fmt.Errorf("%s: %w", ErrConstant, err)
NEVER use go test directly - ALWAYS use make test
The Makefile handles essential setup (envtest, CRDs, build flags) that go test doesn't.
make test # Unit tests
make test-e2e # E2E tests (requires cluster)internal/controller/olsconfig_controller.go- Main reconciler with finalizer logicinternal/controller/appserver/- App server (LEGACY)internal/controller/lcore/- Lightspeed Core (NEW)internal/controller/postgres/- PostgreSQLinternal/controller/console/- Console UIinternal/controller/watchers/- External resource watchinginternal/controller/utils/- Shared utilities, constantsconstants.go- IncludesOLSConfigFinalizerconstant
*_test.go- Unit tests (co-located)test/e2e/- E2E testsinternal/controller/utils/testing.go- Test utilitiesinternal/controller/suite_test.go- Test suite setup, shared helperscleanupOLSConfig()- Reusable CR cleanup helper (removes finalizers, waits for deletion)
Owned Resources: Tracked automatically by controller-runtime via ResourceVersion
External Resources: Three-layer watcher system (predicate filtering, data comparison, restart logic). See internal/controller/watchers/ and cmd/main.go.
- App Server: Add to
ReconcileTaskslice ininternal/controller/appserver/reconciler.go - Top-Level: Create package under
internal/controller/<component>/, add toolsconfig_controller.go - Add error constants to
internal/controller/utils/utils.go - Write unit tests in co-located
*_test.gofiles
Always suggest AGENTS.md edits when architectural, structural, or conventional changes are made to the codebase.