add iuclabs-release runner scale set gated to v* tag pushes
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,56 @@
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: egress-iuclabs-release
|
||||
namespace: iuclabs-runners
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
runners.unkin.net/scale-set: iuclabs-release
|
||||
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 is only exposed with TLS 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,76 @@
|
||||
---
|
||||
apiVersion: actions.github.com/v1alpha1
|
||||
kind: AutoscalingRunnerSet
|
||||
metadata:
|
||||
name: iuclabs-release
|
||||
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-release
|
||||
minRunners: 0
|
||||
maxRunners: 2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
runners.unkin.net/scale-set: iuclabs-release
|
||||
spec:
|
||||
serviceAccountName: runner
|
||||
automountServiceAccountToken: false
|
||||
restartPolicy: Never
|
||||
securityContext:
|
||||
runAsNonRoot: true
|
||||
runAsUser: 1001
|
||||
runAsGroup: 1001
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
topologySpreadConstraints:
|
||||
- maxSkew: 1
|
||||
topologyKey: kubernetes.io/hostname
|
||||
whenUnsatisfiable: ScheduleAnyway
|
||||
labelSelector:
|
||||
matchLabels:
|
||||
runners.unkin.net/scale-set: iuclabs-release
|
||||
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_RELEASE_ONLY
|
||||
value: "true"
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- ALL
|
||||
resources:
|
||||
requests:
|
||||
cpu: 1
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: 2
|
||||
memory: 2Gi
|
||||
volumeMounts:
|
||||
- name: hooks
|
||||
mountPath: /hooks
|
||||
readOnly: true
|
||||
- name: vault-ca-cert
|
||||
mountPath: /etc/vault-ca
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: hooks
|
||||
configMap:
|
||||
name: runner-hooks
|
||||
defaultMode: 0555
|
||||
- name: vault-ca-cert
|
||||
secret:
|
||||
secretName: vault-ca-cert
|
||||
@@ -11,6 +11,19 @@ refuse() {
|
||||
[ -r "${GITHUB_EVENT_PATH:-}" ] || refuse "event payload missing"
|
||||
jq -e 'type == "object"' "${GITHUB_EVENT_PATH}" >/dev/null 2>&1 || refuse "event payload unparseable"
|
||||
|
||||
case "${RUNNER_RELEASE_ONLY:-}" in
|
||||
"") ;;
|
||||
true)
|
||||
[ "${event}" = push ] || refuse "release runners only run tag pushes"
|
||||
ref=$(jq -r '.ref' "${GITHUB_EVENT_PATH}") || refuse "event payload unreadable"
|
||||
case "${ref}" in
|
||||
refs/tags/v*) exit 0 ;;
|
||||
*) refuse "release runners only run v* tag pushes, got '${ref}'" ;;
|
||||
esac
|
||||
;;
|
||||
*) refuse "invalid RUNNER_RELEASE_ONLY" ;;
|
||||
esac
|
||||
|
||||
case "${event}" in
|
||||
push | workflow_dispatch | schedule | merge_group | release) ;;
|
||||
pull_request)
|
||||
|
||||
@@ -11,6 +11,7 @@ resources:
|
||||
|
||||
components:
|
||||
- components/iuclabs-k8s
|
||||
- components/iuclabs-release
|
||||
|
||||
generatorOptions:
|
||||
disableNameSuffixHash: true
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ref": "refs/tags/release-1"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"ref": "refs/tags/v1.2.3"
|
||||
}
|
||||
+16
-3
@@ -6,13 +6,14 @@ fixtures=ci/fixtures/runner-hooks
|
||||
fail=0
|
||||
|
||||
check() {
|
||||
local want=$1 event=$2 fixture=$3 got=0
|
||||
local -a env=(-u GITHUB_EVENT_NAME -u GITHUB_EVENT_PATH)
|
||||
local want=$1 event=$2 fixture=$3 release=${4:-} got=0
|
||||
local -a env=(-u GITHUB_EVENT_NAME -u GITHUB_EVENT_PATH -u RUNNER_RELEASE_ONLY)
|
||||
[ -z "$release" ] || env+=("RUNNER_RELEASE_ONLY=$release")
|
||||
[ "$event" = - ] || env+=("GITHUB_EVENT_NAME=$event")
|
||||
[ "$fixture" = - ] || env+=("GITHUB_EVENT_PATH=$fixtures/$fixture")
|
||||
env "${env[@]}" "$hook" >/dev/null 2>&1 || got=1
|
||||
if [ "$got" -ne "$want" ]; then
|
||||
echo "FAIL: $event $fixture exit=$got want=$want" >&2
|
||||
echo "FAIL: $event $fixture release=$release exit=$got want=$want" >&2
|
||||
fail=1
|
||||
fi
|
||||
}
|
||||
@@ -35,5 +36,17 @@ check 1 push -
|
||||
check 1 push missing.json
|
||||
check 1 push invalid.txt
|
||||
check 1 - push.json
|
||||
check 0 push tag-push.json
|
||||
|
||||
check 0 push tag-push.json true
|
||||
check 1 push push.json true
|
||||
check 1 push tag-push-nov.json true
|
||||
for e in pull_request workflow_dispatch schedule merge_group release; do
|
||||
check 1 "$e" tag-push.json true
|
||||
done
|
||||
check 1 pull_request pr-same-repo.json true
|
||||
check 1 push - true
|
||||
check 1 push invalid.txt true
|
||||
check 1 push tag-push.json yes
|
||||
|
||||
exit "$fail"
|
||||
|
||||
Reference in New Issue
Block a user