Adding a Resource
Add a project
genop create project postgresql --api-group postgresql.acme.ioRegisters 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.
| Flag | Short | Required | Description |
|---|---|---|---|
--api-group | -g | ✓ | The API group, e.g. {project}.acme.io |
--path | Filesystem path relative to the repo root (defaults to the project name) | ||
--kustomize | Enable kustomize packaging (default true) | ||
--helm | Enable helm packaging (default false) |
At least one of --kustomize / --helm must stay enabled.
Tip
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: trueAdd 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-metricsThe 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.
| Flag | Short | Required | Description |
|---|---|---|---|
--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 |
--scope | Resource scope: Namespaced (default) or Cluster, fixed at creation | ||
--no-metrics | Do not record resource metrics for this resource | ||
--no-validating-webhook / --no-mutating-webhook / --no-webhook | Opt out of admission webhooks |
Tip
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: falseFields 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.