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

Workload

A Workload defines the runtime specification for a Component in OpenChoreo, including container configuration, network endpoints, and connections to other services. It represents the actual deployment characteristics of a component, specifying the container to run, what ports to expose, and what dependencies to inject. Workloads are created automatically by build processes or can be defined manually for pre-built images.

API Version​

openchoreo.dev/v1alpha1

Resource Definition​

Metadata​

Workloads are namespace-scoped resources and belong to a Component through the owner field.

apiVersion: openchoreo.dev/v1alpha1
kind: Workload
metadata:
name: <workload-name>
namespace: <namespace> # Namespace for grouping workloads

Spec Fields​

FieldTypeRequiredDefaultDescription
ownerWorkloadOwnerYes-Ownership information linking the workload to a project and component
containerContainerYes-Container specification for the workload
endpointsmap[string]WorkloadEndpointNoNetwork endpoints for port exposure keyed by endpoint name
dependenciesWorkloadDependenciesNo-Dependencies on other workload endpoints

WorkloadOwner​

FieldTypeRequiredDefaultDescription
projectNamestringYes-Name of the project that owns this workload (min: 1)
componentNamestringYes-Name of the component that owns this workload (min: 1)

Container​

FieldTypeRequiredDefaultDescription
imagestringYes-OCI image to run (digest or tag, min: 1)
command[]stringNo[]Container entrypoint
args[]stringNo[]Arguments for the entrypoint
env[EnvVar]No[]Environment variables
files[File]No[]File configurations and secrets

EnvVar​

FieldTypeRequiredDefaultDescription
keystringYes-Environment variable name
valuestringNo-Environment variable value (required if secretKeyRef is not set)
secretKeyRefsecretKeyRefNo-Reference to a secret key (required if value is not set)

File​

FieldTypeRequiredDefaultDescription
keystringYes-File name
mountPathstringYes-Path where the file should be mounted
valuestringNo-File content (required if secretKeyRef is not set)
secretKeyRefsecretKeyRefNo-Reference to a secret key (required if value is not set)

secretKeyRef​

FieldTypeRequiredDefaultDescription
namestringYes-Name of the secret
keystringYes-Key within the secret

WorkloadEndpoint​

FieldTypeRequiredDefaultDescription
typeEndpointTypeYes-Protocol/technology of the endpoint
portint32Yes-Port number exposed by the endpoint (1-65535)
targetPortint32NoportTarget port on the container (1-65535), defaults to port if not set
visibility[]EndpointVisibilityNo[]Additional visibility scopes beyond the implicit project visibility
displayNamestringNo-Human-readable name for the endpoint
basePathstringNo-Base path of the API exposed via the endpoint
schemaSchemaNo-Optional API schema definition for the endpoint

Visibility Behavior:

  • Every endpoint automatically gets project visibility (accessible within the same project and environment)
  • The visibility array adds additional scopes beyond the implicit project access
  • Multiple visibility levels can be specified to create routes on different gateways

EndpointVisibility​

ValueDescription
projectAccessible only 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 (intranet)
externalAccessible from outside the deployment, including public internet

EndpointType​

ValueDescription
HTTPStandard HTTP endpoint
RESTRESTful API endpoint
gRPCgRPC service endpoint
GraphQLGraphQL API endpoint
WebsocketWebSocket endpoint
TCPRaw TCP endpoint
UDPUDP endpoint

Schema​

FieldTypeRequiredDefaultDescription
typestringNo""Schema type (e.g., "openapi", "graphql", etc.)
contentstringNo""Schema content (API definition)

WorkloadDependencies​

FieldTypeRequiredDefaultDescription
endpoints[WorkloadConnection]No[]List of endpoint connections to depend on

WorkloadConnection​

FieldTypeRequiredDefaultDescription
projectstringNo-Name of the project that owns the target component
componentstringYes-Name of the target component
namestringYes-Name of the endpoint on the target component
visibilityEndpointVisibilityYes-Visibility scope of the target endpoint
envBindingsConnectionEnvBindingsYes-Environment variable bindings for connection details

ConnectionEnvBindings​

FieldTypeRequiredDefaultDescription
addressstringNo-Environment variable name for the full address (host:port/path)
hoststringNo-Environment variable name for the host
portstringNo-Environment variable name for the port
basePathstringNo-Environment variable name for the base path

Examples​

Basic Service Workload​

apiVersion: openchoreo.dev/v1alpha1
kind: Workload
metadata:
name: customer-service-workload
namespace: default
spec:
owner:
projectName: my-project
componentName: customer-service
container:
image: myregistry/customer-service:v1.0.0
env:
- key: LOG_LEVEL
value: info
endpoints:
http:
type: REST
port: 8080
visibility: ["external"]
basePath: "/api/v1"
displayName: "Customer REST API"
metrics:
type: HTTP
port: 9090
targetPort: 9090

Workload with Environment Variables and Files​

apiVersion: openchoreo.dev/v1alpha1
kind: Workload
metadata:
name: secure-service-workload
namespace: default
spec:
owner:
projectName: my-project
componentName: secure-service
container:
image: myregistry/secure-service:v1.0.0
env:
- key: LOG_LEVEL
value: info
- key: GIT_PAT
secretKeyRef:
name: git-secrets
key: pat
files:
- key: ssl.pem
mountPath: /tmp
secretKeyRef:
name: certificates
key: privateKey
- key: application.toml
mountPath: /tmp
value: |
schema_generation:
enable: true
endpoints:
api:
type: REST
port: 8080
visibility: ["external"]
basePath: "/api"
apiVersion: openchoreo.dev/v1alpha1
kind: Workload
metadata:
name: order-service-workload
namespace: default
spec:
owner:
projectName: my-project
componentName: order-service
container:
image: myregistry/order-service:v2.1.0
command: [ "/app/server" ]
args: [ "--config", "/etc/config.yaml" ]
endpoints:
api:
type: REST
port: 8080
visibility: ["external"]
basePath: "/orders"
displayName: "Order Management API"
schema:
content: |
openapi: 3.0.0
info:
title: Order API
version: 1.0.0
dependencies:
endpoints:
- component: postgres-db
name: api
visibility: project
envBindings:
address: DATABASE_URL
host: DB_HOST
port: DB_PORT

Annotations​

Workloads support the following annotations:

AnnotationDescription
openchoreo.dev/display-nameHuman-readable name for UI display
openchoreo.dev/descriptionDetailed description of the workload
  • Component - Components that own workloads
  • Service - Service resources that reference workloads
  • WebApplication - WebApplication resources that reference workloads
  • ScheduledTask - ScheduledTask resources that reference workloads