Skip to content

Commit 05c036c

Browse files
committed
fix(sandbox): harden the chart, image publishing, and docs from the final audit
- Admission policy enforces the sandbox pod shape without Pod Security: emptyDir-only volumes, no sysctls, no privilege escalation, only the six agent capabilities, no hostPort, Default procMount, no Unconfined seccomp - Refuse namespace.create=false with the admission policy off - restricted egress defaults DNS to the kube-dns pods; internet keeps port 53 - Block Azure WireServer and the NAT64 prefixes in the internet profile - Merge sandbox-images and sandbox-kubernetes-e2e into one sandbox workflow: images built once per PR and reused by both e2e jobs, publishing only from main and staging, signer identity pinned to those refs, release and daily verification, a separate app image cache key, wider path filters - OCI source labels on the sandbox images; regenerate their tags - Docs: per-cloud quick start, install verification, image verification and air-gapped tags, network policy limits, podPidsLimit
1 parent 15d268d commit 05c036c

20 files changed

Lines changed: 1563 additions & 1151 deletions

File tree

‎.github/actions/image/action.yml‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@ inputs:
3535
description: Dockerfile stage to build. Empty builds the final stage.
3636
required: false
3737
default: ''
38+
cache-key-suffix:
39+
description: >-
40+
Appended to the Blacksmith layer cache key, so a caller that must not share
41+
the deploy pipeline's sticky disk (a pull request build) gets its own. Empty
42+
keeps the shared key.
43+
required: false
44+
default: ''
3845
max-cache-size-mb:
3946
description: >-
4047
Layer cache to retain after this action prunes, in MB. Must stay above one
@@ -66,7 +73,8 @@ runs:
6673
env:
6774
FILE: ${{ inputs.file }}
6875
PLATFORMS: ${{ inputs.platforms }}
69-
run: echo "value=${GITHUB_REPOSITORY##*/}/${FILE#./}/${PLATFORMS//\//-}" >> "$GITHUB_OUTPUT"
76+
SUFFIX: ${{ inputs.cache-key-suffix }}
77+
run: echo "value=${GITHUB_REPOSITORY##*/}/${FILE#./}/${PLATFORMS//\//-}${SUFFIX}" >> "$GITHUB_OUTPUT"
7078

