Traits API
Trait Schema
traits:
- type: TraitType # Trait type identifier
properties: # Trait-specific configuration
key: value
TraitType Values
| Type |
Applies To |
Description |
scaler |
All |
Horizontal autoscaling |
ingress |
Containerized |
HTTP routing |
volume |
All |
Volume mounts |
vault-secret |
All |
Vault secrets |
affinity |
All |
Node scheduling |
sidecar |
Containerized |
Sidecar containers |
updatestrategy.nomad.oam.dev |
All |
Deployment strategy |
migration.nomad.oam.dev |
All |
Node migration |
servicediscovery.nomad.oam.dev |
Containerized |
Consul registration |
ScalerTrait
type: scaler
properties:
replicas: int # Current replicas
min: int # Minimum (default: 1)
max: int # Maximum
scaleMetric: string # cpu, memory, custom
scaleTarget: float # Target percentage
IngressTrait
type: ingress
properties:
host: string # Domain name
pathPrefix: string # Path prefix
port: int # Backend port
tls: bool # Enable TLS
stripPrefix: bool # Strip path prefix
middleware: []string # Traefik middleware
VolumeTrait
type: volume
properties:
name: string # Volume name
type: string # host, csi
source: string # Volume source
mountPath: string # Mount destination
readOnly: bool # Read-only
VaultSecretTrait
type: vault-secret
properties:
path: string # Vault path
changeMode: string # restart, signal
changeSignal: string # Signal name
env: map[string]string # Field to env mapping
AffinityTrait
type: affinity
properties:
nodeClass: string # Node class
cloud: string # Cloud provider
region: string # Region
nodeMeta: map[string]string # Node metadata
spread: bool # Spread across DCs
UpdateStrategyTrait
type: updatestrategy.nomad.oam.dev
properties:
strategy: string # rolling, canary, blue-green
maxParallel: int # Parallel updates
canary: int # Canary count
healthCheck: string # checks, task_states, manual
minHealthyTime: string # Duration
healthyDeadline: string # Duration
progressDeadline: string # Duration
autoRevert: bool # Auto-revert
MigrationTrait
type: migration.nomad.oam.dev
properties:
maxParallel: int # Parallel migrations
healthCheck: string # checks, task_states
minHealthyTime: string # Duration
healthyDeadline: string # Duration
ServiceDiscoveryTrait
type: servicediscovery.nomad.oam.dev
properties:
serviceName: string # Service name
tags: []string # Service tags
port: string # Port label
check: # Health check
type: string # http, tcp, script
path: string # Check path
interval: string # Check interval
timeout: string # Check timeout