Skip to main content
Version: v1.0.0-rc.1 (pre-release)

Workload

A Workload defines the runtime specification for a Component in OpenChoreo. It describes what container image to run, what network endpoints to expose, and what dependencies the component has on other components. The platform uses this specification to generate the appropriate Kubernetes resources, including Deployments, Services, HTTPRoutes, and NetworkPolicies.

Each component has exactly one Workload that is linked to it through the owner field. Workloads can be created manually for pre-built images or generated automatically by build workflows.

Structure​

A Workload spec has the following top-level fields:

apiVersion: openchoreo.dev/v1alpha1
kind: Workload
metadata:
name: my-service-workload
namespace: default
spec:
owner:
projectName: my-project
componentName: my-service
container:
# Container specification
endpoints:
# Network endpoints
dependencies:
# Dependencies on other components

Owner​

The owner field links the Workload to its Component and Project. This field is immutable after creation.

FieldTypeRequiredDescription
projectNamestringYesName of the project that owns this workload
componentNamestringYesName of the component that owns this workload

Container​

The container field defines what to run. Only the image field is required.

FieldTypeRequiredDescription
imagestringYesOCI image to run (digest or tag)
command[]stringNoContainer entrypoint
args[]stringNoArguments for the entrypoint
env[]EnvVarNoEnvironment variables
files[]FileNoFile configurations and secrets

Environment Variables​

Environment variables can be set as literal values or referenced from secrets:

container:
image: myregistry/my-service:v1.0.0
env:
- key: LOG_LEVEL
value: info
- key: DB_PASSWORD
valueFrom:
secretKeyRef:
name: db-secrets
key: password

Each env entry must have exactly one of value or valueFrom set.

Files​

Files can be mounted into the container from literal content or secrets:

container:
image: myregistry/my-service:v1.0.0
files:
- key: config.yaml
mountPath: /etc/config
value: |
server:
port: 8080
- key: tls.crt
mountPath: /etc/tls
valueFrom:
secretKeyRef:
name: tls-certs
key: certificate

Each file entry requires key and mountPath, and must have exactly one of value or valueFrom set.

Endpoints​

Endpoints define the network interfaces that the component exposes. They are specified as a map where each key is the endpoint name:

endpoints:
http:
type: HTTP
port: 8080
visibility:
- external
basePath: /api/v1
grpc:
type: gRPC
port: 9090
visibility:
- namespace

Endpoint Fields​

FieldTypeRequiredDescription
typestringYesProtocol type: HTTP, REST, gRPC, GraphQL, Websocket, TCP, UDP
portint32YesPort number exposed by the endpoint (1-65535)
targetPortint32NoContainer port to forward to (defaults to port)
visibility[]stringNoAdditional visibility scopes beyond the implicit project visibility
basePathstringNoBase path of the API exposed via the endpoint
displayNamestringNoHuman-readable name for the endpoint
schemaobjectNoAPI schema definition (e.g., OpenAPI spec)

Endpoint Visibility​

Every endpoint automatically gets project visibility, meaning it is accessible to other components within the same project and environment. The visibility array adds additional scopes:

VisibilityDescription
projectAccessible within the same project and environment (implicit for all endpoints)
namespaceAccessible across all projects in the same namespace and environment
internalAccessible across all namespaces in the deployment
externalAccessible from outside the deployment, including public internet

Visibility levels control both routing (HTTPRoutes) and network access (NetworkPolicies). For example, an endpoint with external visibility gets an HTTPRoute on the external gateway and a NetworkPolicy allowing ingress from non-OpenChoreo namespaces, while namespace visibility allows cross-project traffic within the same namespace.

Example​

Here is a complete Workload example for a REST service with an external endpoint:

apiVersion: openchoreo.dev/v1alpha1
kind: Workload
metadata:
name: greeter-service-workload
namespace: default
spec:
owner:
projectName: default
componentName: greeter-service
container:
image: ghcr.io/openchoreo/samples/greeter-service:latest
args:
- --port
- "9090"
endpoints:
http:
type: HTTP
port: 9090
visibility:
- external