bb-worker-operator
by Hermetiq
Buildbarn worker pool operator for Kubernetes
About this chart
BB Worker Operator Helm Chart
Installs the Buildbarn worker operator and the rbeworkers.bb.hermetiq.com CRD.
Use the repository's
installation guide for the
supported full-stack deployment order.
Contents
- Install
- Verify
- CRD Lifecycle
- Replacing the CRD from scratch
- Upgrading to 1.0.0
- Upgrading to 0.3.12
- Upgrading to 0.3.11
- RbeWorker Pools
- Configuration modes
- Completed-action logger address
- FUSE build directories
- Draining actions on termination
- Docker-capable workers
- KEDA Autoscaling
- Private pools
- Scaling to zero
- Tuning generated autoscaling
- Diagnose a pool that does not scale
- Security Context
- RbeWorker Spec Policy
- Keeping the previous behavior
- RBAC Scope
- Observability
- Local chart development
- License
Install
The Buildbarn release and its RbeWorker pools must share a namespace. FUSE
workers need privileged containers, so if Pod Security Admission enforces a
restrictive policy, allow privileged Pods in that namespace before applying
the worker pools:
kubectl label namespace hermetiq pod-security.kubernetes.io/enforce=privileged --overwrite
Use dedicated worker nodes. A Hermetiq release installed in a separate
namespace can retain restricted admission there. Install the
namespace-scoped operator alongside Buildbarn so it reconciles their shared
worker pools.
Start with the operator starter values, copied as described in the repository setup guide. Run the commands below from inside your copied values directory.
Inspect this release's packaged documentation and defaults before editing the operator values:
helm show readme oci://ghcr.io/hermetiq/bb-worker-operator --version 1.0.0
helm show values oci://ghcr.io/hermetiq/bb-worker-operator --version 1.0.0
For a namespace-scoped install, set rbac.mode=namespace and
metrics.secure=false in the values file. Have a cluster administrator apply
the CRD from the matching release tag:
kubectl apply --server-side -f \
https://raw.githubusercontent.com/Hermetiq/hermetiq-k8s/bb-worker-operator-v1.0.0/charts/bb-worker-operator/crds/bb.hermetiq.com_rbeworkers.yaml
kubectl wait --for=condition=Established crd/rbeworkers.bb.hermetiq.com --timeout=60s
Then install the controller in the namespace:
helm upgrade --install --namespace hermetiq bb-worker-operator \
oci://ghcr.io/hermetiq/bb-worker-operator \
--version 1.0.0 \
--skip-crds \
--values bb-worker-operator-values.yaml
See RBAC Scope for the remaining namespace-mode requirements.
If the Helm installer can create cluster-scoped resources, the separate CRD
step is optional: omit --skip-crds and Helm installs the CRD on the first
install. For later upgrades, apply the updated CRD separately before upgrading
the chart.
Keep the CRD and controller image on the same release. Leave image.tag empty
so the image follows the chart's appVersion: the CRD is what accepts a field
and the controller is what acts on it, so a controller older than the CRD
silently ignores fields it does not know.
Verify
kubectl wait --for=condition=Established crd/rbeworkers.bb.hermetiq.com --timeout=60s
kubectl -n hermetiq rollout status deployment/bb-worker-operator --timeout=120s
kubectl -n hermetiq get rbeworkers
kubectl get rbeworkers is empty until you apply worker pools, which depend on
the buildbarn-worker-config ConfigMap rendered by the Buildbarn chart. Start
from the
sample worker pools
under rbeworkers/ in your copied values directory. Once pools exist, each
RbeWorker reports the Deployment, ConfigMap, and KEDA ScaledObject it
manages in its status.
When podDisruptionBudget.enabled=true, the chart sets
unhealthyPodEvictionPolicy: AlwaysAllow. Node drains can evict an unready
operator Pod even when its healthy Pod budget is exhausted.
Once the CRD is established and the operator Deployment is ready, continue with installing Buildbarn and its worker pools.
CRD Lifecycle
RbeWorker is a cluster-wide Kubernetes API, even when the operator watches
only one namespace. Its CRD is packaged in the chart's crds/ directory:
charts/bb-worker-operator/crds/bb.hermetiq.com_rbeworkers.yaml
The recommended way to install or upgrade the CRD is to apply the versioned file and wait for Kubernetes to establish it. This example uses release 1.0.0; use the target chart's release tag when upgrading:
kubectl apply --server-side -f \
https://raw.githubusercontent.com/Hermetiq/hermetiq-k8s/bb-worker-operator-v1.0.0/charts/bb-worker-operator/crds/bb.hermetiq.com_rbeworkers.yaml
kubectl wait --for=condition=Established crd/rbeworkers.bb.hermetiq.com --timeout=60s
On a first install, Helm installs the CRD before the controller if you omit
--skip-crds and the installer has cluster-wide permissions. The
namespace-scoped path in Install instead has a cluster administrator
apply the CRD, then installs the controller with --skip-crds.
On an upgrade, run the CRD command above before upgrading the chart or
applying RbeWorker manifests that use new fields. Helm does not upgrade CRDs in
crds/ during helm upgrade, even when the chart contains a newer schema.
If Helm created the CRD on the first install, kubectl can stop with a
conflict against the helm field manager on .spec.versions. The new schema
is meant to replace the old one, so run the same command again with
--force-conflicts added.
Keep the chart and CRD at the same version, and leave image.tag empty so the
controller follows the chart's appVersion. A newer CRD may accept fields
that an older controller cannot act on.
On uninstall, Helm leaves the CRD in place. Deleting that CRD also deletes
all RbeWorker objects in the cluster, so remove it only when you intend to
retire the API and those worker pools.
If upgrading from a release before 0.3.3, the target release's CRD includes
updated Pod and volume schemas. If upgrading from a release before 0.3.4,
remove spec.autoscaling.prometheus.projectID from RbeWorker manifests and
Kustomize patches before reapplying them; the CRD no longer accepts that field.
Generated queries now use the RbeWorker namespace, so each worker must share
a namespace with the Buildbarn scheduler it scales on.
For a rendered install bundle, pass --include-crds to helm template as shown
in Local chart development; Helm omits CRDs from
its default template output.
Replacing the CRD from scratch
Updating the CRD in place, as above, is the normal path. To replace it from
scratch instead, delete it and apply the new one. Deleting the CRD deletes
every RbeWorker in the cluster, and Kubernetes then garbage-collects each
pool's Deployment, generated ConfigMap, and ScaledObject, so keep your
RbeWorker manifests to re-apply afterward.
# 1. Stop the controller so it does not react while the API disappears.
kubectl -n hermetiq scale deployment/bb-worker-operator --replicas=0
# 2. Delete the old CRD. This deletes existing RbeWorker objects too.
kubectl delete crd rbeworkers.bb.hermetiq.com --wait=true --ignore-not-found
# 3. Apply the CRD from the release you are installing, and wait for it.
kubectl apply --server-side -f \
https://raw.githubusercontent.com/Hermetiq/hermetiq-k8s/bb-worker-operator-v1.0.0/charts/bb-worker-operator/crds/bb.hermetiq.com_rbeworkers.yaml
kubectl wait --for=condition=Established crd/rbeworkers.bb.hermetiq.com --timeout=60s
# 4. Upgrade or restart the controller on the same release.
helm upgrade --install --namespace hermetiq bb-worker-operator \
oci://ghcr.io/hermetiq/bb-worker-operator \
--version 1.0.0 \
--skip-crds \
--values bb-worker-operator-values.yaml
Then re-apply your RbeWorker manifests.
Upgrading to 1.0.0
Chart 1.0.0 follows 0.3.12; the chart version now moves together with the
Hermetiq and Buildbarn charts, and no chart was published in between. It
deploys operator v1.0.0, which generates worker configuration for Buildbarn's
content-defined chunking (CDC) storage and nothing else. Run it only with the
Buildbarn 1.0.0 chart. Against an older Buildbarn release a worker stops at
startup with common.libsonnet is not a CDC Buildbarn configuration.
Upgrade the operator inside the Buildbarn
cut-over window,
after the worker pools are paused and before the Buildbarn upgrade. Nothing
enforces the order. The Buildbarn chart does not check which operator is
running: an operator older than v1.0.0 generates pre-CDC worker
configuration, the CDC bb-worker rejects it, and the pools crash-loop until
the operator is upgraded.
-
Apply the 1.0.0 CRD first.
spec.images.workerandspec.images.runnerInstallerbecome optional: when unset, the operator uses theworkerImageandrunnerInstallerImagekeys of the referenced config ConfigMap, which the Buildbarn chart publishes, so worker images follow the Buildbarn release. -
Before the Buildbarn upgrade, remove pre-CDC image pins from each
RbeWorkeror update them to the CDC images. The Buildbarn chart refuses to upgrade while a liveRbeWorkerpins a pre-CDC image. A pool without pins reportsSpecInvaliduntil Buildbarn 1.0.0 has published the two keys; with the pools paused that has no effect. -
The embedded
worker-common.libsonnetchanged, so every generated-config worker pool is rolled as soon as the new operator reconciles it, on every pool at once. A pool that is not paused restarts its workers into the new configuration; actions that outlast the pod's termination grace period are killed (see Draining actions on termination). A pool withspec.config.rolloutOnChange: falseis not rolled and picks the new file up when its Pods next restart. -
To stop a pool for the cut-over, pause it on the
RbeWorker. Whilespec.autoscaling.enabledis true,spec.replicasis ignored: the operator leaves the Deployment's replica count to KEDA. A pause annotation set directly on theScaledObjectdoes not last either, because the operator replaces that object's annotations withspec.autoscaling.scaledObjectAnnotationson every reconcile. Set KEDA's pause annotation there, and remove it again to resume:spec: autoscaling: scaledObjectAnnotations: autoscaling.keda.sh/paused-replicas: "0"A pool without autoscaling stops with
spec.replicas: 0. Withspec.manageReplicas: falsethe operator sets neither, and you scale the Deployment or its external scaler yourself. -
Rolling Buildbarn back to a pre-CDC chart means rolling this chart back to 0.3.12 as well, because operator v1.0.0 cannot generate pre-CDC worker configuration. The pre-CDC Buildbarn chart does not publish
workerImageandrunnerInstallerImage, so setspec.images.workerandspec.images.runnerInstallerback to the pre-CDC images on eachRbeWorkeras part of the rollback. -
A pool that projects its own copy of
worker-common.libsonnetthroughcommonItemsis read by the Buildbarn chart's configuration text check like any other worker configuration, and is refused if it contains pre-CDC fields. Replace a copy taken from an older operator with one based on this operator's built-in file.
When upgrading from 0.3.11 or earlier, also follow Upgrading to 0.3.12.
Upgrading to 0.3.12
Chart 0.3.12 deploys the same operator v0.3.13 as 0.3.11 and has the same CRD. The default image is now pinned to its SHA-256 manifest digest, so the operator Deployment rolls once on upgrade. Worker pools are not restarted.
image.digest takes precedence over image.tag. If you override image.tag,
also set image.digest to that image's digest, or clear it with
--set-string image.digest=. Otherwise the operator keeps running the pinned
v0.3.13 image. See image integrity.
When upgrading from 0.3.10 or earlier, also follow Upgrading to 0.3.11.
Upgrading to 0.3.11
Chart 0.3.11 deploys operator v0.3.13, which stops reconciling an RbeWorker
in two new cases. It sets Ready=False and leaves that pool's existing
Deployment and ScaledObject as they are, so running workers keep running and
autoscaling, but changes to the RbeWorker no longer reach them:
SpecInvalid: the spec asks for something the RbeWorker Spec Policy does not allow, such as ahostPathCAS volume outside the allowed prefixes.NameConflict: a Deployment, generated ConfigMap orScaledObjectwith the pool's name exists but is not controlled by thisRbeWorker, orspec.config.generated.commonConfigMapNameis<name>-config. Objects the operator created already carry the right owner reference. A conflict usually means theRbeWorkerwas deleted with `--cascade=orphan
Deploy bb-worker-operator with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has bb-worker-operator on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartbb-worker-operator is pinned at v1.0.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply