Skip to content

control-plane

The ci-accelerator control plane: a controller that collects the build history of BuildKit daemons and the CI jobs around it, and a web that serves the console, which explains every build: what came from cache, what came from another job, and why a step was rebuilt.

Part of ci-accelerator. Every role runs from one image, ghcr.io/hoobiboobi/ci-accelerator (the binary ci-accelerator), with object names prefixed by the release name (or fullnameOverride):

  • The controller (Deployment <release>-controller, one pod, Recreate): reads every daemon’s build history and the CI job pods into SQLite on its own volume (<release>-controller-data, kept when the release is removed), holds the sign-in sessions and every GitLab token, and serves its API on the Service <release>-controller over HTTPS. Callers prove who they are with a projected ServiceAccount token that the controller checks with a TokenReview (the chart adds a ClusterRole that allows only that).
  • The web (Deployment and Service <release>-web, two pods, nothing kept): serves the console’s pages and its JSON API from the controller’s API. When the controller does not answer, a page says so (502) instead of showing an empty console.
  • The build router (DaemonSet and Service <release>-router on the build nodes, on with router.enabled or global.router.enabled): CI jobs connect to it instead of to the daemons. It knows a job by its pod’s address and sends it to the daemon on the node where its project built in the last router.warmDays, else to the project’s daemon by a hash every router agrees on, within the job’s zone (router.zones, router.crossZone). It passes the bytes through: the job and the daemon keep their mutual TLS and the router holds no key, so the daemons’ certificate must name the router’s Service (the buildkit chart does with global.router.service). Its decisions are shown on the build page and the Nodes page.

The console answers one question: why an image build was slow or not cached - the change or the build farm. It works in three levels: by itself (builds, steps, cache verdicts, the pipeline timeline, comparing two builds, the daemons’ disks and caches), with a GitLab token (job results, runner waits, “files or node” by comparing commits), or with sign-in through GitLab (each person sees the projects GitLab lets them read). Without sign-in it shows everything to whoever reaches the web’s Service: keep it ClusterIP and use kubectl port-forward or an Ingress with its own authentication.

The box (charts/ci-accelerator) installs this chart on by default, router included. On its own it needs the daemons of the buildkit chart: their headless Service (daemons.discover), their CA for the controller’s client and API certificates (global.tls.issuerRef with cert-manager, or tls.existingSecret and controller.api.tls.existingSecret), the runners’ GitLab URL (gitlab.urls) and the jobs’ namespace (jobs.namespace). For a buildkit release buildkit with its own CA in the namespace ci-accelerator:

Terminal window
helm install ci-accelerator oci://ghcr.io/hoobiboobi/charts/control-plane --version 0.6.0 \
-n ci-accelerator \
--set 'gitlab.urls={https://gitlab.example.com/}' \
--set daemons.discover=buildkit-headless.ci-accelerator.svc:1234 \
--set global.tls.issuerRef.name=ci-accelerator-buildkit-ca \
--set jobs.namespace=ci-jobs

The console in the documentation explains the levels and the sign-in setup; troubleshooting has reading the logs (one JSON line per event, log.level and each role’s logLevel). Up to 0.2.x this chart was console with the image ci-accelerator-console; 0.3.0 does not upgrade a release of it in place (upgrading says how to move).

Kubernetes: >=1.34.0-0

