Skip to content

feat(simulate-e2e-fixes): full operator simulation — hooks, constructors, cross:, multi-CRD, e2e.yaml, discovery#161

Merged
iAlexeze merged 25 commits into
mainfrom
feat/simulate-e2e
Jun 4, 2026
Merged

feat(simulate-e2e-fixes): full operator simulation — hooks, constructors, cross:, multi-CRD, e2e.yaml, discovery#161
iAlexeze merged 25 commits into
mainfrom
feat/simulate-e2e

Conversation

@iAlexeze
Copy link
Copy Markdown
Collaborator

@iAlexeze iAlexeze commented Jun 4, 2026

Summary

Interface changes

  • pkg/types/func.go + pkg/generate/registry_template.go: NewReconcilerFunc accepts event.Recorder interface + kubeclient.KubeClient
  • pkg/event/noop.go deleted; Recorder interface in event.go; event.Discard() added; GenericReconciler nil-coalesces via private discardRecorder

Simulate engine (pkg/simulate/harness.go)

  • Typed Go struct seeded into indexer for typed CRDs — fixes constructor type-assertions and hook BindToObjectHooks panics
  • HookRegistry[gvk] and ReconcilerRegistry[gvk] wired at runtime — custom binary runs real hooks and constructors against fake cluster
  • RunOptions.SkipExternal — noopTransport is opt-in; default hits real network
  • RunOptions.Peers + *kordinator.ResourceKatalog — sibling CRs seeded into fake informers; cross: observation works when peer CRs are in the CR file
  • Result.AllOps — all ops across all cycles, for --debug-ops diagnostics

CLI (cmd/cli/simulate.go)

  • Accepts e2e.yaml as -f input; expands aggregators recursively; skips customOperator: true
  • ./... discovery with per-file results, aggregate summary, exit code 1 on cycle errors
  • --skip — exclude path patterns from ./... discovery
  • --skip-external — stub external: HTTP calls
  • --debug-ops — print all recorded ops with cycle numbers (diagnostic)
  • GVK-aware CR matching — multi-doc CR files; each CRD matched to its CR by kind; CRDs without a matching CR skipped with a note
  • Peers threaded per-CRD so cross: works in both direct and discovery mode

Fixes

  • pkg/merger/helper.go: isFileMotif() — motif import paths absolutized relative to katalog dir
  • pkg/katalog/parser.go: CRDFile cleared after populateAPITypesFromCRDFile — runtime pod no longer tries to read local filesystem paths from the bundle ConfigMap
  • examples/use-cases/external/10-motif-composition/e2e.yaml: crd-worker.yaml added to setup.apply
  • pkg/logger/logger.go: default level InfoLevel — suppresses typeregistry debug logs before CLI flag parsing
  • CHANGELOG.md + charts/orkestra/Chart.yaml: bumped to v0.7.1

Examples + docs

  • Constructor ev type → event.Recorder; nil guards removed (Discard() used instead)
  • documentation/concepts/simulate/: five new concept pages; 02-running.md and 05-limitations.md updated for all new flags and cross: status
  • pkg/simulate/README.md + docs/03-limitations.md + docs/04-internals.md rewritten

Test plan

  • ork simulate -f e2e.yaml from subdirectory — katalog and CR resolved correctly
  • ork simulate ./... — all e2e.yaml files discovered, file paths correct
  • ork simulate ./... with cycle errors — exit 1, hint with exact commands
  • ork simulate ./... --skip cr-e2e.yaml — matching files excluded
  • ork simulate -f e2e.yaml --skip-external — external: note says "stubbed"
  • ork simulate -f external/e2e.yaml — motif paths resolved, no "no such file" error
  • ork simulate -f full-stack-app/03-cross-crd/e2e.yaml — managed-database simulated, database-backed-app skipped
  • ork simulate -f multi-tenancy/01-basic-namespacing/e2e.yaml — Database and Website both simulate from multi-doc cr.yaml
  • ork simulate --cr cr.yaml from 09-hooks custom binary — StatefulSet/Service/CronJob created in cycle 1
  • ork simulate --cr cr.yaml from 10-constructor custom binary — Job created in cycle 1
  • ork simulate --debug-ops — all ops printed with cycle numbers
  • ork simulate -f cross-crd/e2e.yaml with multi-doc CR containing both CRDs — cross.* fields populated
  • ork e2e -f external/10-motif-composition/e2e.yaml --use-current --dev-server — 4 of 4 pass; runtime pod starts without crdFile path error

iAlexeze added 25 commits June 3, 2026 08:10
…oves *event.Event dependency from constructor boundary
…rder — GenericReconciler nil-coalesces to internal discardRecorder
…— external: calls hit real network by default, stub with flag
…il — no nil guards needed; update docs and examples
…gets its own CR by kind; unblocks multi-CRD katalogs and cross: patterns and examples cleanup
…ycle numbers; Result.AllOps carries full op list for diagnostics
…ycle numbers; Result.AllOps carries full op list for diagnostics
…g CRs into fake informers; RunOptions.Peers wires them into katalogRegistry
…s from typeregistry init() before CLI flag parsing
…ped indexer, cross: wiring, hooks, event.Discard, RunOptions, AllOps
… read local paths; add crd-worker.yaml to setup.apply in motif-composition e2e
@iAlexeze iAlexeze changed the title feat(simulate): full operator simulation — hooks, constructors, cross:, multi-CRD, e2e.yaml, discovery feat(simulate-e2e-fixes): full operator simulation — hooks, constructors, cross:, multi-CRD, e2e.yaml, discovery Jun 4, 2026
@iAlexeze iAlexeze merged commit 2424ac6 into main Jun 4, 2026
4 checks passed
@iAlexeze iAlexeze deleted the feat/simulate-e2e branch June 4, 2026 04:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant