Skip to main content

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.

KindWorkload
API groupopenchoreo.dev/v1alpha1
ScopeNamespaced
AudienceDeveloper
ParentComponent (spec.owner — immutable)
Definescontainer, Endpoints, dependencies

Where it sits

Component
└── Workload ← you are here
├── Endpoint (what it exposes)
└── dependency → another Endpoint · or a Resource

Key spec fields

FieldDescription
spec.owner.projectName / spec.owner.componentNameTies the workload to its component (immutable)
spec.container.imageOCI image to run (the only required container field)
spec.container.command / args / env / filesEntrypoint, arguments, env vars, mounted files
spec.endpointsMap 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.

FieldRequiredDescription
typeYesHTTP, gRPC, GraphQL, Websocket, TCP, or UDP
portYesPort the endpoint exposes (1–65535)
targetPortNoContainer port to forward to (defaults to port)
visibilityNoScopes beyond the implicit project (see below)
basePathNoBase path of the API the endpoint serves

Every endpoint always gets project visibility implicitly; the visibility array widens it:

VisibilityReachable from
projectOther components in the same project + environment (implicit)
namespaceAny project in the same namespace + environment
internalAny namespace across the deployment
externalThe public internet, with TLS (gets a public HTTPRoute on the external gateway)
Default to the narrowest visibility

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:

  1. Open Create…Application ResourcesComponent and pick the project (url-shortener).
  2. Build & Deploy — set the container image (or build-from-source), plus command, args, env vars, and mounted files.
  3. Service Details — add each endpoint (type, port, base path) and its visibility — e.g. external for the shortener-web frontend, project for an internal API.
  4. 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