Key Type Default Description
caches object {"every":"10m","fromConfigMap":"","key":"caches.json","stores":[]} The runners’ S3 cache (GitLab’s cache: keyword): the controller lists its folders now and then, and the console shows each project’s cache size and key count on the Nodes page, with a warning when the bucket has no lifecycle rule (the runners never delete a cache). Either the folders here (a Secret with the keys accesskey and secretkey per folder; keys that may only read are enough), or a ConfigMap with them as JSON (the box writes one). The controller may read only the Secrets named here.
caches.every string "10m" How often the folders are listed.
caches.fromConfigMap string "" Or the name of a ConfigMap whose key holds the list (fields server, bucket, region, path, instance, secret, insecure, pathStyle); the Role to read its Secrets is then the writer’s to make. Rendered with tpl.
caches.key string "caches.json" The ConfigMap’s key with the list.
commonLabels object {} Labels for every object; they cannot override the chart’s own labels.
controller.affinity object {}
controller.api.clusterDomain string "cluster.local" Cluster domain in the API certificate’s names.
controller.api.port int 8443 The API’s port.
controller.api.tls.existingSecret string "" Secret with the API’s server certificate (tls.crt, tls.key, and ca.crt that it chains to) for the name -controller; empty: issued by cert-manager from the daemons’ CA (server auth only). Needed with tls.existingSecret.
controller.logLevel string "" The controller’s log level; empty: log.level.
controller.nodeSelector object {}
controller.persistence object {"existingClaim":"","size":"10Gi","storageClass":""} The store. SQLite needs block storage (ReadWriteOnce): never NFS or another shared file system. The claim -controller-data is kept when the release is removed.
controller.podAnnotations object {}
controller.podLabels object {}
controller.resources.limits.memory string "1Gi"
controller.resources.requests.cpu string "50m"
controller.resources.requests.memory string "128Mi"
controller.tolerations list []
daemons.discover string "" host:port of the BuildKit chart’s headless Service; every address it resolves to is a daemon. Rendered with tpl.
daemons.serverName string "" Name in the daemons’ certificate. Default: the host of discover.
enabled bool false The switch the box uses (control-plane.enabled). Installed on its own, this chart ignores it.
fullnameOverride string "" Prefix of every object’s name. Default: the release name, so objects are -controller and -web.
gitlab.token object {"existingSecret":"","key":"token"} A token that can read the projects’ jobs (read_api): a Secret’s key. The controller reads with it the pipelines’ jobs (how long each waited for a runner and ran, jobs of other runners) while the console’s pages are in use, once per finished pipeline; GitLab’s comparison of two commits, which settles “files or node”; and the end of a job’s log on request. Without it, job times come from the job pods and “files or node” stays unclear. Not with sign-in: GitLab is then read with each person’s own token.
gitlab.urls list [] URLs of the GitLab instances whose jobs the runners take, exactly as the runners have them (gitlabUrl, slash included): every build’s trace id carries a hash of that string.
gitlab.urlsFrom object {"configMap":"","key":"urls"} Or read them from a ConfigMap key (comma-separated). Rendered with tpl. Mounted as a file: when the key changes, the routers take the new URLs in place and the controller starts again (within about two minutes).
global.buildNodes.enabled bool true false: ignore selector/tolerations below and run on any Linux node.
global.buildNodes.selector.“ci-accelerator.io/node-role” string "build"
global.buildNodes.tolerations[0].effect string "NoSchedule"
global.buildNodes.tolerations[0].key string "ci-accelerator.io/node-role"
global.buildNodes.tolerations[0].operator string "Equal"
global.buildNodes.tolerations[0].value string "build"
global.console.url string "" Where browsers reach the console; the default of signIn.url, and the address of the pages’ link previews.
global.router.enabled bool false
global.router.service string "" The router’s Service, for the daemons’ certificate; when set it must be this chart’s -router. Rendered with tpl.
global.tls.issuerRef.group string "cert-manager.io"
global.tls.issuerRef.kind string "ClusterIssuer"
global.tls.issuerRef.name string ""
image.digest string "" When set, the image is pulled by digest (tag is kept for readability). Under the default tag, the digest of another release is refused: set the new release’s digest on upgrade.
image.pullPolicy string "IfNotPresent"
image.repository string "ghcr.io/hoobiboobi/ci-accelerator"
image.tag string "" Default: v.
imagePullSecrets list []
jobs.namespace string "" Namespace of the CI job pods, read for job names, pipelines and commits. Empty: builds are kept without them. Rendered with tpl.
jobs.rbac object {"create":true} A Role and RoleBinding there that let the controller get, list and watch pods. Without them, give that access some other way.
log.format string "json" json, or text (key=value) for reading by eye.
log.level string "info" The least important events logged: error, warn, info (a line per stored build, job start and end, routed connection, sign-in) or debug (also every request, GitLab call and API call: for a while, to find something out). Each role’s logLevel overrides it.
nameOverride string "" Name of the app (app.kubernetes.io/name). Default: control-plane.
networkPolicy.deniedComponents list ["buildkit"] Pods of this namespace whose ci-accelerator.io/component label is one of these may not reach the web: the daemons, whose network every build shares.
networkPolicy.deniedNamespaces list [] More namespaces whose pods may not reach the web (the jobs namespace is always one when jobs.namespace is set). Rendered with tpl.
networkPolicy.enabled bool false Render the NetworkPolicies: the web admits connections from every namespace except this one, the jobs namespace and deniedNamespaces, and from pods of this namespace except deniedComponents; the controller admits only the web and the routers; the routers admit only their clients’ namespaces. Only ingress is limited.
networkPolicy.extraFrom list [] More NetworkPolicyPeer entries that may reach the web, e.g. an ipBlock with the node addresses when the Ingress controller runs on the host network.
reasons.trustGitComparison bool false Count a rebuild as the build farm’s when GitLab’s comparison of the commits shows no change in the files its first rebuilt step copies (or the image’s previous build built the same commit). Off: such a rebuild is unclear, because the comparison sees only the repository while a build context also holds what the job made or downloaded (CI artifacts, generated files). Turn it on only when your build contexts hold repository files alone. Switching it either way recounts the stored builds; GitLab is not asked again. Builds from a git context (the CI component’s context-source: git) are decided by the comparison either way, counting only the files in the context’s folder.
retention.days int 30 Days builds are kept in full (steps, reasons). Each image’s daily figures (builds by outcome, build times) are kept a year regardless. At 150 pipelines a day with 15 image builds each, a project takes about 0.25 GB per 30 days.
retention.outputDays int 7 Days the steps’ output is kept.
router.clientNamespaces list [] Namespaces whose pods may connect to the router; default: the jobs namespace. Rendered with tpl.
router.crossZone bool true When no daemon of the job’s zone is ready: true sends the job to another zone’s daemon, false refuses the connection. A job on a node that never had a daemon has no known zone: every daemon is its zone.
router.drainSeconds int 300 Seconds open connections (running builds) may finish when a router stops; the pod’s grace period is this plus preStopSleepSeconds and 10.
router.enabled string nil Run the router; default: global.router.enabled (the box sets it; in the box leave this unset and switch global.router.enabled). The runners then use tcp://-router..svc:1234, and the daemons’ certificate must name that Service (the buildkit chart does with global.router.service).
router.healthPort int 8080 The port of /livez and /readyz.
router.logLevel string "" The router’s log level; empty: log.level.
router.nodeSelector object {} Merged over global.buildNodes.selector.
router.overloadBuilds int 0 Skip a daemon running this many builds when another one is free; 0: never (a busy warm daemon is usually still faster than a cold one).
router.podAnnotations object {}
router.podLabels object {}
router.preStopSleepSeconds int 5 Seconds a stopping router keeps accepting while the Service drops it.
router.priorityClassName string "" PriorityClass of the router pods; the box gives them the daemons’.
router.resources.limits.memory string "256Mi"
router.resources.requests.cpu string "20m"
router.resources.requests.memory string "32Mi"
router.routing string "PreferSameNode" How the Service picks a router: PreferSameNode (the job’s node, any other when it has none ready), Local (the job’s node only) or Cluster.
router.tolerations list [] Appended to global.buildNodes.tolerations.
router.warmDays int 7 Days a build keeps its project warm on its node (at most retention.days: older builds are gone).
router.zones bool true Keep a job’s builds in its zone (topology.kubernetes.io/zone of the daemons’ nodes): a project then warms up once per zone. false: every daemon is one zone (zones close enough that crossing them costs nothing, or one zone label per node).
signIn object {"enabled":false,"gitlab":[],"sessionKey":{"existingSecret":"","key":"key"},"url":""} Sign-in through GitLab. Each person signs in with a GitLab the runners serve and sees the projects whose jobs GitLab lets them read (Reporter or more, or public pipelines); GitLab is read with their own token. GitLab never calls the console: the browser carries the redirects.
signIn.gitlab list [] One OAuth application per GitLab (User or Group Settings > Applications, or Admin > Applications on your own GitLab): confidential, scopes openid and read_api, redirect URI /auth/callback/ (the NOTES and the controller’s log print it). url: exactly as the runners have it; may be left empty when the console serves one GitLab existingSecret: a Secret with the keys client-id and client-secret admins: who sees everything (builds of no known project, the JSON API): “id:” (on the person’s GitLab profile page). Usernames are refused: GitLab gives one that was renamed or deleted to the next account that takes it
signIn.sessionKey object {"existingSecret":"","key":"key"} A Secret holding 32 random bytes in base64 (openssl rand -base64 32); it seals each session’s GitLab token. Changing it signs everyone out. With Flux or Argo CD (SOPS, Sealed Secrets, External Secrets): docs/gitops.md, “The session key”.
signIn.url string "" Where browsers reach the console: https (an Ingress or a gateway you add), or http only on localhost (a port-forward). Default: global.console.url. Rendered with tpl.
tls.certManager.duration string "8760h"
tls.certManager.issuerRef object {"group":"cert-manager.io","kind":"ClusterIssuer","name":""} Default: global.tls.issuerRef. Rendered with tpl.
tls.certManager.renewBeforePercentage int 33
tls.existingSecret string "" Secret with the controller’s client certificate (ca.crt, tls.crt, tls.key) signed by the daemons’ CA; empty: issued by cert-manager.
web.affinity object {}
web.logLevel string "" The web’s log level; empty: log.level.
web.nodeSelector object {}
web.podAnnotations object {}
web.podLabels object {}
web.port int 8080 The port of the pages and the JSON API.
web.replicas int 2 Pods serving the pages.
web.resources.limits.memory string "256Mi"
web.resources.requests.cpu string "20m"
web.resources.requests.memory string "48Mi"
web.tolerations list []