Skip to content

Commit 6dbf934

Browse files
Update componenttype examples to match current state
1 parent f8d1b09 commit 6dbf934

3 files changed

Lines changed: 34 additions & 35 deletions

File tree

docs/reference/api/application/component.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ title: Component API Reference
55
# Component
66

77
A Component represents a deployable unit of an application in OpenChoreo. It serves as the core abstraction that
8-
defines the component type (Service, WebApplication, ScheduledTask, etc.) and optionally includes build configuration
9-
when using OpenChoreo's CI system to build from source. Components are the primary building blocks used to define
10-
applications within a Project.
8+
references a platform-defined ComponentType (in `{workloadType}/{componentTypeName}` format) and optionally includes
9+
build configuration when using OpenChoreo's CI system to build from source. Components are the primary building blocks
10+
used to define applications within a Project.
1111

1212
## API Version
1313

@@ -33,7 +33,7 @@ metadata:
3333
| Field | Type | Required | Default | Description |
3434
|---------|-----------------------------------------------|----------|---------|--------------------------------------------------------------------------------------------------------|
3535
| `owner` | [ComponentOwner](#componentowner) | Yes | - | Ownership information linking the component to a project |
36-
| `type` | [ComponentType](#componenttype) | Yes | - | Specifies the component type (Service, WebApplication, ScheduledTask, etc.) |
36+
| `componentType` | string | Yes | - | Component type in `{workloadType}/{componentTypeName}` format (e.g., `deployment/web-app`). See [ComponentType](#componenttype-reference). |
3737
| `build` | [BuildSpecInComponent](#buildspecincomponent) | No | - | Optional build configuration when using OpenChoreo CI to build from source (omit for pre-built images) |
3838

3939
### ComponentOwner
@@ -42,15 +42,11 @@ metadata:
4242
|---------------|--------|----------|---------|-------------------------------------------------------|
4343
| `projectName` | string | Yes | - | Name of the project that owns this component (min: 1) |
4444

45-
### ComponentType
45+
### ComponentType Reference
4646

47-
The component type determines how the component will be deployed and what resources it can create.
48-
49-
| Value | Description |
50-
|------------------|-------------------------------------|
51-
| `Service` | Long-running service component |
52-
| `WebApplication` | Web application with HTTP endpoints |
53-
| `ScheduledTask` | Scheduled/cron job component |
47+
The `componentType` string points to a platform-defined ComponentType using the format `{workloadType}/{componentTypeName}`.
48+
Examples: `deployment/service`, `cronjob/scheduled-task`, `deployment/web-application`. See [ComponentType](../platform/componenttype.md)
49+
for details.
5450

5551
### BuildSpecInComponent
5652

@@ -115,7 +111,7 @@ metadata:
115111
spec:
116112
owner:
117113
projectName: my-project
118-
type: Service
114+
componentType: deployment/service
119115
build:
120116
repository:
121117
url: https://github.com/myorg/customer-service
@@ -142,7 +138,7 @@ metadata:
142138
spec:
143139
owner:
144140
projectName: my-project
145-
type: WebApplication
141+
componentType: deployment/web-app
146142
build:
147143
repository:
148144
url: https://github.com/myorg/frontend

docs/reference/api/platform/componenttype.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,10 @@ Defines the configurable parameters that developers can set when creating compon
5353

5454
#### Parameter Schema Syntax
5555

56-
Parameters use inline schema syntax with pipe-separated modifiers:
56+
Parameters use inline schema syntax with a single pipe after the type; constraints are space-separated:
5757

5858
```
59-
fieldName: "type | default=value | required=true | enum=val1,val2"
59+
fieldName: "type | default=value enum=val1,val2"
6060
```
6161

6262
Supported types: `string`, `integer`, `boolean`, `array<type>`, custom type references
@@ -203,7 +203,7 @@ spec:
203203
204204
schema:
205205
parameters:
206-
schedule: "string | required=true"
206+
schedule: string
207207
concurrencyPolicy: "string | default=Forbid | enum=Allow,Forbid,Replace"
208208
209209
resources:

docs/reference/api/platform/trait.md

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -47,19 +47,19 @@ Defines the configurable parameters that developers can set when attaching this
4747

4848
#### Parameter Schema Syntax
4949

50-
Uses the same inline schema syntax as ComponentType:
50+
Uses the same inline schema syntax as ComponentType: a single pipe after the type, then space-separated constraints:
5151

5252
```
53-
fieldName: "type | default=value | required=true | enum=val1,val2"
53+
fieldName: "type | default=value enum=val1,val2"
5454
```
5555

5656
**Example:**
5757

5858
```yaml
5959
schema:
6060
parameters:
61-
volumeName: "string | required=true"
62-
mountPath: "string | required=true"
61+
volumeName: string
62+
mountPath: string
6363
containerName: "string | default=app"
6464
6565
envOverrides:
@@ -110,7 +110,7 @@ Defines a modification using JSONPatch format (RFC 6902) with OpenChoreo extensi
110110

111111
| Field | Type | Required | Description |
112112
|---------|--------|----------|-------------------------------------------------------|
113-
| `op` | string | Yes | Operation: `add`, `replace`, `remove`, `mergeShallow` |
113+
| `op` | string | Yes | Operation: `add`, `replace`, `remove` |
114114
| `path` | string | Yes | JSON Pointer to the field (RFC 6901) |
115115
| `value` | any | No | Value to set (not used for `remove`) |
116116

@@ -119,14 +119,13 @@ Defines a modification using JSONPatch format (RFC 6902) with OpenChoreo extensi
119119
- **add**: Add a new field or array element
120120
- **replace**: Replace an existing field value
121121
- **remove**: Delete a field
122-
- **mergeShallow**: OpenChoreo extension for overlaying map keys
123122

124123
#### Path Syntax
125124

126125
Supports array filters for targeting specific elements:
127126

128127
```
129-
/spec/containers/[?(@.name=='app')]/volumeMounts/-
128+
/spec/containers[?(@.name=='app')]/volumeMounts/-
130129
```
131130

132131
## Examples
@@ -142,8 +141,8 @@ metadata:
142141
spec:
143142
schema:
144143
parameters:
145-
volumeName: "string | required=true"
146-
mountPath: "string | required=true"
144+
volumeName: string
145+
mountPath: string
147146
containerName: "string | default=app"
148147
149148
envOverrides:
@@ -172,7 +171,7 @@ spec:
172171
kind: Deployment
173172
operations:
174173
- op: add
175-
path: /spec/template/spec/containers/[?(@.name=='${trait.parameters.containerName}')]/volumeMounts/-
174+
path: /spec/template/spec/containers[?(@.name=='${trait.parameters.containerName}')]/volumeMounts/-
176175
value:
177176
name: ${trait.parameters.volumeName}
178177
mountPath: ${trait.parameters.mountPath}
@@ -239,12 +238,12 @@ spec:
239238
version: v1
240239
kind: Deployment
241240
operations:
242-
- op: mergeShallow
243-
path: /spec/template/spec/containers/[?(@.name=='main')]/resources
244-
value:
245-
limits:
246-
cpu: ${trait.parameters.cpuLimit}
247-
memory: ${trait.parameters.memoryLimit}
241+
- op: add
242+
path: /spec/template/spec/containers[?(@.name=='main')]/resources/limits/cpu
243+
value: ${trait.parameters.cpuLimit}
244+
- op: add
245+
path: /spec/template/spec/containers[?(@.name=='main')]/resources/limits/memory
246+
value: ${trait.parameters.memoryLimit}
248247
```
249248

250249
### Multi-Container Trait with forEach
@@ -257,8 +256,12 @@ metadata:
257256
namespace: default
258257
spec:
259258
schema:
259+
types:
260+
Mount:
261+
name: string
262+
path: string
260263
parameters:
261-
mounts: "array<object> | required=true"
264+
mounts: "[]Mount"
262265
263266
patches:
264267
- target:
@@ -274,7 +277,7 @@ spec:
274277
name: ${mount.name}
275278
emptyDir: {}
276279
- op: add
277-
path: /spec/template/spec/containers/[?(@.name=='app')]/volumeMounts/-
280+
path: /spec/template/spec/containers[?(@.name=='app')]/volumeMounts/-
278281
value:
279282
name: ${mount.name}
280283
mountPath: ${mount.path}

0 commit comments

Comments
 (0)