Skip to main content

Service Unit

API Group: environments.blanketops.dev

Version: v1alpha1

Scope: Namespaced


Description

ServiceUnit defines the runtime workload contract for a delivery artifact.

It specifies artifact source, scaling boundaries, port exposure, application role, and stack classification.

  • ServiceUnit abstracts workload identity from deployment strategy.
  • ServiceUnit does not reconcile manifests directly.
  • ServiceUnit defines workload shape.

Spec

spec

FieldTypeRequiredDescription
contractobjectYesWorkload definition contract

spec.contract

FieldTypeRequiredDescription
typestringYesArtifact origin type (static or build)
imagestringCond.Container image reference (required if type=static)
buildRefobjectCond.Reference to Build (required if type=build)
containerPortintegerYesPrimary container TCP port
sizeintegerYesDesired replica count baseline
appTypestringYesApplication role classification (web, worker, etc.)
stackTypestringYesTechnology stack classification (nodejs, python, etc.)

spec.contract.buildRef

FieldTypeRequiredDescription
namestringYesName of referenced Build CR

Status

FieldTypeDescription
phasestringCurrent lifecycle phase
observedImagestringResolved image reference in runtime
conditions[]ConditionStandard Kubernetes condition array

status.phase Values

ValueMeaning
PendingServiceUnit registered but not yet projected
ResolvedArtifact reference successfully resolved
ReadySuccessfully projected into a Deployment
FailedResolution or projection failed

Examples

Static Artifact

apiVersion: environments.blanketops.dev/v1
kind: ServiceUnit
metadata:
name: for-kaniko-app-api
namespace: dev
spec:
contract:
type: static
image: docker.io/example/for-kaniko-app:master
containerPort: 8080
size: 2
appType: web
stackType: nodejs

Build-Derived Artifact

apiVersion: environments.blanketops.dev/v1
kind: ServiceUnit
metadata:
name: for-buildah-app-worker
namespace: dev
spec:
contract:
type: build
buildRef:
name: for-buildah-app
containerPort: 9000
size: 1
appType: worker
stackType: python

Invariants

  • If type=static, image must be specified and buildRef must not be set.
  • If type=build, buildRef must reference an existing Build and image must not be set.
  • containerPort must be a valid TCP port.
  • size must be greater than zero.
  • ServiceUnit does not create Deployment resources automatically.
  • ServiceUnit must be referenced by a Deployment to be projected into runtime