Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ The table below is generated from `values.yaml`. Boilerplate keys (resources, sc
| launcher.affinity | object | `{}` | |
| launcher.clusterCIDRs | list | `[]` | Pod and service CIDRs job pods may not reach, IPv4 and IPv6 (the API and DNS stay open) |
| launcher.createJobNamespace | bool | `false` | Create `jobNamespace`, enforcing the restricted Pod Security Standard |
| launcher.driver | string | `"kubernetes"` | Where jobs run: `kubernetes` (a pod per job in its engine's job image) or `inprocess` (one launcher Deployment per engine, running each job inside its pod, from that engine's job image) |
| launcher.driver | string | `"kubernetes"` | Where jobs run: `kubernetes` (a pod per job in its engine's job image) or `inprocess` (one launcher Deployment per engine, running each job inside its pod, from that engine's job image). Only `kubernetes` mounts the launcher ServiceAccount token and binds its Role in the job namespace |
| launcher.env | object | `{}` | Extra environment variables of the launcher |
| launcher.extraJobEgress | list | `[]` | Extra egress rules (NetworkPolicy `to` and `ports`) for job pods, appended as given: a destination inside clusterCIDRs that jobs must reach, such as an internal registry |
| launcher.healthPort | int | `9090` | Port of the launcher's /healthz and /readyz |
Expand Down
12 changes: 12 additions & 0 deletions chart/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,17 @@ rewrite ^{{ $site.basePath }}(/.*)$ $1 last;
{{- printf "%s-launcher" (include "stackweaver.fullname" .) }}
{{- end }}

{{/* "true" when the launchers place jobs through the Kubernetes driver, "" for the in-process
driver. Only the Kubernetes driver calls the Kubernetes API, so only it gets the launcher
ServiceAccount's token and Role. Any other launcher.driver fails the render. */}}
{{- define "stackweaver.launcher.kubernetesDriver" -}}
{{- $d := .Values.launcher.driver }}
{{- if not (has $d (list "kubernetes" "inprocess")) }}
{{- fail (printf "launcher.driver=%q is not supported by this chart: use kubernetes or inprocess" (toString $d)) }}
{{- end }}
{{- if eq $d "kubernetes" }}true{{ end }}
{{- end }}

{{/* The namespace job pods run in: launcher.jobNamespace, else the release's. */}}
{{- define "stackweaver.launcher.jobNamespace" -}}
{{- .Values.launcher.jobNamespace | default .Release.Namespace }}
Expand Down Expand Up @@ -870,6 +881,7 @@ spec:
spec:
{{- include "stackweaver.imagePullSecrets" $root | nindent 6 }}
serviceAccountName: {{ include "stackweaver.launcher.serviceAccountName" $root }}
automountServiceAccountToken: {{ include "stackweaver.launcher.kubernetesDriver" $root | eq "true" }}
# Outlasts the launcher's drain, so a rollout lets its jobs finish (launcher.terminationGracePeriodSeconds).
terminationGracePeriodSeconds: {{ $root.Values.launcher.terminationGracePeriodSeconds }}
securityContext:
Expand Down
2 changes: 1 addition & 1 deletion chart/templates/launcher/launcher-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
in a fresh pod of its own in the job namespace through the Kubernetes driver, in that engine's
job image. It holds no database, storage, Redis, encryption, OIDC signing or VCS app secret,
mounts no volume of jobs, and runs no user code. */}}
{{- if ne .Values.launcher.driver "inprocess" }}
{{- if include "stackweaver.launcher.kubernetesDriver" . }}
{{- $l := include "stackweaver.launcher.values" . | fromYaml }}
{{- include "stackweaver.launcher.deployment" (dict "root" . "name" (printf "%s-launcher" (include "stackweaver.fullname" .)) "engine" "" "engines" "" "image" (printf "%s:%s" $l.image.repository $l.image.tag) "pullPolicy" $l.image.pullPolicy "tmpSize" "256Mi" "values" $l) }}
{{- end }}
8 changes: 6 additions & 2 deletions chart/templates/launcher/launcher-rbac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@
listed, created by server-side apply (create and patch) and deleted; pod logs and the pod
template ConfigMap are read. No exec, and no NetworkPolicy write: the chart owns the job
namespace's policies (job-networkpolicy.yaml) and tells the launchers to leave them
(RUNNER_MANAGE_NETWORK_POLICY=false). */}}
(RUNNER_MANAGE_NETWORK_POLICY=false). The in-process driver never calls the Kubernetes API, so
under it the ServiceAccount mounts no token and the Role and RoleBinding are not rendered. */}}
{{- $k8s := include "stackweaver.launcher.kubernetesDriver" . | eq "true" }}
apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "stackweaver.launcher.serviceAccountName" . }}
labels:
{{- include "stackweaver.labels" . | nindent 4 }}
app.kubernetes.io/component: launcher
automountServiceAccountToken: true
automountServiceAccountToken: {{ $k8s }}
{{- if $k8s }}
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
Expand Down Expand Up @@ -46,3 +49,4 @@ subjects:
- kind: ServiceAccount
name: {{ include "stackweaver.launcher.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
3 changes: 2 additions & 1 deletion chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ orchestrator:
# job alone.
launcher:
# -- Where jobs run: `kubernetes` (a pod per job in its engine's job image) or `inprocess` (one
# launcher Deployment per engine, running each job inside its pod, from that engine's job image)
# launcher Deployment per engine, running each job inside its pod, from that engine's job image).
# Only `kubernetes` mounts the launcher ServiceAccount token and binds its Role in the job namespace
driver: kubernetes
# -- Job network: `platform` (node metadata blocked) or `host-identity` (the node's identity reachable)
network: platform
Expand Down
Loading