Route iuclabs runner package installs through artifactapi
ci/woodpecker/pr/kubeconform Pipeline failed
ci/woodpecker/pr/pre-commit Pipeline was successful

- add an artifactapi component setting pip, uv, go, npm, yarn and corepack registry env on every runner
- build a combined public + internal CA bundle in an init container and point SSL_CERT_FILE/REQUESTS_CA_BUNDLE at it
- allow every runner egress to traefik-internal on 443, replacing the dind and build copies
This commit is contained in:
2026-11-28 14:10:51 +11:00
parent d42e7ebe61
commit d87718bdcb
7 changed files with 109 additions and 15 deletions
@@ -0,0 +1,4 @@
---
- op: add
path: /spec/template/spec/initContainers
value: []
@@ -0,0 +1,33 @@
---
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component
resources:
- networkpolicy.yaml
generatorOptions:
disableNameSuffixHash: true
configMapGenerator:
- name: runner-artifactapi
namespace: iuclabs-runners
literals:
- PIP_INDEX_URL=https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/pypi/simple
- UV_DEFAULT_INDEX=https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/pypi/simple
- GOPROXY=https://artifactapi.k8s.syd1.au.unkin.net/api/v1/virtual/go,direct
- npm_config_registry=https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/npmjs/
- YARN_NPM_REGISTRY_SERVER=https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/npmjs
- COREPACK_NPM_REGISTRY=https://artifactapi.k8s.syd1.au.unkin.net/api/v1/remote/npmjs
- SSL_CERT_FILE=/etc/ssl/combined/ca-certificates.crt
- REQUESTS_CA_BUNDLE=/etc/ssl/combined/ca-certificates.crt
patches:
- path: init-containers-list.yaml
target:
group: actions.github.com
kind: AutoscalingRunnerSet
name: iuclabs-(k8s|infra|release)
- path: scaleset-patch.yaml
target:
group: actions.github.com
kind: AutoscalingRunnerSet
@@ -0,0 +1,25 @@
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: egress-artifactapi
namespace: iuclabs-runners
spec:
podSelector:
matchExpressions:
- key: runners.unkin.net/scale-set
operator: Exists
policyTypes:
- Egress
egress:
# artifactapi via traefik-internal; kube-proxy DNATs its LB IP to these pods
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: traefik-system
podSelector:
matchLabels:
app.kubernetes.io/instance: traefik-internal-traefik-system
ports:
- protocol: TCP
port: 443
@@ -0,0 +1,45 @@
---
# public roots + internal CA in one bundle, so SSL_CERT_FILE keeps github.com trusted
- op: add
path: /spec/template/spec/initContainers/-
value:
name: combine-certs
image: ghcr.io/actions/actions-runner:2.338.2
command:
- sh
- -c
- cat /etc/ssl/certs/ca-certificates.crt /etc/vault-ca/ca.crt > /etc/ssl/combined/ca-certificates.crt
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
resources:
requests:
cpu: 50m
memory: 32Mi
limits:
cpu: 200m
memory: 64Mi
volumeMounts:
- name: vault-ca-cert
mountPath: /etc/vault-ca
readOnly: true
- name: combined-certs
mountPath: /etc/ssl/combined
- op: add
path: /spec/template/spec/containers/0/envFrom
value:
- configMapRef:
name: runner-artifactapi
- op: add
path: /spec/template/spec/containers/0/volumeMounts/-
value:
name: combined-certs
mountPath: /etc/ssl/combined
readOnly: true
- op: add
path: /spec/template/spec/volumes/-
value:
name: combined-certs
emptyDir: {}
@@ -43,7 +43,7 @@ spec:
ports:
- protocol: TCP
port: 8200
# artifactapi via traefik-internal; kube-proxy DNATs its LB IP to these pods
# container-base fetches the internal CA RPM over http from artifactapi before TLS trust exists
- to:
- namespaceSelector:
matchLabels:
@@ -52,8 +52,5 @@ spec:
matchLabels:
app.kubernetes.io/instance: traefik-internal-traefik-system
ports:
- protocol: TCP
port: 443
# container-base fetches the internal CA RPM over http from artifactapi before TLS trust exists
- protocol: TCP
port: 80
@@ -43,14 +43,3 @@ spec:
ports:
- protocol: TCP
port: 8200
# artifactapi via traefik-internal; kube-proxy DNATs its LB IP to these pods
- to:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: traefik-system
podSelector:
matchLabels:
app.kubernetes.io/instance: traefik-internal-traefik-system
ports:
- protocol: TCP
port: 443
@@ -15,6 +15,7 @@ components:
- components/iuclabs-release
- components/iuclabs-dind
- components/iuclabs-build
- components/artifactapi
generatorOptions:
disableNameSuffixHash: true