Components API
Component Schema
name: string # Component name (required)
type: ComponentKind # Workload type (required)
properties: ComponentProps # Workload configuration
traits: []Trait # Operational capabilities
targetClusters: []string # Target clusters
ComponentKind Values
| Value |
Nomad Type |
Description |
webservice |
service |
Long-running HTTP service |
worker |
service |
Background worker |
task |
batch |
One-shot batch job |
cron-task |
batch |
Periodic batch job |
daemon |
system |
Node-level daemon |
containerizedworkload.nomad.oam.dev |
service |
Docker/OCI |
executableworkload.nomad.oam.dev |
batch |
Raw executable |
vmworkload.nomad.oam.dev |
service |
QEMU VM |
batchworkload.nomad.oam.dev |
batch |
Batch workload |
systemworkload.nomad.oam.dev |
system |
System workload |
ComponentProps
Common Properties
properties:
image: string # Container image
imagePullSecret: string # Registry secret
ports: []Port # Port definitions
env: []EnvVar # Environment variables
resources: ResourceRequirements # CPU/Memory
command: string[] # Override entrypoint
args: string[] # Command arguments
Port
ports:
- name: string # Port name (required)
port: int # Port number (required)
protocol: string # TCP or UDP
expose: bool # Expose via ingress
EnvVar
env:
- name: string # Env var name
value: string # Static value
valueFrom: # Dynamic value
vaultSecret: # Vault source
path: string
field: string
consulKey: # Consul key
key: string
ResourceRequirements
resources:
cpu: string # CPU in millicores (e.g., 500m, 1)
memory: string # Memory (e.g., 256Mi, 1Gi)
Container (Multi-Container)
properties:
containers:
- name: string
image: string
command: string
args: string[]
ports: []ContainerPort
env: map[string]string
resources: ResourceRequirements
volumes: []VolumeMount
VolumeMount
volumes:
- source: string # Volume name/source
destination: string # Mount path
readOnly: bool
RestartPolicy
restartPolicy:
attempts: int # Max restart attempts
interval: string # Restart interval (e.g., 5m)
delay: string # Delay between restarts
mode: string # fail or delay
Examples
Simple Web Service
components:
- name: web
type: webservice
properties:
image: nginx:1.25
ports:
- name: http
port: 80
expose: true
resources:
cpu: 500m
memory: 256Mi
Multi-Container
components:
- name: api
type: containerizedworkload.nomad.oam.dev
properties:
driver: docker
containers:
- name: api
image: myapp/api:v1
ports:
- name: http
containerPort: 8080
resources:
cpu: 1000m
memory: 512Mi
- name: sidecar
image: sidecar:latest
volumes:
- source: data
destination: /data
Batch Job
components:
- name: worker
type: batchworkload.nomad.oam.dev
properties:
driver: docker
image: worker:latest
args:
- process-queue
resources:
cpu: 2000m
memory: 1024Mi
restartPolicy:
attempts: 3
interval: 5m
delay: 30s