Add iuclabs-build runner scale set (#610)
IUCLabs rpmbuilder and container repos need a runner that can build images and publish to artifactapi, without opening that egress to every dind job. - Adds the `iuclabs-build` scale set (copy of `iuclabs-dind`, `RUNNER_MODE=build`, same min/max runners) - Allows egress to traefik-internal on 443/80 on top of the dind rules - Mounts `vault-ca-cert` as the dind registry CA for artifactapi.k8s.syd1.au.unkin.net - `job-started.sh` restricts build mode to IUCLabs/rpmbuilder and the listed container-* repos, then applies the usual event checks - Extends `ci/test-runner-hooks.sh` with build-mode cases Reviewed-on: #610 Co-authored-by: unkin-agent <unkin-agent@unkin.net> Co-committed-by: unkin-agent <unkin-agent@unkin.net>
This commit was merged in pull request #610.
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
---
|
||||
apiVersion: kustomize.config.k8s.io/v1alpha1
|
||||
kind: Component
|
||||
|
||||
resources:
|
||||
- scaleset.yaml
|
||||
- networkpolicy.yaml
|
||||
@@ -0,0 +1,59 @@
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: egress-iuclabs-build
|
||||
namespace: iuclabs-runners
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
runners.unkin.net/scale-set: iuclabs-build
|
||||
policyTypes:
|
||||
- Egress
|
||||
egress:
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: 0.0.0.0/0
|
||||
except:
|
||||
- 10.0.0.0/8
|
||||
- 172.16.0.0/12
|
||||
- 192.168.0.0/16
|
||||
- 198.18.0.0/15
|
||||
- 0.0.0.0/8
|
||||
- 100.64.0.0/10
|
||||
- 127.0.0.0/8
|
||||
- 169.254.0.0/16
|
||||
- 224.0.0.0/4
|
||||
- 240.0.0.0/4
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 443
|
||||
# vault.service.consul servers, from `dig vault.service.consul`
|
||||
- to:
|
||||
- ipBlock:
|
||||
cidr: 198.18.25.78/32
|
||||
- ipBlock:
|
||||
cidr: 198.18.26.197/32
|
||||
- ipBlock:
|
||||
cidr: 198.18.27.116/32
|
||||
- ipBlock:
|
||||
cidr: 198.18.28.248/32
|
||||
- ipBlock:
|
||||
cidr: 198.18.29.92/32
|
||||
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
|
||||
# container-base fetches the internal CA RPM over http from artifactapi before TLS trust exists
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
@@ -0,0 +1,165 @@
|
||||
---
|
||||
apiVersion: actions.github.com/v1alpha1
|
||||
kind: AutoscalingRunnerSet
|
||||
metadata:
|
||||
name: iuclabs-build
|
||||
namespace: iuclabs-runners
|
||||
labels:
|
||||
app.kubernetes.io/version: "0.15.1"
|
||||
annotations:
|
||||
actions.github.com/cleanup-manager-role-name: arc-manager
|
||||
actions.github.com/cleanup-manager-role-binding: arc-manager
|
||||
spec:
|
||||
githubConfigUrl: https://github.com/IUCLabs
|
||||
githubConfigSecret: github-app
|
||||
runnerScaleSetName: iuclabs-build
|
||||
minRunners: 0
|
||||
maxRunners: 4
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
runners.unkin.net/scale-set: iuclabs-build
|
||||
spec:
|
||||
serviceAccountName: runner
|
||||
automountServiceAccountToken: false
|
||||
restartPolicy: Never
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1001
|
||||
runAsGroup: 1001
|
||||
supplementalGroups:
|
||||
- 123
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: kubernetes.io/hostname
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
runners.unkin.net/scale-set: iuclabs-build
|
||||
initContainers:
|
||||
- name: init-dind-externals
|
||||
image: ghcr.io/actions/actions-runner:2.338.2
|
||||
command: ["cp"]
|
||||
args: ["-r", "/home/runner/externals/.", "/home/runner/tmpDir/"]
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 64Mi
|
||||
ephemeral-storage: 100Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 256Mi
|
||||
ephemeral-storage: 1Gi
|
||||
volumeMounts:
|
||||
- name: dind-externals
|
||||
mountPath: /home/runner/tmpDir
|
||||
- name: dind
|
||||
image: docker.io/library/docker:29.9.3-dind
|
||||
args:
|
||||
- dockerd
|
||||
- --host=unix:///var/run/docker.sock
|
||||
- --group=$(DOCKER_GROUP_GID)
|
||||
env:
|
||||
- name: DOCKER_GROUP_GID
|
||||
value: "123"
|
||||
restartPolicy: Always
|
||||
startupProbe:
|
||||
exec:
|
||||
command:
|
||||
- docker
|
||||
- info
|
||||
initialDelaySeconds: 0
|
||||
failureThreshold: 24
|
||||
periodSeconds: 5
|
||||
securityContext:
|
||||
privileged: true
|
||||
runAsNonRoot: false
|
||||
runAsUser: 0
|
||||
runAsGroup: 0
|
||||
resources:
|
||||
requests:
|
||||
cpu: 1
|
||||
memory: 1Gi
|
||||
ephemeral-storage: 10Gi
|
||||
limits:
|
||||
cpu: 2
|
||||
memory: 4Gi
|
||||
ephemeral-storage: 50Gi
|
||||
volumeMounts:
|
||||
- name: work
|
||||
mountPath: /home/runner/_work
|
||||
- name: dind-sock
|
||||
mountPath: /var/run
|
||||
- name: dind-externals
|
||||
mountPath: /home/runner/externals
|
||||
- name: dind-storage
|
||||
mountPath: /var/lib/docker
|
||||
- name: vault-ca-cert
|
||||
mountPath: /etc/docker/certs.d/artifactapi.k8s.syd1.au.unkin.net/ca.crt
|
||||
subPath: ca.crt
|
||||
readOnly: true
|
||||
containers:
|
||||
- name: runner
|
||||
image: ghcr.io/actions/actions-runner:2.338.2
|
||||
command: ["/home/runner/run.sh"]
|
||||
env:
|
||||
- name: ACTIONS_RUNNER_HOOK_JOB_STARTED
|
||||
value: /hooks/job-started.sh
|
||||
- name: NODE_EXTRA_CA_CERTS
|
||||
value: /etc/vault-ca/ca.crt
|
||||
- name: RUNNER_MODE
|
||||
value: build
|
||||
- name: DOCKER_HOST
|
||||
value: unix:///var/run/docker.sock
|
||||
- name: RUNNER_WAIT_FOR_DOCKER_IN_SECONDS
|
||||
value: "120"
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
resources:
|
||||
requests:
|
||||
cpu: 1
|
||||
memory: 512Mi
|
||||
ephemeral-storage: 2Gi
|
||||
limits:
|
||||
cpu: 2
|
||||
memory: 2Gi
|
||||
ephemeral-storage: 20Gi
|
||||
volumeMounts:
|
||||
- name: work
|
||||
mountPath: /home/runner/_work
|
||||
- name: dind-sock
|
||||
mountPath: /var/run
|
||||
- name: hooks
|
||||
mountPath: /hooks
|
||||
readOnly: true
|
||||
- name: vault-ca-cert
|
||||
mountPath: /etc/vault-ca
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: work
|
||||
emptyDir:
|
||||
sizeLimit: 20Gi
|
||||
- name: dind-sock
|
||||
emptyDir: {}
|
||||
- name: dind-externals
|
||||
emptyDir: {}
|
||||
- name: dind-storage
|
||||
emptyDir:
|
||||
sizeLimit: 30Gi
|
||||
- name: hooks
|
||||
configMap:
|
||||
name: runner-hooks
|
||||
defaultMode: 0555
|
||||
- name: vault-ca-cert
|
||||
secret:
|
||||
secretName: vault-ca-cert
|
||||
@@ -19,6 +19,12 @@ case "${RUNNER_MODE:-}" in
|
||||
*) refuse "infra runners only run IUCLabs terraform repos, got '${GITHUB_REPOSITORY:-}'" ;;
|
||||
esac
|
||||
;;
|
||||
build)
|
||||
case "${GITHUB_REPOSITORY:-}" in
|
||||
IUCLabs/rpmbuilder | IUCLabs/container-agent-base | IUCLabs/container-agent-dev | IUCLabs/container-agent-infra | IUCLabs/container-base | IUCLabs/container-gobuilder | IUCLabs/container-opentofu | IUCLabs/container-postfix | IUCLabs/container-rpmbuilder | IUCLabs/container-tea) ;;
|
||||
*) refuse "build runners only run IUCLabs rpmbuilder and container repos, got '${GITHUB_REPOSITORY:-}'" ;;
|
||||
esac
|
||||
;;
|
||||
release)
|
||||
[ "${event}" = push ] || refuse "release runners only run tag pushes"
|
||||
ref=$(jq -r '.ref' "${GITHUB_EVENT_PATH}") || refuse "event payload unreadable"
|
||||
|
||||
@@ -14,6 +14,7 @@ components:
|
||||
- components/iuclabs-infra
|
||||
- components/iuclabs-release
|
||||
- components/iuclabs-dind
|
||||
- components/iuclabs-build
|
||||
|
||||
generatorOptions:
|
||||
disableNameSuffixHash: true
|
||||
|
||||
Reference in New Issue
Block a user