Skip to main content
Version: v1.0.x

Workload Descriptor

When a CI workflow builds your code, it produces a Workload CR that OpenChoreo deploys. By default, the build creates a minimal Workload with just the container image. To define endpoints, environment variables, dependencies, and configuration files, add a workload.yaml descriptor to your source repository.

With vs Without a Descriptor

Without workload.yamlWith workload.yaml
Container imageSet from build outputSet from build output
EndpointsNoneDefined in descriptor
Environment variablesNoneDefined in descriptor
Configuration filesNoneDefined in descriptor
DependenciesNoneDefined in descriptor
Use caseSimple services with no exposed endpointsServices with HTTP/gRPC/WebSocket endpoints, custom configuration

Descriptor Format

Place a workload.yaml file in your application directory (the path specified by repository.appPath in your Component's workflow parameters):

# workload.yaml
apiVersion: openchoreo.dev/v1alpha1

metadata:
name: reading-list-service

endpoints:
- name: reading-list-api
visibility:
- external
port: 8080
type: HTTP
basePath: /api
schemaFile: docs/openapi.yaml

configurations:
env:
- name: LOG_LEVEL
value: info
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-credentials
key: password
files:
- name: app.json
mountPath: /etc/config
value: |
{"feature_flags": {"new_feature": true}}
- name: tls.conf
mountPath: /etc/app
valueFrom:
path: configs/tls.conf

dependencies:
endpoints:
- component: postgres-db
name: api
visibility: project
envBindings:
host: DB_HOST
port: DB_PORT

Fields

metadata

FieldRequiredDescription
nameYesName for the generated Workload CR

endpoints

Define the network endpoints your service exposes:

FieldRequiredDescription
nameYesUnique name for the endpoint
portYesPort your application listens on
typeYesHTTP, gRPC, GraphQL, Websocket, TCP, or UDP
visibilityNoList of visibility levels: project, namespace, internal, external
targetPortNoContainer port to forward to (defaults to port)
basePathNoBase path prefix for the endpoint
displayNameNoHuman-readable name for the endpoint
schemaFileNoPath to schema file (OpenAPI, Protobuf, GraphQL), relative to the workload.yaml location

configurations

configurations.env

Environment variables injected into the container. Set either value or valueFrom, not both.

FieldRequiredDescription
nameYesEnvironment variable name
valueNoLiteral value (mutually exclusive with valueFrom)
valueFromNoReference to an external source (mutually exclusive with value)

valueFrom supports:

FieldDescription
valueFrom.secretKeyRef.nameName of the Kubernetes Secret
valueFrom.secretKeyRef.keyKey within the Secret
configurations.files

Configuration files mounted into the container. Set exactly one of value or valueFrom.

FieldRequiredDescription
nameYesFile name (used as the file name within mountPath)
mountPathYesAbsolute directory path where the file is mounted
valueNoInline file content (mutually exclusive with valueFrom)
valueFromNoReference to an external source (mutually exclusive with value)

valueFrom supports path or secretKeyRef (not both):

FieldDescription
valueFrom.pathPath to a local file, resolved relative to the workload.yaml location
valueFrom.secretKeyRef.nameName of the Kubernetes Secret
valueFrom.secretKeyRef.keyKey within the Secret

dependencies

Declare dependencies on other components' endpoints. See Endpoint Dependencies for details.

dependencies.endpoints
FieldRequiredDescription
componentYesName of the target component
nameYesName of the endpoint on the target component
visibilityYesVisibility scope (project or namespace)
projectNoTarget component's project (defaults to same project)
envBindingsYesMaps connection address components to environment variable names

envBindings fields:

FieldRequiredDescription
addressNoEnv var name for the full address (host:port/path)
hostNoEnv var name for the host
portNoEnv var name for the port
basePathNoEnv var name for the base path

File Placement

The CI workflow looks for workload.yaml at the root of your appPath. For example, if your Component specifies appPath: "/service-go-greeter", place the descriptor at:

your-repo/
service-go-greeter/
workload.yaml ← descriptor file
Dockerfile
main.go
openapi.yaml ← referenced by schemaFile
configs/
tls.conf ← referenced by valueFrom.path

See Also