The primary developer-facing resource. Defines a workload's containers, network dependencies (bilateral agreements), volumes, secrets, autoscaling, and deploy strategy in a single manifest.
A media server ecosystem demonstrating volume ownership vs. reference, sidecars with capabilities, bilateral agreements, ingress with TLS, secrets, and health probes.
Media Server with Ingress and Shared Volumes
jellyfin.yaml
apiVersion: lattice.dev/v1alpha1
kind: LatticeService
metadata:name: jellyfin
namespace: media
spec:workload:containers:main:image: jellyfin/jellyfin:10.9.6
variables:JELLYFIN_DATA_DIR: /config
JELLYFIN_CACHE_DIR: /cache
volumes:/config:source:${resources.config}/media:source:${resources.media}readOnly:trueresources:requests:cpu: 500m
memory: 1Gi
limits:cpu: 4000m
memory: 4Gi
livenessProbe:httpGet:path: /health
port:8096readinessProbe:httpGet:path: /health
port:8096service:ports:http:port:8096resources:sonarr:# sonarr calls me for webhookstype: service
direction: inbound
jellyfin-creds:# API key from Vaulttype: secret
params:provider: vault-media
keys: [api-key]
refreshInterval: 24h
config:# owned volumetype: volume
id: jellyfin-config
params:size: 10Gi
media:# shared volume (ref, no size)type: volume
id: media-downloads
ingress:routes:public:hosts: [media.example.com]
tls:issuerRef:name: letsencrypt-prod
port: http
imagePullSecrets:
- registry-creds
replicas:1deploy:strategy: rolling
Container security context. When omitted, the compiler applies Pod Security Standards "restricted" profile defaults.
ResourceSpec
Declares a dependency on another service, a volume, a secret, a GPU, or a custom resource. Score-compatible with Lattice extensions for bilateral networking.
Volume mount configuration. The map key is the mount path inside the container (e.g., /config).
VolumeMount fields
Field
Type
Description
source
TemplateString?
Resource reference (e.g., $${resources.config}).
path
string?
Sub-path within the volume to mount.
readOnly
bool?
Mount the volume as read-only.
medium
string?
Storage medium (e.g., Memory for emptyDir backed by tmpfs).
sizeLimit
string?
Size limit for emptyDir volumes (e.g., "1Gi").
FileMount
File mount configuration. The map key is the file path inside the container (e.g., /etc/config.yaml). At least one of content, binaryContent, or source must be set.
Sidecar container specification. Identical to ContainerSpec with one additional field.
SidecarSpec fields
Field
Type
Description
init
bool?
Run as an init container (runs once before main containers start). Default: false.
Plus all ContainerSpec fields: image, command, args, variables, resources, files, volumes, probes, security.
SecurityContext
Container security context. When omitted entirely, the compiler applies Pod Security Standards "restricted" profile defaults: drop ALL capabilities, no privilege escalation, non-root, read-only rootfs, RuntimeDefault seccomp and AppArmor profiles.
SecurityContext fields
Field
Type
Description
capabilities
[]string
Linux capabilities to add (e.g., NET_ADMIN, SYS_MODULE).
dropCapabilities
[]string?
Capabilities to drop. Default: [ALL].
privileged
bool?
Run in privileged mode (strongly discouraged).
readOnlyRootFilesystem
bool?
Mount root filesystem as read-only. Default: true. Generates block-rootfs-write Tetragon policy.