Skip to content

feat: prep for new packs — runHooksFirst, ork migrate, guides restructure, autoscaler cross-source#180

Closed
iAlexeze wants to merge 10 commits into
mainfrom
feat/prep-for-new-packs
Closed

feat: prep for new packs — runHooksFirst, ork migrate, guides restructure, autoscaler cross-source#180
iAlexeze wants to merge 10 commits into
mainfrom
feat/prep-for-new-packs

Conversation

@iAlexeze

@iAlexeze iAlexeze commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • pkg/migrate — AST rewriter for ork migrate; rewrites controller-runtime Reconcile to Orkestra constructor signature; does not touch logging
  • runHooksFirst on HookDeclaration — declared templates run before the hook by default (hybrid 90/10 pattern); set runHooksFirst: true to reverse
  • Simulate fix — custom: block GVKs registered in scheme so fake dynamic client handles ecosystem resources correctly
  • ork migrate CLI command wired up
  • Guides restructured under documentation/guides/ — single sidebar entry covering registry, migration, and ecosystem guides
  • Autoscaler cross-source fallback — conditions with no source: block resolve source from operatorBox.cross: declarations; alias and crd name both matched; type: metrics entry required on the cross declaration used for autoscale
  • Dev server: GET /autoscale-metrics + POST /autoscale-metrics/flip for simulating external metric sources locally
  • 04-sibling-in-cluster updated: type: metrics documented on cross entry; cross-cluster section added
  • 05-from-external-api (new): autoscale from any external HTTP endpoint via cross: declaration

Test plan

  • ork migrate rewrites a controller-runtime reconciler; TODOs are accurate; logging import is preserved
  • runHooksFirst: true in a hybrid katalog — hook fires before templates
  • runHooksFirst: false (default) — templates fire first, hook is additive
  • ork simulate on an operator with custom: block resources — ops recorded correctly
  • Sidebar renders "Guides" as a single entry
  • ork run on 05-from-external-api; confirm workers 2→8 after POST /autoscale-metrics/flip; /katalog/processor shows workers: 8
  • ork run on 04-sibling-in-cluster; Processor scales when Loader queue depth exceeds 60

iAlexeze added 10 commits June 20, 2026 02:30
…migrate rewriter

- types: add RunHooksFirst field to HookDeclaration; default false (templates run first)
- reconciler: implement runHooksFirst dispatch — hybrid pattern runs declared templates
  before the hook unless runHooksFirst: true is set in the Katalog
- katalog: register custom: block GVKs into the scheme so the fake dynamic client can
  create and retrieve them during simulate (previously failed silently)
- simulate: prepend reactor on fake dynamic client to record ops before the tracker
  handles them — AddReactor was appended after the tracker and never fired
- migrate: new package — AST rewriter from controller-runtime Reconcile signature to
  Orkestra constructor; handles signature, return types, req.NamespacedName, req.String(),
  Status().Update() flags, SetupWithManager removal, struct rewrite, import cleanup
- move registry-guide/under guides/
- sidebar: collapse three separate guide entries into one Guides entry
- getting-started: rename 06-registry-guide.md → 06-registry.md
- faqs: link hooks/constructor answers to migration guide; ecosystem FAQ links to ecosystem guide
…larations

- autoscaler: crossSourceFor() — when an autoscale condition has no explicit source:
  block, look up the matching cross: declaration from operatorBox.cross; matches by
  decl.As alias OR decl.Crd so camelCase aliases (e.g. paymentSystem) correctly resolve
  against kebab-case crd names (e.g. payment-system); only selects entries with endpoint
  or type: metrics — cr/health/events entries are skipped
- reconciler: thread crd.OperatorBox.Cross into NewAutoscaler so crossSourceFor has the
  declarations available at evaluation time
- devserver: GET /autoscale-metrics returns a metrics payload (baseline: queueDepth 12,
  overloaded: 98); POST /autoscale-metrics/flip toggles state — used by 05-from-external-api
  to simulate an external payment system queue without a real service
…-external-api added

04-sibling-in-cluster:
- remove duplicate source: block from autoscale when: condition; cross: declaration
  is now the single source of truth — no repetition needed (requires fix above)
- README: cross-cluster section — external cluster uses an ingress URL at the
  /katalog route; Orkestra points its cross: endpoint there; no code change

05-from-external-api (new):
- autoscale from any external HTTP endpoint, not an Orkestra runtime
- cross: declares the endpoint and alias once; autoscale condition references the
  field path cross.paymentSystem.metrics.queueDepth with no source: on the condition
- dev server simulates the payment system; flip via POST /autoscale-metrics/flip
- as: paymentSystem (camelCase) — best practice for cross aliases
…(), removes , rewrites the struct, flags and with TODOs. Logging imports are left untouched. Output compiles; resolve TODOs and simulate.
@iAlexeze iAlexeze closed this Jun 20, 2026
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