Skip to content

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

Merged
iAlexeze merged 20 commits into
mainfrom
feat/prep-for-new-packs
Jun 22, 2026
Merged

feat: prep for new packs — runHooksFirst, ork migrate, guides restructure, autoscaler cross-source#181
iAlexeze merged 20 commits into
mainfrom
feat/prep-for-new-packs

Conversation

@iAlexeze

@iAlexeze iAlexeze commented Jun 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • runHooksFirst ordering — hooks run before operatorBox resources when set
  • ork migrate command — rewrites controller-runtime reconcilers to Orkestra Katalogs (removes Reconcile signature boilerplate, adds TODOs)
  • Guides restructure — consolidated under documentation/guides/, added top-level page
  • Autoscaler cross-source — 04 updated, 05-from-external-api added; pkg resolves cross-source from operatorBox.cross declarations
  • RBAC fixes — third-party resources in custom: blocks emit correct RBAC rules; gateway RBAC and ServiceAccount guarded on IsGatewayEnabled
  • Cross-namespace owner references — buildUnstructured() skips owner reference when a namespaced owner would own a resource in a different namespace; cluster-scoped owners unaffected
  • Validation conditions — reconcile-time deny and warn outcomes are written as ValidationFailed and ValidationWarning status conditions on the CR, visible in the Control Center and via kubectl get
  • e2e cleanup — cert-manager TLS secrets explicitly deleted before count: 0 assertions in side-by-side e2e files
  • e2e teardown — setup.helm releases now uninstalled in reverse order during teardown so --use-current and --cluster runs leave the cluster clean
  • Docs updated across examples to point to conditions instead of logs for validation feedback

Still in progress: documentation/guides/ecosystem/, documentation/guides/migration/, examples/ecosystem-composition/, examples/from-controller-runtime/

iAlexeze added 20 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.
…ocks

GenerateRBACRules, GenerateRuntimeRBACRules, and GeneratePerCRDRBACRules
now include policy rules for any apiVersion/kind declared under
onCreate.custom and onReconcile.custom. The group is parsed from
apiVersion; the resource plural is inferred as lowercase kind + s.
Duplicates across phases are deduplicated.

Tests use ParseBytes against testdata/ fixtures so they exercise the
real parser path and Enabled() without a fallback.
GenerateGatewayRBACRules now returns nil early when gateway is disabled,
so callers never receive rules for a component that is not active.
The CLI also sets opts.IncludeGateway=false in the same case, which
suppresses the orkestra-gateway ServiceAccount, ClusterRole, and
ClusterRoleBinding from the generated bundle.
Deny violations write ValidationFailed=True with the rule message so users
can see why a CR is not reconciling without access to operator logs.
Warn violations write ValidationWarning=True as a separate condition so
tooling can gate on denies independently of advisories.
Both conditions clear to False on a clean reconcile.
…rces

Kubernetes rejects owner references where a namespaced owner points to a
resource in a different namespace and immediately GC-s the child.
buildUnstructured now skips the owner reference in that case.
Cluster-scoped owners are unaffected — they can own resources in any namespace.
Across examples with validation rules, replace log-only guidance with
explicit kubectl commands and Control Center references for the
ValidationFailed and ValidationWarning conditions written at reconcile time.
Teardown now calls HelmUninstall for each setup.helm release in reverse
order so --use-current and --cluster runs leave the cluster clean.
@iAlexeze iAlexeze merged commit ffd0427 into main Jun 22, 2026
4 of 6 checks passed
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