Workload
The Workload is the runtime contract of a Component: what container to
run, what network endpoints it exposes, and what it depends on. Every component has exactly
one Workload. You author it directly (for a prebuilt image) or let a build generate it from your
source plus a workload.yaml descriptor. It's the single source of truth the platform renders
into a Deployment, Service, HTTPRoutes, and NetworkPolicies on the data plane.
| Kind | Workload |
| API group | openchoreo.dev/v1alpha1 |
| Scope | Namespaced |
| Audience | Developer |
| Parent | Component (spec.owner — immutable) |
| Defines | container, Endpoints, dependencies |
Where it sits
Component
└── Workload ← you are here
├── Endpoint (what it exposes)
└── dependency → another Endpoint · or a Resource
Key spec fields
| Field | Description |
|---|---|
spec.owner.projectName / spec.owner.componentName | Ties the workload to its component (immutable) |
spec.container.image | OCI image to run (the only required container field) |
spec.container.command / args / env / files | Entrypoint, arguments, env vars, mounted files |
spec.endpoints | Map of exposed network interfaces, keyed by name |
spec.dependencies.endpoints[] | Links to other components' endpoints |
spec.dependencies.resources[] | Links to managed Resources |
Endpoint
An Endpoint is a network interface the workload exposes. Endpoints are a map keyed by name; each has a type, a port, and a visibility that controls both routing and network policy.
| Field | Required | Description |
|---|---|---|
type | Yes | HTTP, gRPC, GraphQL, Websocket, TCP, or UDP |
port | Yes | Port the endpoint exposes (1–65535) |
targetPort | No | Container port to forward to (defaults to port) |
visibility | No | Scopes beyond the implicit project (see below) |
basePath | No | Base path of the API the endpoint serves |
Every endpoint always gets project visibility implicitly; the visibility array widens it:
| Visibility | Reachable from |
|---|---|
project | Other components in the same project + environment (implicit) |
namespace | Any project in the same namespace + environment |
internal | Any namespace across the deployment |
external | The public internet, with TLS (gets a public HTTPRoute on the external gateway) |
Only mark an endpoint external if it genuinely needs to be on the public internet — that widens
both its route and its network policy.
Create in the portal
A Workload isn't created on its own — the Create Component wizard writes it for you:
- Open Create… → Application Resources → Component and pick the project (
url-shortener). - Build & Deploy — set the container image (or build-from-source), plus command, args, env vars, and mounted files.
- Service Details — add each endpoint (type, port, base path) and its visibility — e.g.
externalfor theshortener-webfrontend,projectfor an internal API. - Click Create — the portal writes the Workload shown in the Example.
To change the contract later, open the component and edit its workload from the relevant tab.
Full field reference: Workloads and endpoints.
Example
apiVersion: openchoreo.dev/v1alpha1
kind: Workload
metadata:
name: cart-api
namespace: fedshi
spec:
owner:
projectName: checkout
componentName: cart-api
container:
image: registry.idp.fedshi.com/checkout/cart-api:1.4.0
env:
- key: LOG_LEVEL
value: info
endpoints:
http:
type: HTTP
port: 8080
basePath: /api/v1
visibility: [external]
dependencies:
resources:
- ref: cart-postgres
envBindings:
host: DB_HOST
port: DB_PORT
password: DB_PASSWORD
See also
- Workloads and endpoints (developer view).
- Dependencies — endpoint and resource dependencies in depth.
- Component · Resource
- Upstream field-level API reference.