Skip to main content
Version: Next

ServiceBinding

A ServiceBinding represents the deployment of a Service to a specific Environment in OpenChoreo. It binds a Service component to an environment, creating the actual runtime instances. ServiceBindings contain environment-specific configurations including the workload specification and API configurations. They control the lifecycle of the deployed service.

API Version

openchoreo.dev/v1alpha1

Resource Definition

Metadata

ServiceBindings are namespace-scoped resources that must be created within an Organization's namespace.

apiVersion: openchoreo.dev/v1alpha1
kind: ServiceBinding
metadata:
name: <servicebinding-name>
namespace: <org-namespace> # Organization namespace

Spec Fields

FieldTypeRequiredDefaultDescription
ownerServiceOwnerYes-Ownership information linking the binding to a project and component
environmentstringYes-Target environment for this binding
classNamestringNo"default"Name of the ServiceClass that provides deployment configuration
workloadSpecWorkloadTemplateSpecYes-Workload specification for this environment
apismap[string]ServiceAPINoAPI configuration for endpoints. Keys must match endpoint keys in the workload
releaseStateReleaseStateNo"Active"Controls the deployment state of the release

ServiceOwner

FieldTypeRequiredDefaultDescription
projectNamestringYes-Name of the project that owns this service binding
componentNamestringYes-Name of the component that owns this service binding

WorkloadTemplateSpec

The WorkloadTemplateSpec contains the same fields as the Workload spec, allowing environment-specific configuration.

FieldTypeRequiredDefaultDescription
containersmap[string]ContainerYes-Container specifications keyed by container name. Must have at least one container with the key "main"
endpointsmap[string]WorkloadEndpointNoNetwork endpoints for port exposure keyed by endpoint name
connectionsmap[string]WorkloadConnectionNoConnections to internal/external resources keyed by connection name. Supports template variables provided by the connection type

ServiceAPI

FieldTypeRequiredDefaultDescription
classNamestringNo"default"API class name for management policies
typeEndpointTypeYes-Type of the API endpoint
restRESTEndpointNo-REST-specific endpoint configuration

ReleaseState

ValueDescription
ActiveResources are deployed normally to the data plane
SuspendResources are suspended (scaled to zero or paused)
UndeployResources are removed from the data plane

Status Fields

FieldTypeDefaultDescription
conditions[]Condition[]Standard Kubernetes conditions tracking the binding state
endpoints[EndpointStatus][]Status information for each endpoint

EndpointStatus

FieldTypeDefaultDescription
namestring""Endpoint identifier matching spec.endpoints
typeEndpointType""Type of the endpoint
projectEndpointAccess-Access info for project-level visibility
organizationEndpointAccess-Access info for organization-level visibility
publicEndpointAccess-Access info for public visibility

EndpointAccess

FieldTypeDefaultDescription
hoststring""Hostname or service name
portint320Port number
schemestring""Connection scheme (http, https, grpc, tcp)
basePathstring""Base URL path (for HTTP-based endpoints)
uristring""Computed URI for connecting to the endpoint (e.g., https://api.example.com:8080/v1)

Examples

Basic ServiceBinding

apiVersion: openchoreo.dev/v1alpha1
kind: ServiceBinding
metadata:
name: customer-service-prod-binding
namespace: default
spec:
owner:
projectName: my-project
componentName: customer-service
environment: production
className: default
workloadSpec:
containers:
main:
image: myregistry/customer-service:v1.0.0
env:
- key: LOG_LEVEL
value: info
- key: DB_HOST
value: prod-db.example.com
endpoints:
api:
type: REST
port: 8080

ServiceBinding with API Configuration

apiVersion: openchoreo.dev/v1alpha1
kind: ServiceBinding
metadata:
name: order-service-staging-binding
namespace: default
spec:
owner:
projectName: my-project
componentName: order-service
environment: staging
className: production-service
workloadSpec:
containers:
main:
image: myregistry/order-service:v2.1.0-rc1
env:
- key: ENVIRONMENT
value: staging
endpoints:
order-api:
type: REST
port: 8080
connections:
database:
type: api
params:
projectName: my-project
componentName: postgres-db
endpoint: tcp-endpoint
inject:
env:
- name: DATABASE_HOST
value: "{{ .host }}"
- name: DATABASE_PORT
value: "{{ .port }}"
apis:
order-api:
className: default
type: REST
rest:
backend:
port: 8080
basePath: /api/v1
exposeLevels:
- Organization

Annotations

ServiceBindings support the following annotations:

AnnotationDescription
openchoreo.dev/display-nameHuman-readable name for UI display
openchoreo.dev/descriptionDetailed description of the service binding
  • Service - Service resources that ServiceBindings deploy
  • Environment - Environments where services are bound
  • Release - Releases created by ServiceBindings
  • Workload - Workload specifications used in bindings