Manifest reference
Every resource Miabi can manage declaratively, and every field its spec accepts. One schema drives
all four consumers: the apply API, GitOps
reconciliation, the miabi CLI, and the Terraform provider.
Manifests are strictly parsed — an unknown key is an error, not a silently ignored typo.
Document shape
Every document has the same four top-level keys:
apiVersion: miabi.io/v1 # the only value apply and GitOps accept
kind: Application # see the kinds below
metadata:
name: web # identity, unique per kind within the workspace
spec: {} # kind-specific
The installer's install.miabi.io/v1 ControlPlane document is a separate format, not a resource you
apply here — see Install manifest.
A file may hold many documents separated by ---, and a Git source may spread them over many files
in a directory — they are all parsed into one bundle.
The workspace is not in the manifest. It comes from the target you apply to, so the same file deploys to staging and production unchanged.
metadata
| Field | Type | Description |
|---|---|---|
name | string | Required. Lowercase [a-z0-9-], starting alphanumeric. For a Domain it is a real hostname instead (shop.example.com). |
uid | string | The resource's Miabi uid, which is specific to one install. Omit it in manifests. |
labels | map | Short identifying key/values for selection and grouping. Keys and values follow the Kubernetes rules (optional prefix/, max 63 chars). Reserved miabi.io/ keys are stripped. Stored only on Application and Registry resources. |
annotations | map | Free-form descriptive metadata — owners, links, tooling hints. Keys are validated; values are arbitrary text. |
Kinds at a glance
| Kind | What it is | Applied |
|---|---|---|
Application | A long-running container workload | 3rd |
Stack | Groups applications into one unit and network | 2nd |
Database | A managed PostgreSQL, MySQL, MariaDB, Redis, MongoDB or libSQL database | 2nd |
DatabaseInstance | A database server that several Database manifests share | 1st |
Volume | Persistent storage | 1st |
Secret | A named encrypted value | 1st |
SealedSecret | A secret value sealed to the workspace's key, safe to commit | 1st |
Config | A set of configuration files mounted into apps | 1st |
Registry | A container-registry credential for private images | 2nd |
GitRepository | A Git credential: a repository URL and how to authenticate to it | 2nd |
GitSource | A GitOps project: a Git path of manifests the workspace keeps reconciled | 3rd |
Middleware | A gateway policy — rate limit, auth, access rules — routes reference by name | 1st |
Route | An HTTP routing rule (host/path → app:port + TLS) | 4th |
CronJob | A command run in an app on a schedule | 4th |
Job | A command run in an app once, on a spec change, or on every release | 4th |
Domain | An owned hostname and its default TLS policy | 1st |
Project | Bundles the resources above into one unit | — |
Ordering is automatic: dependencies are created before their dependants and torn down after them, so a bundle that creates a database and the app using it converges in a single apply.
Application
A long-running container workload.
apiVersion: miabi.io/v1
kind: Application
metadata:
name: web
spec:
image: ghcr.io/acme/web
tag: "1.4.0"
digest: sha256:… # immutable pin; wins over tag
registry: ghcr # credential for a private image
command: ["server", "--port=8080"]
stack: shop # join a Stack (must be declared in the bundle)
externalLabel: shop # pins the public URL to shop.<base-domain>
placement: # where it runs
location: eu-central # omit for its stack's, its databases' or the workspace default
constraints: # service only, Swarm syntax
- node.labels.disk==ssd
deployment: # how it runs and rolls out
runtime: service # container (default) | service — a replicated Swarm service
replicas: 3 # service only; omit to keep the current count
strategy: rolling # recreate | rolling | canary; omit to keep the app's
update: # service only — how a release rolls out
parallelism: 1
delaySeconds: 10
security: # what it may do
runAsUser: "1000:1000" # account the container runs as; omit to keep the image's
readOnlyRootFilesystem: true
noNewPrivileges: true
capabilities:
add: [NET_BIND_SERVICE] # allow-listed grants
drop: [ALL] # any Linux capability, or ALL
healthcheck: # when a release counts as up; omit to keep the app's check
type: http # http | command | image (default) | none
path: /healthz # http: the URL path probed
port: 8080 # http: defaults to the app's primary port
intervalSeconds: 10 # default 30
timeoutSeconds: 5 # default 5
retries: 3 # default 3
startPeriodSeconds: 20 # default 0 — grace before failures count
ports:
- name: http # optional; a Route can target the port by name
container: 8080
scheme: http # http | https (default http) — how the proxy talks to it
protocol: tcp # tcp | udp (default tcp)
externalAccess: true # public HTTPS URL through the reverse proxy
primary: true # MIABI_PORT, MIABI_INTERNAL_URL, route default (default: the first port)
- container: 9090
publish: true # bind to a host port, like `docker -p`
hostPort: 19090 # omit or 0 to auto-allocate
env:
APP_ENV: production
DATABASE_URL: "{{ .databases.shop-db.uri }}"
API_KEY: "{{ .secrets.api-key }}" # kept as a vault reference, resolved at deploy
LICENSE_KEY: "lic-1234"
secretEnv: # literal values to store encrypted at rest
- LICENSE_KEY
mounts:
- volume: web-data # must be a Volume in the same bundle
path: /data
readOnly: false
- config: web-conf # …or a Config — exactly one of volume/config
key: nginx.conf # one file; omit to project the whole set under path
path: /etc/nginx/nginx.conf
mode: "0444"
reloadPolicy: restart # restart (default) | none — on a mounted config's change
miabiEnv: true # false: Miabi sets no MIABI_* variables; omit to keep the current choice
reconcile: # what the control manager does when the app changes outside Miabi
policy: inherit # inherit | off | observe | enforce
restartExternalStops: false # true: start it again after a docker stop outside Miabi
resources:
memory: 512Mi # Ki/Mi/Gi; empty = unlimited
cpu: "0.5" # cores; empty = unlimited
gpu: 1 # whole GPU devices
gpuKind: nvidia # narrow to a vendor/model
gpuCapabilities: [video] # NVIDIA driver capabilities; empty = compute, utility
containerLabels: # stamped on the container for label-reading tools
traefik.enable: "true"
| Field | Notes |
|---|---|
image | Required unless source is set — exactly one of the two. A repository, e.g. ghcr.io/acme/web, optionally with its tag: image: nginx:1.25 is the same as image: nginx with tag: "1.25". A registry port (registry.example.com:5000/team/web) is not a tag. |
tag | The tag to pull. Defaults to the tag in image, else latest. Setting it alongside a tag in image is allowed only when both match. |
digest | A sha256:… pin. CI writes it; GitOps converges the runtime to it. |
registry | Names a Registry credential. It need not be declared in the same bundle — an undeclared name resolves against the workspace's existing credentials. An unknown name is an error, not a silent anonymous pull. |
command | Overrides the image's command (argv form). |
stack | Must name a Stack in the same bundle. Members share a network and resolve each other by name. Joins the app to the stack on create, and moves it when changed; omit it to keep a membership set in the console. A single-app export leaves it out, since it carries no Stack. |
placement.location | The location the app is created in, by name. Omit it to use its stack's location; else, when every database it references sits in one location, that location; else the workspace default. An app that mounts a volume is created on that volume's node. Fixed once created — see locations. |
placement.constraints | Service only. Swarm placement constraints, such as node.labels.disk==ssd or node.role!=manager, narrowing the nodes of the app's location it runs on. An empty list clears them; omitting the field keeps them. A plan's node pool still applies on top. |
placement.node | A node of the app's location, by its node name. A container runs there; a service gets it as a constraint at each deploy. Omitting it keeps the current pin. See pinning to a node. |
deployment.runtime | container (default) runs one Docker container; service runs a replicated Swarm service, which needs a location that runs a swarm — see cluster mode. Omitted, a new app is a container and an existing app keeps its runtime; stated, a change converges. |
deployment.replicas | Service only, 1–100. Omit it to keep the count the app runs at, so a scale made in the console is not undone. |
deployment.strategy | How a new release replaces the running one: recreate, rolling (default) or canary. Omit it to leave whatever the app is configured with in the console. A canary needs a running release to shift traffic against, so the first deploy of an app is always a straight rollout. Canary weights and interval stay console-side — they tune a rollout in flight rather than describing desired state. |
deployment.update | Service only. parallelism tasks are replaced at a time, with delaySeconds between batches. Omit it to keep the app's setting. Setting deployment.replicas, deployment.update or placement.constraints without deployment.runtime: service is an error, not a silent no-op. |
externalLabel | Pins the external-access subdomain. Platform-wide unique: if taken, it is ignored and a generated label is used — the apply still succeeds. |
ports | See port exposure. |
env / secretEnv | Every secretEnv key must also appear in env. Values support interpolation. A key that reads a secret or a database credential ({{ .secrets.* }}, {{ .databases.<name>.password }}, .uri) needs no secretEnv: it is stored as a vault reference and resolved at deploy, and a credential that has to be stored as its value is encrypted automatically — see secrets in env. List a key under secretEnv when you write a sensitive value into the manifest literally. |
mounts | Exactly one of volume or config, and both must be declared in the same bundle. key and mode are valid only with a config — setting them on a volume mount is an error, not a silent no-op. A config mount is always read-only. Privileged host binds are not manifest-expressible. |
reloadPolicy | restart (default) redeploys the app when a mounted Config's content changes; none leaves it running, for apps that watch their own config file. |
miabiEnv | false stops Miabi setting its MIABI_* variables in the app and its jobs. Omit it to keep the choice made in the console; stated, a change converges at the next deploy. |
reconcile.policy | The app's control manager override: inherit (default) follows the platform, off, observe or enforce. Omit it to keep the console's choice. |
reconcile.restartExternalStops | true lets an enforcing control manager start the app's container again after it is stopped outside Miabi. Omit it to keep the console's choice. |
security.runAsUser | The account the container runs as — uid, uid:gid, name or name:group — like docker run --user. Omit to keep the image's own user. A workspace under the restricted security profile must give a non-root numeric uid; a name is refused there, since the image decides what it maps to. Attached volumes are chowned to it on deploy. |
security.readOnlyRootFilesystem | Mounts the container's root filesystem read-only. Volumes stay writable, so an image that writes elsewhere, such as /tmp, needs a volume there or it fails to start. One-off jobs keep a writable filesystem. |
security.noNewPrivileges | Stops a process gaining privileges through setuid binaries. The restricted security profile always sets it, so false is refused there rather than silently overridden. |
security.capabilities | add grants capabilities from the allow-list, in a privileged workspace; drop removes any Linux capability, or ALL to keep only what add grants. The CAP_ prefix is optional; a capability both added and dropped is an error. |
security.devices | Host devices exposed to the container — see capabilities & devices. Not allowed on a service. |
healthcheck | How a deploy knows the new release is up — see health checks. Only the fields stated are applied; omit the block to keep the app's current check. |
resources | Omitted fields mean unlimited / none. |
source | Build the image from Git instead of pulling one — see Building from source. Mutually exclusive with image. |
containerLabels | Reserved namespaces (io.miabi.*, com.docker.*) are stripped rather than rejected. See container labels. |
Every security field is the manifest's to state: an omitted one means the container default, so
removing a field from the file converges the app back to it. Hardening layers on top of the
workspace's security profile and can only take more away.
Manifests written before these fields were grouped still apply. Top-level runAsUser and strategy,
and security.addCapabilities, are read as security.runAsUser, deployment.strategy and
security.capabilities.add. Setting an old spelling together with its new one is an error, and an
export always writes the new ones.
Pinning to a node
placement.node names the node an app runs on, inside its location:
spec:
placement:
location: eu-central
node: worker-2 # the node's name, not its display name
deployment:
runtime: service
replicas: 1
- Container apps run on that node. The pin can change only before the app's first deploy: a
deployed container app cannot move nodes yet, and changing
nodeon one is refused. - Services get the pin as a placement constraint, resolved at every deploy, so it survives the
node rejoining the swarm. A changed pin takes effect at the next deploy. With
replicasabove 1, every replica runs on that one node. - A node-local volume wins. An app already follows the node of a node-local volume it mounts; a
nodethat points elsewhere is refused withNODE_VOLUME_CONFLICT, naming the volume and both nodes. - Omitting
nodekeeps the current pin. To remove a pin, clear it in the console (Settings → Node) or send"node": ""to the API. nodeis refused together with anode.id==ornode.hostname==constraint, since both would choose the node. Label and role constraints combine with it.- Whether workspace members may pin at all is set by the platform and the plan; see who can choose a node.
For anything finer than one named node, use placement.constraints on a service:
| Constraint | Matches |
|---|---|
node.hostname==worker-2 | The node whose Docker hostname is worker-2. This is the node's hostname, not its display name in Miabi. |
node.id==<swarm node id> | One Swarm node by ID. Prefer placement.node, which names the node the way Miabi does. |
node.labels.disk==ssd | Any node with that label. Use this when a node may be replaced or renamed. |
node.hostname!=worker-3 | Any node except worker-3. Use != to keep an app off a node. |
node.role==worker | Worker nodes only; node.role!=manager does the same. |
Each constraint must read <attribute>==<value> or <attribute>!=<value>, and all of them must hold
at once. The node must belong to the app's location, and to the plan's
node pool if there is one. A pin no node satisfies is
accepted, but the service never starts: Swarm leaves its tasks pending.
Constraints apply to services only; a container app is pinned with placement.node.
Health checks
A health check is what makes a deploy safe: with an http or command check, a rolling deploy starts
the new container, waits for it to report healthy, and only then moves traffic to it and retires the
old one. A release that never
turns healthy fails the deploy, and the running one keeps serving.
kind: Application
metadata: { name: guestbook }
spec:
image: miabi/guestbook
tag: "3.0.0"
ports: [{ container: 8080, externalAccess: true }]
healthcheck:
type: http
path: /healthz
intervalSeconds: 10
type | Healthy when | Needs |
|---|---|---|
http | A GET of path on port (default: the app's primary port) answers 2xx or 3xx. | Nothing in the image for a container app: Miabi copies a small probe in, so distroless and scratch images work. A service, or a read-only root filesystem, probes with the image's curl, wget or bash instead. |
command | command exits 0, e.g. pg_isready. | A shell in the image; the command runs through it. |
image | The image's own HEALTHCHECK, if it declares one. The default. | Nothing. Deploys don't wait for it: its timing is the image's. |
none | — | No check at all: the image's own HEALTHCHECK is turned off too. Use it for queue workers and schedulers built from a web image, whose baked-in HTTP check would otherwise fail and get a Swarm task replaced in a loop. |
intervalSeconds (default 30) is the time between probes, timeoutSeconds (default 5) how long one
may take, retries (default 3) how many consecutive failures make the container unhealthy, and
startPeriodSeconds (default 0) a grace period after start in which failures don't count, for apps
that are slow to warm up.
Only the fields you state are applied. A manifest without a healthcheck block leaves the check
set in the console alone, and one stating just type and path keeps the app's timing. Set
type: image to go back to the image's own check, or type: none to have no check at all. A
command check needs command, and path must start with /.
The healthcheck.yaml
example shows an HTTP check, a slow starter with a start period, and a command check.
Building from source
An application either pulls an image or builds one. source is the second: point it at a
repository and Miabi builds and deploys it, exactly as an app created from a Git repository in the
console does.
kind: Application
metadata: { name: web }
spec:
source:
git: https://github.com/acme/web
ref: main # branch, tag or commit; default branch when omitted
buildMethod: auto # auto | dockerfile | buildpack
builder: paketobuildpacks/builder-jammy-base # buildpack builds only
buildpacks: [paketo-buildpacks/go] # buildpack builds only
buildEnv: # available to the BUILD, not the running container
BP_GO_VERSION: "1.26"
repository: acme-github # stored Git credential, for a private repo
ports: [{ container: 8080 }]
image and source are mutually exclusive — a manifest declaring both is refused rather than
having the engine pick one. buildEnv is build-time only; variables the running container needs
belong in env.
repository names a Git credential: a GitRepository declared in the same bundle,
or one that already exists in the workspace, so a token created once in the console can be reused
across manifests.
An application created in the console can be exported as a manifest: App → Settings → GitOps
manifest → Generate. It carries the source (or image), ports, environment, resources and the
volumes it mounts — a working starting point for moving an app into Git. Secret values are not
included; each is listed by name under secretEnv. An app created by apply or GitOps, or by a
marketplace install, cannot be exported — its manifest or template already describes it.
Port exposure
The two exposure knobs are orthogonal, and a port may use either, both, or neither:
externalAccess: true— a public HTTPS URL at<externalLabel>.<base-domain>, served through the reverse proxy (L7). Requires an external domain on the app's cluster. For a custom hostname, use aRouteinstead.publish: true(with optionalhostPort) — binds the container port to a raw port on the node (L4), likedocker -p. Host ports are bounded byMIABI_HOST_PORT_MIN/MAX(1024 and up by default); omithostPortto auto-allocate one from that window. A privileged workspace may request any host port (1–65535), so infrastructure that has to sit on a fixed port —25,53,443— can be published from a manifest. In a workspace that is not privileged, the binding is created pending and publishes only once a platform admin approves it — see moderating host ports.
A port with neither is reachable only from inside the app's networks — which is what you want when a label-driven proxy fronts it.
Primary port
primary: true marks the port behind MIABI_PORT and MIABI_INTERNAL_URL, the bare
external-access hostname, and the default for routes and HTTP health checks. Set it on one port
when the app declares several; without it the first port is primary, and reordering the list moves
it. Marking two ports is refused.
Stack
Groups applications into one logical unit with a shared network, so members resolve each other by name. Grouping is no longer required just to make one app reachable from another — see Addressing another application — so reach for a Stack when the apps genuinely belong together, not to solve a hostname.
apiVersion: miabi.io/v1
kind: Stack
metadata:
name: shop
spec:
description: Storefront — web, worker and its datastores
placement:
location: eu-central # optional; the workspace default when omitted
env: # shared by every member; an app's own key of the same name wins
DB_HOST: "{{ .databases.shop-db.host }}"
DB_PASSWORD: "{{ .databases.shop-db.password }}"
API_TOKEN: "{{ .secrets.shop-api-token }}"
Member applications that declare no placement.location of their own are created in the stack's location. One
that declares a different location is refused, naming both.
env is compared only when stated, so a manifest without it leaves variables set in the console
alone. When an apply changes it, every member that has been deployed is redeployed with the new
values at the end of the apply. An app the same apply already deployed is not deployed twice, and a
stopped member is only marked as needing a redeploy. A {{ .secrets.name }} reference stays a
pointer to the vault, so rotating that secret redeploys the members too; when one apply changes
both, each member is redeployed once.
Database
Requests a managed database. Miabi provisions the instance, or reuses a compatible one, and creates a dedicated logical database with its own credentials.
apiVersion: miabi.io/v1
kind: Database
metadata:
name: shop-db
spec:
engine: postgres # postgres | mysql | mariadb | redis | mongodb | libsql
version: "17-alpine"
instance: auto # auto | dedicated | shared, or { type, name }
placement:
location: eu-central # optional; the workspace default when omitted
node: worker-2 # optional; the node of the instance it lands on
resources: # optional; gives the database an instance of its own
memory: 1Gi
cpu: "0.5"
readOnlyUser: true # optional, PostgreSQL only
backup: # optional; scheduled backups of this database
schedule: daily # hourly | daily | weekly | a cron expression
retention: { keep: 7, days: 30 }
instance | Behaviour |
|---|---|
auto (default) | Reuse a running instance of the same engine and version; provision a dedicated one if none exists. |
dedicated | Always provision a fresh instance. Forced for Redis, which has no logical databases. |
shared | Share a running instance of the same engine and version. When the engine runs only at other versions, a dedicated instance is provisioned instead; with no instance of the engine at all, the apply fails. Rejected for engines without logical databases. |
With placement.node, the database lands only on an instance on that node: auto and shared reuse
a compatible instance there, and auto provisions one there when none fits — never one on another
node of the location. The node is fixed once the database exists, and refused on a
shared storage class, whose failover a pin would undo.
An empty version matches an instance at any version. Changing version on an existing database is
refused — its data is not migrated automatically: keep the old version, or delete the database to
re-create it on an instance of the new one.
instance used to be spelled placement: auto, before placement became a block. That spelling
still parses; setting it together with instance is an error.
Targeting a named instance
instance also takes a block that names the instance, so several stacks can share one PostgreSQL on
purpose instead of whichever compatible one Miabi finds first:
spec:
engine: postgres
instance:
type: shared # auto | dedicated | shared; default auto
name: pg-eu2 # an existing instance, or a DatabaseInstance in the same apply
type | With name |
|---|---|
auto | Use the named instance; provision it under that name when it doesn't exist. |
dedicated | Provision a new instance under that name; refused when the name is taken. |
shared | The named instance must exist, or be declared as a DatabaseInstance in the same apply. |
The named instance's engine must match, and so must version, placement.location and
placement.node when you state them; resources are refused, since the instance is sized on its own. The logical database is named
exactly after metadata.name (sanitized for the engine: posta-mail-db becomes posta_mail_db).
Where a database of that name already exists on the instance and this manifest didn't create it, the
apply fails with DATABASE_NAME_TAKEN instead of picking another name. instance.name is fixed once
the database exists: moving a database to another instance would move its data.
Redis and libSQL
Redis has no logical databases, and libSQL hosts exactly one, so for both the instance is the
database: declare them as a Database only, never as a DatabaseInstance. instance.name is refused
for them, since metadata.name already names the instance, and instance: shared stays refused.
backup
backup keeps a backup schedule for the database. Backups are written to the workspace backup
target, encrypted and verified according to the
workspace backup settings; the manifest carries no passphrase or key.
| Field | Meaning |
|---|---|
schedule | hourly, daily (default), weekly, or a five-field cron expression |
retention.keep | Keep at most this many backups; 0 keeps all |
retention.days | Delete backups older than this; 0 keeps them |
enabled | false removes the schedule this manifest declared |
hourly, daily and weekly each resolve to a fixed minute, and for daily and weekly an hour
between 01:00 and 05:00 UTC, derived from the database's name. Many databases on one instance therefore
don't all dump at the same moment. A cron expression is used as written.
Omitted, the database keeps whatever schedules it has, so a first GitOps apply never deletes the
ones created in the console. A declared schedule shows as manifest in the console and can't be
deleted there; schedules created by hand on the same database are left alone. backup is refused on
Redis, whose data is covered by a volume backup.
resources limits the database's instance: memory (with Ki, Mi or Gi) and cpu in cores, the
engine tuned to the memory — see resource sizing.
Stating them gives the database an instance of its own, since one it reused would already run with
another's size: auto provisions a new instance instead of reusing one, and shared with
resources is an error.
readOnlyUser: true adds a second user with SELECT on every table, current and future — for
reporting tools, BI dashboards, or a replica-style reader. Its credentials are available as
{{ .databases.<name>.readonly_user }}, .readonly_password and .readonly_uri (or .readonly_url).
false removes the user; omitted, whatever the database has is kept, so a user added in the console
survives. It is refused on engines other than PostgreSQL.
Omitted, the instance keeps whatever limits it has, so a size set in the console or by the plan's
default is left alone. A stated limit converges, restarting the instance, and "0" removes it. A
database whose instance also hosts other databases cannot converge a size; change it on the instance.
With Enterprise database sizes, resources.size
names a size instead of memory and cpu (setting both is an error). In a workspace whose plan offers
sizes, plain memory and cpu get the smallest offered size covering them.
Reference the result from an app's env with {{ .databases.shop-db.* }} — see
interpolation. The database is also attached to the app that references it, so it
appears under that app with its scoped connection revealable there.
Engine and version changes are not converged in place — that would recreate the data. Such a change fails the apply rather than destroying the database; migrate with a version upgrade instead.
DatabaseInstance
Declares a database server on its own, so that several Database manifests can place
their logical databases on it by name. Use it when one PostgreSQL per location holds the databases
of several stacks; a single-app stack doesn't need it.
apiVersion: miabi.io/v1
kind: DatabaseInstance
metadata:
name: pg-eu2
spec:
engine: postgres # postgres | mysql | mariadb | mongodb
version: "17-alpine"
resources: { memory: 2Gi, cpu: "1" } # or size: <named size> (Enterprise)
placement:
location: eu2
node: worker-2 # optional; fixed once created
storageClass: ssd # optional; fixed once created
recoveryPoints: # optional, Enterprise
schedule: daily
retention: { keep: 14, days: 30 }
---
apiVersion: miabi.io/v1
kind: Database
metadata:
name: posta-mail-db
spec:
engine: postgres
instance: { type: shared, name: pg-eu2 }
Instances are applied before the databases on them and removed after them. Redis and libSQL are
refused: declare them as a Database.
| Change | What happens |
|---|---|
version | The instance is upgraded in place or by dump and restore; a downgrade is refused. Omitted, the instance keeps its version. |
resources | Converged in place, restarting the instance. Omitted, the instance keeps its limits. |
engine, placement.location, placement.node, storageClass | Refused: delete the instance and apply again. |
Adopting an existing instance
An instance that already exists, for example one created in the console, is only taken over when the manifest says so:
kind: DatabaseInstance
metadata:
name: production-postgres
spec:
engine: postgres
version: "17-alpine"
adopt: true
- Without
adopt: true, aDatabaseInstancewhose name is taken by an existing instance is refused withINSTANCE_EXISTS, so a typo can't take over someone else's instance. - The engine must match, and so must
version,placement.location,placement.nodeandstorageClasswhen you state them. To adopt an instance and upgrade it, adopt it at its current version first. The plan shows the action asadopt existing instance. - An instance created by a GitOps project, a one-shot apply or a marketplace install is refused even
with
adopt: true. Once the manifest owns the instance,adopthas no further effect. - Removing the manifest releases an adopted instance; it never deletes it. The instance and its data stay, and it returns to being managed in the console.
Deleting
Removing a DatabaseInstance that the manifest created is refused while databases remain on it, and
the error lists them. Once it is empty, the instance and its recovery-point schedule are removed.
Recovery points already in the bucket are kept.
recoveryPoints
A recovery point backs up every database on the instance as one sealed,
verified set, including databases that other manifests declare. It is an Enterprise feature
(recovery_points) and needs the workspace S3 backup target. A manifest that declares it on Community
Edition, or without the S3 target, fails at plan time instead of skipping the block.
| Field | Meaning |
|---|---|
schedule | hourly, daily (default), weekly, or a five-field cron expression, spread out like a database backup |
retention.keep | Keep at most this many recovery points; 0 keeps all |
retention.days | Delete recovery points older than this; 0 keeps them |
concurrency | How many databases are dumped at once; 0 is the default |
requireEncryption | Refuse the apply, and fail each run, while the workspace has no backup encryption |
enabled | false removes the schedule this manifest declared |
These are sets of logical dumps, not point-in-time recovery from a write-ahead log. Restoring,
pinning and adopting recovery points are actions in the console or CLI, not manifest fields. A
database with its own backup on an instance with recoveryPoints is dumped twice; that is allowed,
and the plan prints a warning.
Volume
Persistent storage, mounted into an application through its mounts.
apiVersion: miabi.io/v1
kind: Volume
metadata:
name: web-data
spec:
size: 5Gi # declared capacity, recorded for quota
storageClass: ssd-fast # optional; see below
placement:
location: eu-central # optional; the workspace default when omitted
node: worker-2 # optional; fixed once created
| Field | Converges? | Notes |
|---|---|---|
size | Grow only | A declared number for quota accounting, so changing it moves no data. A larger size is applied; a smaller one is refused, including one below a capacity expanded in the console, until the manifest catches up. Omitted, the volume keeps its capacity. |
storageClass | No — refused | The data physically lives there. |
placement.location | No — refused | Same reason. |
placement.node | No — refused | The node the data lives on. Omitted, Miabi picks one and the volume never drifts against it. Refused on a shared storage class, whose data is on every node. |
storageClass
Names the storage class the volume is created on — which of the operator's disks holds its data.
Omit it and the manifest stays portable: an unstated class means "whatever this install
decides", not default, so the same repository applies cleanly to installs whose disks differ, and
a volume that landed on a class never shows as drift against a manifest silent about it.
State it and it is enforced — and then it is immutable. Changing it fails the apply:
volume "web-data" is on storage class "ssd-fast"; moving it to "bulk" would relocate its data.
Delete it and apply again, or migrate it
Converging that would mean deleting and recreating the volume, destroying its data from a
git push. Delete the volume deliberately and re-apply if that is what you want.
Shared (NFS/CIFS) and host-path volumes are not manifest-expressible — create those through the API or console.
Secret
A named encrypted value, referenced from app env and from credentials. Creating one needs a value
or generate: true. To keep the value in Git, use a SealedSecret instead.
apiVersion: miabi.io/v1
kind: Secret
metadata:
name: app-key
spec:
value: "s3cr3t" # or:
generate: true # let Miabi generate a strong random value
length: 48 # generated length (default 32)
symbols: true # widen the alphabet beyond letters and digits
minNumbers: 2 # guarantee at least this many digits
minSpecial: 2 # guarantee at least this many symbols
| Field | Default | Meaning |
|---|---|---|
length | 32 | Characters to generate. |
symbols | false | Include punctuation (!#$%&()*+,-./:;<=>?@[]^_{|}~). Quotes, backslash and backtick are excluded so a value survives being pasted into a shell, a YAML file or a connection string. |
minNumbers | 0 | Minimum digits. |
minSpecial | 0 | Minimum symbols. Setting it implies symbols: true; an explicit symbols: false wins, and no symbols are generated. |
These are the same options the console's generator exposes, drawing from
the same alphabet — so a policy written here and the same policy set in the UI produce comparable
values. Minimums that exceed length are trimmed rather than silently ignored, symbols first.
Secret values are write-only: never read back, never shown in a plan, and never diffed. An existing secret is treated as in sync, so a bundle can safely re-apply without churning values. Rotate through the vault or the API.
SealedSecret
A vault secret whose value is sealed to the workspace's public key, so the manifest is safe to commit.
Make one with miabi secrets seal NAME. See Sealed secrets.
apiVersion: miabi.io/v1
kind: SealedSecret
metadata:
name: stripe-key
spec:
value: sealed:v1:2:YWdlLWVuY3J5cHRpb24ub3JnL3YxCi0+IFgyNTUxOS…
| Field | Default | Meaning |
|---|---|---|
value | required | The output of miabi secrets seal: sealed:v1:<keyVersion>:<data>. Never plaintext: anything else is refused. |
A SealedSecret lands in the same vault as a Secret and is referenced the same way,
${{ secrets.stripe-key }} or {{ .secrets.stripe-key }}. The two kinds share one name space: a bundle
can't declare Secret/x and SealedSecret/x together.
Unlike a Secret, a SealedSecret is compared by fingerprint. Changing value in Git plans an
update (value: (current) → (sealed)), and so does a value later set outside Git. Re-sealing an
unchanged value doesn't bump the secret's version or redeploy its consumers.
Switching a name from Secret to SealedSecret in Git takes over the existing vault entry: it is
updated in place, not deleted and recreated. Switching back to Secret leaves the stored value as it
is.
Config
A set of named configuration files, mounted into applications as read-only files — the file-shaped
counterpart to a Secret. Content is encrypted at rest and rendered like app env before it is
stored. See Configuration files for the full model.
apiVersion: miabi.io/v1
kind: Config
metadata:
name: prom-conf
spec:
mode: "0644" # default octal mode for every file
sensitive: false # keep content out of plans; reveal is admin-only
delimiters: ["<<", ">>"] # interpolate on these instead of {{ }}
data:
prometheus.yml: |
global:
scrape_interval: 15s
rules/alerts.yml: |
groups: []
| Field | Notes |
|---|---|
data | Required, at least one entry. Keys are relative paths matching ^[A-Za-z0-9]([A-Za-z0-9._-]*)?(/[A-Za-z0-9._-]+)*$ — no leading /, no ... Values are interpolated. |
mode | Default octal file mode, 0644 when omitted. A mount's mode overrides it per file. |
sensitive | Content never enters a plan — only the digest and each key's present/absent state. |
delimiters | Exactly two distinct, non-empty markers, replacing {{ }} for this config only. Use it for files whose own syntax is {{ }} (Prometheus annotations, Grafana dashboards). |
Limits: 256 KB per file, 512 KB total. The per-file cap is what matters — in cluster mode each file becomes a Docker config object, and Docker caps those at 500 KB, so a larger file would validate here and fail at deploy.
Mount it from an Application:
mounts:
- config: prom-conf # every file under a directory
path: /etc/prometheus # → /etc/prometheus/prometheus.yml, /etc/prometheus/rules/alerts.yml
- config: prom-conf # a single file at an exact path
key: rules/alerts.yml
path: /etc/prometheus/rules/alerts.yml
mode: "0444"
A content change redeploys every application mounting the config, unless that app sets
reloadPolicy: none. Deleting a config that is still mounted is refused.
Registry
A container-registry credential for pulling private images. Applications select one by name through
spec.registry.
apiVersion: miabi.io/v1
kind: Registry
metadata:
name: ghcr
spec:
server: ghcr.io # omit for Docker Hub; host[:port], no scheme
username: acme
password: "${{ secrets.GHCR_TOKEN }}" # or {{ .secrets.ghcr-token }} — see below
Two ways to supply the password, and the difference is when it is read:
| Form | Behaviour |
|---|---|
${{ secrets.NAME }} | Stored as a live reference. The value is read from the vault at every pull, so rotating that secret rotates the credential with no re-apply. |
{{ .secrets.name }} | Rendered at apply time into a stored copy. Rotating the secret needs another apply, which then reports password: (current) → (rotated). |
| A literal | Stored encrypted. Avoid in a repository. |
Omitting password entirely is valid on an existing credential — the stored value is kept, so a
token can be managed out-of-band while the rest stays declarative. Creating one with no password
fails.
The password is never read back and never appears in a plan; a rotation is reported through an unreadable fingerprint. Deleting a credential leaves apps running — they fall back to anonymous pulls.
GitRepository
A Git credential: a repository URL and how to authenticate to it. Applications building
from source and GitSources select one by name through
repository. It is the manifest form of Sources → Git Repositories.
apiVersion: miabi.io/v1
kind: GitRepository
metadata:
name: acme-github
spec:
url: https://github.com/acme/web.git
auth: token # public | token | ssh
username: x-access-token # optional
secretRef: github-token # the Secret or SealedSecret holding the token or SSH key
| Field | Default | Description |
|---|---|---|
url | — | Required. The repository URL. |
auth | token with a secretRef, else public | public takes no secretRef; token and ssh require one. |
username | x-access-token (token), git (ssh) | The user the token or key authenticates as. |
secretRef | — | Name of a Secret or SealedSecret holding the token (auth: token) or private key (auth: ssh). |
The manifest never holds the credential itself, only the vault entry to read it from. That entry is read at every clone, so rotating the Secret rotates the credential with no re-apply. Seal it and the whole file is safe to commit:
apiVersion: miabi.io/v1
kind: SealedSecret
metadata:
name: github-token
spec:
value: sealed:v1:… # miabi secrets seal
App builds clone over HTTPS, so an application's source.repository needs auth: token. ssh works
for a GitSource, which the control plane clones itself.
GitSource
A GitOps project: a repository path of manifests the workspace keeps reconciled.
Applying one creates the project and syncs it straight away; with syncPolicy: auto it then stays in
step with Git.
apiVersion: miabi.io/v1
kind: GitSource
metadata:
name: shop
spec:
repository: acme-github # a GitRepository; or repo: <url> for a public repository
ref: main
path: deploy/shop
syncPolicy: auto
prune: true
requireSealedSecrets: true
deletePolicy: orphan
| Field | Default | Description |
|---|---|---|
repo | — | A repository URL. Set exactly one of repo and repository. |
repository | — | A GitRepository in the bundle or the workspace. It supplies the URL and the credential. |
ref | main | Branch, tag or commit. |
path | . | Directory holding the manifests, relative to the repository root. |
syncPolicy | manual | auto syncs on the three-minute sweep; manual only when asked. |
prune | false | Delete managed resources that disappear from Git. |
selfHeal | false | Re-apply when live state drifts, not only when Git changes. |
allowEmpty | false | Allow an empty manifest set to prune everything the project owns. |
requireSealedSecrets | false | Refuse a sync while any Secret carries a plaintext value. |
deletePolicy | orphan | What deleting the project does to the resources it created: orphan leaves them running, cascade tears them down. |
These are the source options of the console, plus deletePolicy.
orphan is the default so that pruning a project by mistake never takes its apps with it.
A project's name is fixed once it is created: it is the handle manifests and nested projects address it by. Renaming one in a manifest is refused — delete it and declare it again.
Nested projects
A GitSource committed to a GitOps project's own repository becomes a nested project ("app of apps"): the parent creates, updates and prunes it like any other resource, and the console shows it as declared by its parent project and locks it — change or remove it in the parent's repository.
Nesting stops at three levels (a root, its children and theirs), and a project can never declare itself or one of its parents.
Route
An HTTP routing rule: hostnames (and an optional path) to an application's port, with a TLS mode.
apiVersion: miabi.io/v1
kind: Route
metadata:
name: shop-web
spec:
hosts: # one route can answer on several hostnames
- example.com
- www.example.com
app: web # must be an Application in the same bundle
port: http # a port number, or the name of one of the app's ports
path: / # default /
rewrite: / # replace the matched prefix before the app sees it
methods: [GET, POST] # omit to accept every method
tls: # omit for HTTPS with an ACME certificate
enabled: true # false serves plain HTTP
provider: internal-ca # which certManager provider issues the ACME certificate
middlewares: # the gateway chain, IN EXECUTION ORDER
- api-ratelimit
- admin-auth
security:
exploitProtection: true # reject common injection/traversal signatures at the gateway
maintenance: # omit to serve normally
enabled: true
statusCode: 503 # 4xx or 5xx; omit for the gateway's 503
message: Back at 14:00 UTC
html: | # optional page for browsers, 64 KB max; API clients still get message
<!doctype html>
<title>Back soon</title>
<h1>We'll be right back</h1>
<p>Back at 14:00 UTC.</p>
maintenance parks the route: the gateway answers every request itself and never reaches the
backend, so the app keeps running while a migration or a deploy happens behind a deliberate
response. Because a manifest is the desired state, removing the block resumes traffic — an
apply un-parks a route that was parked by hand in the console. Details, including how the response
is rendered as plain text, JSON, or XML depending on the caller, are in
Routing & middlewares.
maintenance.html is the page browsers get instead of message. It is compared with surrounding
whitespace trimmed, so a YAML block scalar's trailing newline is not a change, and a plan shows it as
a size and hash rather than printing the page. See
An HTML page for browsers.
A parked route still reports its sync status as live: the gateway is serving it, it is simply serving your notice.
Port
port is the container port the route sends traffic to. It takes a number, or the name of one
of the target application's ports, so a route keeps working when the port number changes in one
place. A name is resolved when the manifest is parsed, and one the application does not declare is
refused. Omitted, the route uses the application's primary port.
Port names are lowercase letters, digits and dashes, contain at least one letter, and are unique
within the application; a port that serves both tcp and udp may use one name for both. A name
set in the console is kept when the manifest names no ports, and exported with the application.
TLS
The tls block decides what the route serves; the fields that are set pick the mode.
tls | What it serves |
|---|---|
omitted, or {} | A certificate the gateway issues and renews itself (ACME). |
provider: <name> | An ACME certificate from that certManager provider, for an install running more than one — a public ACME issuer and an internal CA, say. Omit it for the gateway's default. |
certificate: <name> | A certificate you imported. The name is a stored Certificate in the workspace. |
enabled: false | No TLS. The route answers plain HTTP only. |
spec:
hosts: [secure.example.com]
app: web
tls:
certificate: example-wildcard # imported out of band; see below
Certificates are not a declarable kind, and deliberately so: one carries a private key, which
does not belong in a Git repository. Import it through the console or the certificate API, then name
it here — the same rule registry follows for a pull credential. A name that matches
nothing in the workspace fails the apply rather than creating a route that claims a hostname and
serves no TLS on it.
Contradictory fields are refused when the manifest is parsed: provider together with
certificate, and either one with enabled: false.
The earlier spelling still parses: tls: acme | custom | off as a string, with certificate and
tlsProvider beside it. It plans the same as the block, so moving a manifest to the block changes
nothing on the route. Setting a field in both spellings is refused. Exports write the block.
rewrite replaces the matched path prefix before the request reaches the app, so a route on
/api can serve a backend that expects /. methods narrows the route to those HTTP methods;
omitting it accepts every method, and the order does not matter.
advancedConfig takes raw Goma route YAML and supersedes the structured fields above. It is
the escape hatch for a gateway feature the manifest does not model — prefer the fields, because
nothing validates its contents beyond it being YAML without an inline certificate.
These fields are written on every apply, so omitting one clears it. A route that had a rewrite
set in the console loses it the first time a manifest that does not mention rewrite is applied to
it. That is the desired-state contract, and the same rule maintenance follows — but it is worth
knowing before you put an existing route under GitOps. Export or copy its current settings first.
middlewares is the chain the gateway runs before the request reaches your app, and the order
is behaviour, not presentation: listing api-ratelimit before admin-auth throttles anonymous
requests, while the reverse makes every request authenticate first and rate-limits only those that
got through. Reordering the list is a real change and plans as an update.
A name does not have to be declared in the same bundle. One that is missing from it resolves
against the middlewares the workspace already has — including the defaults seeded when the workspace
was created — so a manifest can name basic-auth without owning it. A name that matches nothing at
all is refused on apply rather than stored, since a route referencing a middleware that does not
exist would render a broken gateway config.
Middleware
A gateway policy — a rate limit, basic auth, an access policy — that Routes reference by name. It is a resource of its own rather than a block inside a route because one policy is normally shared: writing the rate limit once and naming it from five routes is the point, and inlining it would leave five copies to keep in step.
apiVersion: miabi.io/v1
kind: Middleware
metadata:
name: api-ratelimit
spec:
type: rateLimit # the gateway's middleware type
paths: ["/api"] # optional: narrow it to these request paths
rule: # the type's own configuration, passed to the gateway
unit: minute
requestsPerUnit: 60
burst: 10
---
apiVersion: miabi.io/v1
kind: Middleware
metadata:
name: admin-auth
spec:
type: basicAuth
rule:
realm: Admin
users:
- username: ops
password: "{{ .secrets.ops_password }}" # a vault reference, not a literal
rule is free-form on purpose. The shape belongs to the middleware type, and the gateway's own
catalogue owns it — validating it a second time here would be a copy that drifts the moment the
catalogue gains a field. A malformed rule is refused when you apply, naming the field at fault. The
middleware reference documents every type and its rule.
Secrets in a rule are interpolated and then encrypted at rest. Write {{ .secrets.name }}
rather than a literal password, so the credential lives in the vault and the manifest is safe to
commit. They are never read back: a plan shows a rule change as rule (current) → (changed), never
the value. Rotating the secret behind the reference still converges — the engine compares a
fingerprint of the rendered rule, so a change nothing else can see is still a change.
CronJob
A command run in an application's runtime context — its image, env, networks and
volumes — on a cron schedule. metadata.name is unique in the workspace.
apiVersion: miabi.io/v1
kind: CronJob
metadata:
name: nightly-report
spec:
app: shop-api # the Application it runs in
schedule: "0 2 * * *" # 5-field cron, UTC
command: ["./shop-api", "report", "send"]
entrypoint: [] # optional: override the image's entrypoint
image: "" # optional: another image; omitted runs the app's active release
registry: ghcr # optional: Registry that pulls image (only with image)
timeoutSeconds: 900 # 0 = platform default
concurrencyPolicy: forbid # allow (default) | forbid | replace
historyLimit: 10 # finished runs kept; default 20
suspend: false # optional, see below
security:
runAsUser: "1000" # optional: omitted inherits the app's user
placement:
node: worker-2 # optional; see below
env: # optional: the run's own variables, on top of the app's
REPORT_FORMAT: pdf
SMTP_PASSWORD: "{{ .secrets.smtp-password }}"
secretEnv: [] # env keys whose literal values are stored encrypted
inheritEnv: true # false: runs get only env and MIABI_*, not the app's
| Field | Notes |
|---|---|
app | Required. Can't change: moving a schedule to another app is a delete and a create. |
schedule | Required. Checked when the plan is built, so a bad expression fails before anything applies. Missed fires while the control plane is down are not run afterwards. |
command | Required. A list of arguments, not a shell line. |
concurrencyPolicy | What a fire does while the previous run is active: start another, skip this fire, or cancel the running one. |
suspend | Only compared when stated. Leave it out and a pause made in the console survives the next sync. |
env / secretEnv | The run's own variables, added on top of the app's and replacing any of the same name. Values support interpolation as an application's env does: a secret or database credential is kept as a vault reference and resolved when the run starts. List a key under secretEnv to store a literal value encrypted. Owned by the manifest: a key removed from env is removed from the schedule. |
inheritEnv | true (default) runs with the app's and its stack's variables. false runs with only env and the MIABI_* variables, for an image that shouldn't see the app's secrets. Volumes, networks and the user are unchanged. |
placement.node | The node every run lands on, inside the app's location. Omitted, a run follows the app: its pin, else the node of its node-local volumes, else its node. A node away from a node-local volume the app mounts is refused, since the run would see an empty volume. There is no placement.location: a run always lands in its app's location. Job placement is manifest-only; the console and the job API have no node field, and a console edit keeps a manifest's pin. |
A CronJob a GitOps source owns is read-only in the console: Run now, pause and resume still work
there, but any other edit is refused with a pointer to the manifest. One created by a one-shot
miabi apply stays editable and deletable; the next apply of its manifest overwrites the edits.
Job
A declared one-off run. A Job is a run definition plus a fingerprint, so applying the same manifest twice never runs it twice, and a failed run is not retried by the next sync.
apiVersion: miabi.io/v1
kind: Job
metadata:
name: migrate
spec:
app: shop-api
command: ["./shop-api", "migrate", "up"]
runPolicy: beforeRelease # onChange (default) | once | onRelease | beforeRelease
timeoutSeconds: 600 # required for beforeRelease
historyLimit: 5
backoffLimit: 2 # retries of a failed run, 0-10; default 0
security:
runAsUser: "1000"
entrypoint, image, registry, env, secretEnv, inheritEnv and placement.node work as on a
CronJob. Changing a Job's placement.node moves its next runs without running it again.
runPolicy | Runs when | Use it for |
|---|---|---|
onChange | It is created, and whenever command, entrypoint, image, registry, runAsUser, timeoutSeconds, env or inheritEnv change | A one-off data fix: edit the command to run it again |
once | It is created. Editing those fields afterwards is refused | Seeds and bootstrap: rename the Job to run a new one |
beforeRelease | Inside each deploy of the app, in the new image, before the release starts. Applying it runs nothing | Database migrations |
onRelease | A new release of the app becomes active — from a sync, the console, a pipeline or a rollback. A new Job also runs against the current release | Cache warmers, reindexing, notifications |
Waiting for a deploy. An onChange Job applied in the same sync as an image change would
otherwise run on the old release. With waitForDeploy (the default) its run waits for the app's
deploy and starts on the release that deploy activates. If the deploy fails, the run is marked
skipped.
Before each release
beforeRelease needs Miabi 1.10.32 or later.
A beforeRelease Job is a step of the deploy. Once the new image is built or pulled, and before any
container starts or stops, the deploy runs the Job in that image with the environment the new release
will get. MIABI_RELEASE, MIABI_IMAGE and MIABI_DEPLOYMENT_ID describe the upcoming release.
- A failure fails the deploy. Nothing has started or stopped yet, so the current release keeps serving, even with the recreate strategy. The deployment log shows the Job's output, prefixed with its name.
timeoutSecondsis required, because the deploy waits for the Job.backoffLimitretries run inside the same deploy.timeoutSeconds × (backoffLimit + 1)must stay within 1800 seconds.- It runs once per deployment, never per replica, and never on a restart or a scale. A service with three replicas runs it once.
- Every new release runs it, including a redeploy with an unchanged image after an environment change, so keep migrations idempotent.
- Rollbacks, canary promotions, restarts of the active release, recoveries and location moves skip it. These put back an image that already passed its pre-release step. The skip is logged.
- A canary deploy runs it once, before the canary container starts.
- Several
beforeReleaseJobs on one app run one after another in name order, and the first failure stops the deploy. Name them10-migrateand20-seedto set the order. - An
imageruns that image instead of the release's. The plan warns that the Job then doesn't test the new code. waitForDeployandmiabi.io/skip-initial-rundon't apply and are refused.
On the first apply of a new app together with its beforeRelease Job, Miabi holds back the app's
deploy until the Job is stored, so the migration runs before the first container exists. If the Job
fails to apply, the app is not deployed.
Keep each migration compatible with the release that is still serving while it runs: add columns before the code that needs them, and drop them a release later.
onRelease runs after the new release is live. It is best effort: a failure doesn't stop the
release. Use it for work that should follow traffic.
Adopting a job that already ran. Set the annotation miabi.io/skip-initial-run: "true" and the
Job is created without running.
A failed or skipped last run marks its Git source Degraded until the Job succeeds. Run again on the Declared tab of Jobs runs it by hand without changing what the next sync does.
Domain
An owned hostname or zone: the default TLS policy routes under it inherit, and whether the claim
extends to every subdomain. The hostname is metadata.name.
apiVersion: miabi.io/v1
kind: Domain
metadata:
name: example.com
spec:
tls:
mode: acme # acme | custom (default acme)
wildcard: true # also claim *.example.com
wildcard reserves every subdomain for this workspace, so no other workspace can verify one. It
does not issue a wildcard certificate. The old string form tls: acme is still accepted.
DNS-ownership verification is a runtime action, not a declarable field: a freshly applied domain starts unverified, and you verify it after apply. Domains carry no ownership label, so a prune never deletes one.
Project
Bundles resources authored in one place. Children may be inlined under spec.resources; the parser
flattens them into the document set, so a Project is organisational — it is never itself created,
updated or pruned.
apiVersion: miabi.io/v1
kind: Project
metadata:
name: shop
spec:
description: Storefront and its dependencies
resources:
- apiVersion: miabi.io/v1
kind: Volume
metadata: { name: web-data }
spec: { size: 5Gi }
- apiVersion: miabi.io/v1
kind: Application
metadata: { name: web }
spec:
image: ghcr.io/acme/web
mounts:
- volume: web-data
path: /data
Interpolation
Application, Stack, Job and CronJob env values, a Registry password, a Middleware rule, and a
Config's file contents are rendered as templates before they are applied. Four collections are available:
| Reference | Resolves to |
|---|---|
{{ .databases.<name>.host }} | A managed database's connection details. Also .port, .user, .password, .name, .uri (or its alias .url), and, with readOnlyUser: true, .readonly_user, .readonly_password and .readonly_uri. Bare {{ .databases.<name> }} yields the URI. |
{{ .applications.<name>.url }} | Another application's address. Also .host, .port, .scheme. Bare {{ .applications.<name> }} yields the URL. |
{{ .secrets.<name> }} | A workspace secret. In env it is kept as a reference and resolved at deploy — see secrets in env. Elsewhere, its value is resolved at apply time. |
{{ .inputs.<key> }} | Marketplace templates only — see creating a template. |
Helper functions: randAlphaNum, randHex, base64, default, lower, upper.
An unresolvable reference is a hard error, never a silently empty value. Names containing hyphens
work ({{ .databases.shop-db.uri }}).
Addressing another application
An application is reachable from its siblings at its own name. Miabi registers that name as a DNS alias on every network the workspace owns, so the value you write in the manifest is the value that resolves at runtime:
kind: Application
metadata: { name: api }
spec:
image: ghcr.io/acme/api
ports: [{ container: 8080 }]
---
kind: Application
metadata: { name: web }
spec:
image: ghcr.io/acme/web
env:
API_URL: "{{ .applications.api }}" # http://api:8080
API_HOST: "{{ .applications.api.host }}" # api
API_PORT: "{{ .applications.api.port }}" # 8080
.port and .scheme come from the referenced app's first declared port. The target need not be
in the same bundle — one already in the workspace resolves too — and declaration order does not
matter, because the address is the name, not something minted at creation.
.alias also resolves, to the container's exact identity (mb-app-<token>-<id>). Prefer .host:
the alias changes if the app is recreated, and means nothing to a human reading the environment.
Private networks don't span locations, and inside a location a workspace network is a node-local bridge unless that location runs a swarm. So the name will not resolve when the two apps sit in different locations, or on different nodes of a location without a swarm. Apply refuses such a reference outright, naming both sides, rather than letting it fail as a connection error later. In a location that runs a swarm the network is an overlay spanning its nodes, and the reference is fine.
An application that has not been deployed since Miabi 1.10 does not answer to its name yet — aliases are set when a container is created. Redeploy the target once and it does.
Apps in the same Stack additionally resolve each other by name on the stack network,
which is unchanged.
Public address
Three more fields give an application's public address. They are filled in when the app that
uses them deploys, not when the manifest is applied, so they only work in env (an Application's,
a Stack's, or a Job's or CronJob's, filled in when the run starts):
kind: Application
metadata: { name: web }
spec:
image: ghcr.io/acme/web
ports: [{ container: 8080, externalAccess: true }]
env:
PUBLIC_URL: "{{ .applications.web.public_url }}" # https://shop.example.com
OAUTH_CALLBACK: "{{ .applications.web.public_url }}/auth/callback"
HOST: "{{ .apps.web.public_host }}" # shop.example.com
| Field | Value |
|---|---|
public_url | The app's custom domain (its oldest enabled Route on its port with path /), else its external-access URL |
public_host | The same, host only |
external_url | The external-access URL only |
.apps is an alias of .applications for every field. The stored value is
${{ applications.web.public_url }}, so miabi apply --diff shows no change when the base domain
changes, and the next deploy picks up the new address. A Route declared in the same bundle is
created after the application: if the app had already deployed with the external-access URL, apply
redeploys it once at the end so it starts on the custom domain.
The reference must stand alone inside its braces. Text around it is fine; a pipe such as
{{ .applications.web.public_url | upper }} is refused, because it would transform the placeholder
rather than the address. Using these fields outside env, in a Config file for example, is refused
too.
A Config whose own file format uses {{ }} sets delimiters to render on different
markers, so only the references you meant are substituted.
Secrets in env
In application and Stack env, a secret reference is never stored as its value. Apply saves it
as the vault reference ${{ secrets.NAME }}, the same form env vars
set in the console use, and the secret is read into the container each time the app deploys:
env:
JWT_SECRET: "{{ .secrets.jwt }}" # stored as ${{ secrets.jwt }}
DSN: "postgres://app:{{ .secrets.db-pw }}@{{ .databases.pg.host }}/app"
# stored as postgres://app:${{ secrets.db-pw }}@pg-host/app
API_KEY: "${{ secrets.api-key }}" # the runtime form is accepted as-is
- Rotation reaches the app. Rotating the secret redeploys every app that references it, including members that inherit it from their stack's shared env. No re-apply is needed, and the next apply reports no change.
- It can't be deleted while referenced. The vault refuses to delete a secret an app or stack env still points at.
- A typo still fails the apply. The secret must exist, or be declared in the same bundle, and
--dry-runreports an unknown name in either form. - No
secretEnvneeded. The stored value is a reference, not a secret. Listing the key undersecretEnvanyway is allowed: the reference is then stored encrypted.
A reference passed through a function, such as {{ .secrets.key | base64 }} or
{{ default "x" .secrets.key }}, can't be resolved at deploy. It is resolved at apply time and
stored as its value, still encrypted without a secretEnv entry; rotating the secret then needs another apply.
A Middleware rule and Config files resolve {{ .secrets.NAME }} at apply time; a Middleware rule
is then encrypted at rest, and a rotated secret converges on the next apply. A Config whose files set
delimiters can instead carry the runtime form ${{ secrets.NAME }}, resolved for each app that
mounts it — see configs. A Registry password
takes either form, as its table shows.
Validation rules
Beyond the per-field rules above, a bundle is refused when it is parsed if:
- an
Application'simagecarries a tag that differs from itstag; - a
DatabasesetsreadOnlyUser: trueon an engine other than PostgreSQL; - a
Registrysetspasswordwithoutusername; - a
GitRepositoryhas nourl, anauthother thanpublic,tokenorssh, asecretRefon apublicrepository, or nosecretRefon atokenorsshone; - a
GitSourcesets both or neither ofrepoandrepository, asyncPolicyother thanmanualorauto, adeletePolicyother thanorphanorcascade, or apaththat is absolute or contains..; - a
SealedSecrethas novalue, or one that is notsealed:v1:<version>:<data>; - a name is declared both as a
Secretand as aSealedSecret; - a mount
pathis not absolute, or a mount sits inside a path a volume is mounted at — the volume would shadow it; - a file
mode, on aConfigor a mount, is not 3 or 4 octal digits, or sets the setuid, setgid or sticky bit; resources.gpuis outside0–64, orresources.gpuCapabilitiesnames something other thancompute,utility,video,graphics,displayorcompat32;- a route's
methodsnames something that is not an HTTP method, or itsmiddlewareslists one name twice.
A Secret with neither value nor generate: true fails when it is created, rather than at parse. A
SealedSecret sealed for another workspace or another name fails when it is applied.
What converges, and what doesn't
The plan compares desired state against a live snapshot. Not every field participates, so a converged resource never shows phantom drift:
Diffed — image, tag, digest, the build source, command, registry, resource caps, non-secret env,
container labels, the security block, and per-port exposure (externalAccess / publish as present-or-not).
Diffed only when stated — deployment (runtime, replicas, strategy, update), placement
(location, node, constraints), each healthcheck field, stack, ports (each port's number, protocol and
scheme, in any order), each port's name, the primary port, mounts, miabiEnv and reconcile. A
manifest silent about them leaves what the console set alone, so removing stack from a manifest does
not take the app out of its stack, a manifest with no ports keeps the app's ports, and one with no
mounts keeps the volumes attached in the console. When ports is stated, the app's ports become
exactly that list; a port listed without a name keeps the name it already has. When mounts is
stated, each volume's path and readOnly, and each config's key and path, are compared, so a mount
added, moved or made read-only plans as an update.
A mounted config's content converges too: each app carries a
fingerprint of every config it mounts, so editing a file plans as an update of the app itself. An app
with reloadPolicy: none carries no fingerprint, which is how that policy is honoured.
Never diffed — secret values, and the secretEnv values in a plan (shown as (secret)). A
registry password is compared through a fingerprint, so a rotation converges without the plan
carrying anything derived from the token. A Middleware's rule works the same way: its
fingerprint covers the rendered rule, secrets included, and the plan reports only
rule (current) → (changed). A SealedSecret is compared by the fingerprint of its sealed value.
Diffed, but never echoed — a Config's files. The plan compares the content digest and reports
each changed key as (absent) → (present), so you can see which file changed without its content
landing in a log. A sensitive: true config reports the digest alone.
The auto-allocated host port and the generated external-access subdomain are live state, not manifest state — they are compared by presence, so they are never churned.
Locations
placement.location on an Application, Stack, Database or Volume is compared only when the manifest
states it, so a manifest without one never drifts. A resource is never moved: a different location
fails the apply — delete the resource and apply again.
placement.node works the same way on a Volume, DatabaseInstance or Database: compared only
when stated, and a different node fails the apply, since their data does not move. On an
Application, a stated node converges, within the limits in
pinning to a node. An export never carries a node: node names are specific to
one install.
A new application that names no location follows what it depends on: its stack's location, else the
node of a volume it mounts, else the location every database it references sits in, else the
workspace default. An app deployed next to its database needs no location of its own.
Locations are checked when the plan is built, before anything in the bundle is applied. An unknown
location, one the workspace's plan does not allow, a cordoned one, a deployment.runtime: service app in a
location that runs no swarm, or an app declared in a different location from its stack fails the
whole apply. Resources that already exist are not re-checked.
Private networks don't span locations, so an app that references an application or database in another location through interpolation, or mounts a volume there, is refused with a message naming both.
A location restricted to platform admins takes an apply only from a platform admin. A GitOps sync acts on nobody's behalf, so it never creates anything there; resources already in such a location still converge.
Exporting an application leaves out its location when that is the workspace default, so the bundle applies unchanged in another workspace.
Prune
By default, apply and GitOps only create and update: a resource removed from the manifest is left running. Opt into prune to have removals converge too.
Prune only ever deletes resources this engine created (labelled miabi.io/managed-by: gitops or
apply), so a hand-created app or a database provisioned in the console can never be removed by a
manifest. Under GitOps it is scoped further, to the project that owns the resource — two sources backed
by the same repository don't see each other's apps as orphans.
An adopted DatabaseInstance is released, not deleted, when it is
pruned.
Secret, Config, Middleware and Domain resources carry no ownership label, so neither prune nor
deleting a Git source with cascade ever removes them. Delete them explicitly — miabi delete or the
console.
miabi apply --prune (or "prune": true on the apply API) has no owning Git source, so it considers
every resource a one-shot apply created in the workspace (managed-by: apply) — not only those
this bundle created earlier. A bundle that doesn't declare them deletes them. Resources a GitOps
project owns are never pruned by it. Preview with --dry-run first.
An empty manifest set with prune enabled would delete everything the source owns. Miabi refuses it unless the source explicitly sets Allow empty, so a wiped directory or a wrong path can't tear down a workspace.
Applying
miabi apply -f stack.yaml --dry-run # print the plan, change nothing
miabi apply -f stack.yaml # converge
miabi apply -f stack.yaml --prune # converge, and remove what's gone
miabi apply -f stack.yaml --force # also change resources a GitOps project owns
miabi delete -f stack.yaml # delete exactly what the bundle names
Or over HTTP:
POST /api/v1/workspaces/{workspace}/apply
{ "manifests": "<YAML>", "prune": false, "dry_run": true, "delete": false, "force": false }
An apply that would update a resource a GitOps project owns is refused with 409, naming each one:
change it in the project's repository instead. force overrides that, and the project's next sync
reverts the change.
delete is the inverse of apply: it removes exactly the resources the bundle names, regardless of
which subsystem owns them, and ignores entries that don't exist. It honours dry_run.
A dry run also checks every {{ … }} reference — in env, registry passwords, middleware rules and
config files — and fails on one that names something neither the bundle declares nor the workspace
has, or a field it lacks:
unresolvable references:
unknown secret "db-pasword" (.secrets.db-pasword in application "web" env DB_PASS)
A reference to something the bundle creates is fine, since it exists by the time it is rendered. A real apply skips this check: it converges everything else and reports the app it cannot render. The GitOps diff view runs the same check.
Related
- GitOps — continuous reconciliation from a Git source.
- CLI —
miabi apply,miabi delete, and the rest. - Creating a marketplace template — the same resources, packaged with user inputs.