ork simulate

3 min read

Run the operator reconcile loop against a fake in-memory cluster — no real Kubernetes cluster required. Useful for verifying that a declarative Katalog creates the right resources in the right order.

ork simulate

--file defaults to simulate.yaml (then katalog.yaml/komposer.yaml) and --cr defaults to cr.yaml — both are optional when your files use the standard names.

Flags

FlagShortDefaultDescription
--file-fsimulate.yamlPath to simulate.yaml, katalog, or komposer file
--crcr.yamlPath to the CR YAML file to reconcile
--crd(all)CRD name to simulate. Defaults to all CRDs in the Katalog.
--cycles10Maximum number of reconcile cycles per CRD
--skipComma-separated path patterns to skip during ./... discovery
--skip-externalfalseStub external: HTTP calls with empty 200 responses
--debug-opsfalsePrint every recorded op with its cycle number
--dev-serverfalseStart the mock dev server for external: examples
--dev-server-port9999Port for the mock dev server

Examples

# Standard layout — no flags needed
ork simulate

# Non-standard filenames
ork simulate -f my-operator.yaml --cr my-cr.yaml

# Simulate a specific CRD only
ork simulate --crd website

# Run up to 5 reconcile cycles
ork simulate --cycles 5

# Discover and run all simulate.yaml files recursively
ork simulate ./...

# Start the mock dev server for external: examples
ork simulate --dev-server

Output

Simulating website/my-site

  Cycle 1:
    + deployments/my-site
    + services/my-site
    ~ status/my-site
  Cycle 2:
    ~ status/my-site
  (cycles 3–10: identical)

  ✓ Steady state at cycle 3 in 189ms

+ green — resource created. ~ yellow — resource updated. - red — resource deleted. Consecutive identical cycles are collapsed. status/... appears every cycle — that is expected.

--cycles N runs exactly N cycles. Steady state is noted but does not stop the run.

How it works

  • Spins up a fake in-memory Kubernetes cluster using k8s.io/client-go/kubernetes/fake
  • Runs the same GenericReconciler used in production
  • Records all create, update, delete, patch operations per cycle
  • Advances Deployment status to Available after cycle 1 to unblock state machines
  • Detects steady state when two consecutive cycles produce identical operations

ork simulate does not require a real cluster and does not read from or write to ~/.kube/config.


ork simulate init

Generate a simulate.yaml pre-filled with the cycle-1 create operations observed from a live reconcile run.

ork simulate init

Flags

FlagShortDefaultDescription
--file-fkatalog.yamlPath to the Katalog file
--crcr.yamlPath to the CR YAML
--forcefalseOverwrite an existing simulate.yaml
--dry-runfalsePrint the generated simulate.yaml to stdout instead of writing the file

Examples

# Standard layout — generates simulate.yaml in the current directory
ork simulate init

# Preview without writing
ork simulate init --dry-run

# Non-standard filenames
ork simulate init -f my-operator.yaml --cr my-cr.yaml

# Overwrite an existing simulate.yaml
ork simulate init --force

Output

✓ Generated simulate.yaml
  1 CRD(s), 3 op rule(s)

  Run ork simulate to verify.

The generated file includes steady: true, noErrors: true, and an ops: list of every resource created on cycle 1. Edit and refine from there — use ork simulate --debug-ops to see all ops across all cycles if you need to add rules beyond cycle 1.