7179
# This action does NOT bound the disk — see the prune step below. BuildKit's
7280
# own GC is time-based only (layers unused for 8 days), and these disks are
Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
name: k3s-image
22
description: >-
33
Put one image into the local k3s containerd, so pods start from it without a
4-
registry, from an artifact an earlier job uploaded: a `ref` file naming the image,
5-
plus its `docker save` archive as `image.tar`. With `kind`, a sandbox image at the
6-
content-addressed reference images.generated.json names, from the workflow's
7-
`sandbox-image-<kind>` artifact: imported from its archive when the workflow built
8-
the image, else pulled from GHCR, where that reference already holds the same
9-
image. With `artifact` and `tag`, an image built from this checkout, always
10-
imported from its archive.
4+
registry. With `kind`, a sandbox image at the content-addressed reference
5+
images.generated.json names: with `archive: 'true'`, imported from the workflow's
6+
`sandbox-image-<kind>` artifact (a `ref` file naming the image, plus its
7+
`docker save` archive as `image.tar`), else pulled from GHCR, where that
8+
reference already holds the same image. With `artifact` and `tag`, an image built
9+
from this checkout, imported from that artifact in the same layout.
1110
1211
inputs:
1312
kind:
1413
description: Sandbox image kind in images.generated.json (agent, function, pi). Instead of artifact and tag.
1514
required: false
1615
default: ''
16+
archive:
17+
description: With kind, 'true' when the workflow built the image and uploaded its archive.
18+
required: false
19+
default: 'false'
1720
artifact:
1821
description: Name of the artifact holding the image. Needs tag.
1922
required: false
@@ -36,14 +39,17 @@ runs:
3639
shell: bash
3740
env:
3841
KIND: ${{ inputs.kind }}
42+
ARCHIVE: ${{ inputs.archive }}
3943
ARTIFACT: ${{ inputs.artifact }}
4044
TAG: ${{ inputs.tag }}
4145
MANIFEST: apps/sim/lib/execution/remote-sandbox/kubernetes/images.generated.json
4246
run: |
4347
set -euo pipefail
4448
if [ -n "$KIND" ] && [ -z "$ARTIFACT" ] && [ -z "$TAG" ]; then
4549
echo "ref=$(jq -er --arg kind "$KIND" '.[$kind]' "$MANIFEST")" >> "$GITHUB_OUTPUT"
46-
echo "artifact=sandbox-image-${KIND}" >> "$GITHUB_OUTPUT"
50+
if [ "$ARCHIVE" = "true" ]; then
51+
echo "artifact=sandbox-image-${KIND}" >> "$GITHUB_OUTPUT"
52+
fi
4753
elif [ -z "$KIND" ] && [ -n "$ARTIFACT" ] && [ -n "$TAG" ]; then
4854
echo "ref=${TAG}" >> "$GITHUB_OUTPUT"
4955
echo "artifact=${ARTIFACT}" >> "$GITHUB_OUTPUT"
@@ -52,31 +58,32 @@ runs:
5258
exit 1
5359
fi
5460
61+
- name: Pull image
62+
if: steps.ref.outputs.artifact == ''
63+
shell: bash
64+
env:
65+
IMAGE: ${{ steps.ref.outputs.ref }}
66+
run: sudo k3s crictl pull "$IMAGE"
67+
5568
- name: Download image
69+
if: steps.ref.outputs.artifact != ''
5670
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
5771
with:
5872
name: ${{ steps.ref.outputs.artifact }}
5973
path: ${{ runner.temp }}/${{ steps.ref.outputs.artifact }}
6074

6175
- name: Import image
76+
if: steps.ref.outputs.artifact != ''
6277
shell: bash
6378
env:
6479
DIR: ${{ runner.temp }}/${{ steps.ref.outputs.artifact }}
6580
IMAGE: ${{ steps.ref.outputs.ref }}
66-
KIND: ${{ inputs.kind }}
6781
run: |
6882
set -euo pipefail
6983
if [ "$(cat "${DIR}/ref")" != "$IMAGE" ]; then
7084
echo "::error::The ${DIR##*/} artifact holds $(cat "${DIR}/ref"), not ${IMAGE}"
7185
exit 1
7286
fi
73-
if [ -f "${DIR}/image.tar" ]; then
74-
sudo k3s ctr -n k8s.io images import "${DIR}/image.tar"
75-
elif [ -n "$KIND" ]; then
76-
sudo k3s crictl pull "$IMAGE"
77-
else
78-
echo "::error::The ${DIR##*/} artifact has no image archive"
79-
exit 1
80-
fi
87+
sudo k3s ctr -n k8s.io images import "${DIR}/image.tar"
8188
rm -rf "$DIR"
8289
df -h /

‎.github/sandbox-kubernetes-e2e/app-values.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Helm values for the full-stack job in .github/workflows/sandbox-kubernetes-e2e.yml,
1+
# Helm values for the e2e-app job in .github/workflows/sandbox.yml,
22
# layered on helm/sim/ci/default-values.yaml and values.yaml. The app, migrations,
33
# and sandbox images are built from this checkout and imported into k3s under these
44
# references, so nothing is pulled for them. Secrets are passed with --set from

‎.github/sandbox-kubernetes-e2e/values.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Helm values for .github/workflows/sandbox-kubernetes-e2e.yml, layered on
1+
# Helm values for the e2e jobs in .github/workflows/sandbox.yml, layered on
22
# helm/sim/ci/default-values.yaml. Rendered with envsubst for NODE_IP (the
33
# runner, which pods reach at that address) and ALLOWED_PORT (the live suite's
44
# stand-in object store). Dummy sizing for one CI node; never use in a deployment.

0 commit comments

Comments
 (0)