Resource
A Resource represents a developer-declared dependency on managed infrastructure (database, queue, cache, object store) provisioned through a ResourceType or ClusterResourceType template. Resources are project-bound: each Resource belongs to exactly one Project, and components in that project consume its outputs through Workload dependencies.resources[].
API Version
openchoreo.dev/v1alpha1
Resource Definition
Metadata
Resources are namespace-scoped resources and belong to a Project through the owner field.
apiVersion: openchoreo.dev/v1alpha1
kind: Resource
metadata:
name: <resource-name>
namespace: <namespace>
Short names: res
Spec Fields
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
owner | ResourceOwner | Yes | - | Ownership information linking the Resource to a project (immutable) |
type | ResourceTypeRef | Yes | - | Reference to a ResourceType or ClusterResourceType template (immutable) |
parameters | object | No | - | Parameter values validated against the ResourceType's parameters schema; failures surface via conditions |
Both owner and type are immutable after creation. To re-target a Resource to a different template, delete and recreate it.
ResourceOwner
| Field | Type | Required | Description |
|---|---|---|---|
projectName | string | Yes | Name of the project that owns this Resource (min: 1) |
ResourceTypeRef
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
kind | string | No | ResourceType | Kind of the referenced template: ResourceType (namespace-scoped) or ClusterResourceType (cluster-scoped) |
name | string | Yes | - | Name of the ResourceType or ClusterResourceType (DNS-1123 label; min: 1) |
Mirrors the ComponentTypeRef shape. The kind disambiguates a namespace-scoped ResourceType from a cluster-scoped ClusterResourceType with the same name.
Status Fields
| Field | Type | Default | Description |
|---|---|---|---|
observedGeneration | integer | 0 | The generation observed by the controller |
conditions | []Condition | [] | Standard Kubernetes conditions tracking Resource state |
latestRelease | LatestResourceRelease | - | Pointer to the most recent ResourceRelease cut from this Resource |
LatestResourceRelease
| Field | Type | Description |
|---|---|---|
name | string | Name of the latest ResourceRelease resource (shape: {resource}-{hash}) |
hash | string | Content hash covering Resource.spec + the referenced ResourceType's spec at release time |
Condition Types
Common condition types for Resource resources:
Ready— Indicates the Resource is in a healthy state, the referenced ResourceType has been resolved, and the latest ResourceRelease has been reconciledFinalizing— Surfaced during deletion while the two-phase finalizer waits for ResourceReleaseBindings and owned ResourceReleases to be cleaned up
Examples
Postgres Resource
apiVersion: openchoreo.dev/v1alpha1
kind: Resource
metadata:
name: doclet-postgres
namespace: default
spec:
owner:
projectName: doclet
type:
kind: ClusterResourceType
name: postgres
parameters:
database: doclet
NATS Resource (no parameters)
apiVersion: openchoreo.dev/v1alpha1
kind: Resource
metadata:
name: doclet-nats
namespace: default
spec:
owner:
projectName: doclet
type:
kind: ClusterResourceType
name: nats
Resource Referencing a Namespace-Scoped ResourceType
apiVersion: openchoreo.dev/v1alpha1
kind: Resource
metadata:
name: order-cache
namespace: default
spec:
owner:
projectName: order-service
type:
kind: ResourceType
name: valkey-cache
parameters:
version: "8"
Usage
A Resource is created by a developer (or by GitOps tooling on their behalf) and references a ResourceType that platform engineers have published. The Resource controller cuts a ResourceRelease when the hash of Resource.spec plus the referenced ResourceType's spec changes; release advance into environments happens through a ResourceReleaseBinding authored by a platform engineer or GitOps process.
# Create the Resource
kubectl apply -f doclet-postgres.yaml
# Inspect the cut release
kubectl get resource doclet-postgres -o jsonpath='{.status.latestRelease}'
# Inspect the rendered DP-side state once a binding is Ready
kubectl get rrb -l openchoreo.dev/resource=doclet-postgres
Annotations
Resources support the following annotations:
| Annotation | Description |
|---|---|
openchoreo.dev/display-name | Human-readable name for UI display |
openchoreo.dev/description | Detailed description of the Resource |
Related Resources
- Project — Owns Resources alongside Components
- Workload — Declares resource dependencies through
dependencies.resources[] - ResourceType — Platform-defined template referenced by a Resource
- ClusterResourceType — Cluster-scoped variant of ResourceType
- ResourceRelease — Immutable snapshot cut by the Resource controller
- ResourceReleaseBinding — Per-environment binding that deploys a release