kurly
A bookstore of Kubernetes workload recipes, written in Jsonnet on top of
k8s-libsonnet. Start from a
kind (http, worker, cron, daemon), then add capabilities as composable
+ features — the result is a set of manifests with the Pod Security Standards
restricted profile baked in.
local kurly = import 'github.com/metio/kurly/main.libsonnet';
kurly.list(
kurly.http('storefront', 'docker.io/nginxinc/nginx-unprivileged:1.31')
+ kurly.replicas(3)
+ kurly.expose.gateway('storefront.example.com', 'shared-gateway')
)
Ready-made workloads
Around three hundred applications already have a recipe under
workloads/ — Immich, Mastodon, Keycloak, PostgreSQL, Grafana and
the rest. Each stage is a function(params) returning a composable app, so it is
a starting point rather than a fixed deployment: import it, adapt it with the
same + features, and render it.
local kurly = import 'github.com/metio/kurly/main.libsonnet';
local immich = import 'github.com/metio/kurly/workloads/immich/server.libsonnet';
kurly.list(
immich(dbHost='immich-db-rw')
+ kurly.replicas(2)
+ kurly.expose.gateway('photos.example.com', 'shared-gateway')
)
Each workload states how far it has been proven. e2e means the recipe was
deployed to a live cluster and observed becoming ready — not that a test exists
for it; the record of those runs lives in
catalog/e2e-verified.libsonnet.
The catalog
The catalog describes every workload, kind, feature and exposure recipe in
machine-readable form. It is published in two halves, and neither is an aggregate
file: each workload's facts ride on that workload's OWN artifact as an OCI
referrer, pinned by the same digest as the bits they describe, while everything
that is not about one workload — the closed vocabularies, the library's API model,
the exclusions — is library.json, the single layer of
ghcr.io/metio/kurly/library. Both come out with oras pull and no Jsonnet
toolchain.
Splitting it this way is what keeps a consumer's facts tied to the images it
pinned: read from one file naming every workload, they came from whatever build
produced that file instead. It also removed a single line every change had to
touch, which had been conflicting on every dependency-update PR.
library.json has its own repository rather than riding beside the workloads for
the same reason: its digest must move when a vocabulary moves, not every time an
unrelated workload is released. A consumer reading only the vocabularies would
otherwise re-pin several times a day for changes it cannot see.
Locally the whole thing renders to .build/catalog.json, a build artifact with no
committed copy — gen-catalog writes it and every gate renders it fresh.
Most of what it carries is derived from the recipes themselves and recomputed on
every build, so it cannot drift from what they render: the volumes a stage claims,
its security posture, whether it is a cluster add-on rather than something a
tenant runs, which bollwerk policies it breaks and the BSI
requirements those implement, and the values behind the named resource sizes. The
rest is stated deliberately — what kind of software a workload is, the external
infrastructure it needs, the Secret keys it reads, and what the software is
called and where it lives, where those have been established.
A licence is checked against the SPDX register rather than accepted as written,
and travels with whether it is OSI-approved and whether the identifier is one
SPDX has deprecated — GPL-3.0 says neither -only nor -or-later, and that
ambiguity is reported rather than resolved by guessing. What an image's own
labels claim is published separately, under image, because a label documents
the image and not the software: it names base images and taglines as often as
products, and points at whoever built the image, which for a packaged image is
not the project that wrote it. A fact nobody has checked is left absent rather
than guessed.
Private registries
A cluster that pulls from a private registry needs two things: the images pointed
at it, and the credentials to pull them.
kurly.mirror('harbor.internal/dockerhub', kurly.list(
cache() + kurly.imagePullSecrets(['regcred'])
))