Skip to main content
Version: v1.2.x

ClusterProjectType

A ClusterProjectType is the cluster-scoped sibling of ProjectType. Projects in any namespace can reference a ClusterProjectType through Project.spec.type with kind: ClusterProjectType. Use it for infrastructure templates intended to be shared platform-wide; use a namespace-scoped ProjectType when a template should only be visible within a single namespace.

The spec structure is identical to ProjectType; only the scope differs.

API Version

openchoreo.dev/v1alpha1

Resource Definition

Metadata

ClusterProjectTypes are cluster-scoped resources and carry no namespace.

apiVersion: openchoreo.dev/v1alpha1
kind: ClusterProjectType
metadata:
name: <cluster-project-type-name>

Short names: cpt, cpts

Spec Fields

The spec is field-for-field identical to ProjectTypeSpec:

FieldTypeRequiredDescription
parametersSchemaSectionNoSchema for the values project authors supply on Project.spec.parameters
environmentConfigsSchemaSectionNoSchema for the per-environment values on ProjectReleaseBinding.spec.environmentConfigs
validations[ValidationRule]NoCEL rules evaluated during rendering; all must evaluate to true
resources[ResourceTemplate]YesNamespace-scoped manifest templates applied to the cell namespace (min: 1). Must include the mandated v1/Namespace entry

Status Fields

ClusterProjectType does not report status fields.

The Default ClusterProjectType

OpenChoreo ships a default ClusterProjectType that provisions only the cell namespace. When a project is created through the OpenChoreo API or the Backstage UI without an explicit type, spec.type defaults to it. Its environmentConfigs schema accepts namespaceLabels and namespaceAnnotations maps, so per-environment labels and annotations can be added to the namespace through the binding:

apiVersion: openchoreo.dev/v1alpha1
kind: ClusterProjectType
metadata:
name: default
spec:
environmentConfigs:
openAPIV3Schema:
type: object
properties:
namespaceLabels:
type: object
additionalProperties:
type: string
default: {}
namespaceAnnotations:
type: object
additionalProperties:
type: string
default: {}
resources:
- id: cell-namespace
template:
apiVersion: v1
kind: Namespace
metadata:
name: ${metadata.namespace}
labels: ${oc_merge(metadata.labels, environmentConfigs.namespaceLabels)}
annotations: ${environmentConfigs.namespaceAnnotations}

Examples

Referencing a ClusterProjectType From a Project

apiVersion: openchoreo.dev/v1alpha1
kind: Project
metadata:
name: online-store
namespace: default
spec:
deploymentPipelineRef:
name: default
type:
kind: ClusterProjectType
name: standard-project
parameters:
tier: premium

Usage

# List cluster project types
kubectl get cpt
occ clusterprojecttype list

# Inspect a cluster project type
kubectl describe clusterprojecttype default
occ clusterprojecttype get default

# Create or update from a manifest
occ apply -f clusterprojecttype.yaml