Adding a resource#

Add a project#

genop create project postgresql --api-group postgresql.acme.io

Registers a new project in the topology, then applies: scaffolds its Helm chart, README.md, DEVELOPMENT.md, e2e suite and Makefile targets. The project starts with no controller and no resource.

FlagShortRequiredDescription
--api-group-g✓The API group, e.g. {project}.acme.io
--pathFilesystem path relative to the repo root (defaults to the project name)
--kustomizeEnable kustomize packaging (default true)
--helmEnable helm packaging (default false)

At least one of --kustomize / --helm must stay enabled.

Prefer editing .genop.yaml? Every genop create command only edits the topology and then runs genop apply, so you can do the first half by hand. Add the entry, then run genop apply:

spec:
  operators:
    - project: postgresql
      apiGroup: postgresql.acme.io
      packaging:
        kustomize: true

Add a resource#

genop create api Database \
  --project postgresql \
  --controller database \
  --api-version v1alpha1

# A configuration CRD that needs neither webhooks nor metrics
genop create api ConnectionProfile \
  --project postgresql \
  --controller database \
  --api-version v1alpha1 \
  --no-webhook --no-metrics

The controller is created when it does not exist yet — there’s no separate command to create one. This gets API types and CRD, webhook stubs, metrics service, controller, e2e tests (reconcile and metrics), and the usual main.go wiring, with empty apply and deletion step lists — such a resource reconciles to Ready immediately. Add reconcilers with genop create step.

FlagShortRequiredDescription
--project-p✓The project that owns the resource
--controller-c✓The controller that manages the resource (created when absent)
--api-version-a✓The resource API version, e.g. v1alpha1
--scopeResource scope: Namespaced (default) or Cluster, fixed at creation
--no-metricsDo not record resource metrics for this resource
--no-validating-webhook / --no-mutating-webhook / --no-webhookOpt out of admission webhooks

Declarative equivalent. Add the resource under its controller in .genop.yaml, then run genop apply — the same files are generated. The controller entry is created the same way if it isn’t there yet.

controllers:
  - name: database
    resources:
      - version: v1alpha1
        kind: Database
      - version: v1alpha1
        kind: ConnectionProfile
        metrics: false
        webhook:
          validating: false
          mutating: false

Fields you omit keep their defaults (see the .genop.yaml reference). A resource declared with no apply: / delete: key is scaffolded like any other, with empty step lists.

Cluster-scoped kinds are covered in Cluster-scoped resources.

Full flag list, including operator-configuration flags: see the genop create api reference.