-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: RunnerSet backed by StatefulSet (#629)
* feat: RunnerSet backed by StatefulSet Unlike a runner deployment, a runner set can manage a set of stateful runners by combining a statefulset and an admission webhook that mutates statefulset-managed pods with required envvars and registration tokens. Resolves #613 Ref #612 * Upgrade controller-runtime to 0.9.0 * Bump Go to 1.16.x following controller-runtime 0.9.0 * Upgrade kubebuilder to 2.3.2 for updated etcd and apiserver following local setup * Fix startup failure due to missing LeaderElectionID * Fix the issue that any pods become unable to start once actions-runner-controller got failed after the mutating webhook has been registered * Allow force-updating statefulset * Fix runner container missing work and certs-client volume mounts and DOCKER_HOST and DOCKER_TLS_VERIFY envvars when dockerdWithinRunner=false * Fix runnerset-controller not applying statefulset.spec.template.spec changes when there were no changes in runnerset spec * Enable running acceptance tests against arbitrary kind cluster * RunnerSet supports non-ephemeral runners only today * fix: docker-build from root Makefile on intel mac * fix: arch check fixes for mac and ARM * ci: aligning test data format and patching checks * fix: removing namespace in test data * chore: adding more ignores * chore: removing leading space in shebang * Re-add metrics to org hra testdata * Bump cert-manager to v1.1.1 and fix deploy.sh Co-authored-by: toast-gear <[email protected]> Co-authored-by: Callum James Tait <[email protected]>
- Loading branch information
1 parent
af0ca03
commit 9e4dbf4
Showing
54 changed files
with
27,387 additions
and
9,708 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ config | |
charts | ||
.github | ||
.envrc | ||
.env | ||
*.md | ||
*.txt | ||
*.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,84 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
set +e | ||
|
||
runner_name= | ||
repo_runnerdeployment_passed="skipped" | ||
repo_runnerset_passed="skipped" | ||
|
||
while [ -z "${runner_name}" ]; do | ||
echo Finding the runner... 1>&2 | ||
sleep 1 | ||
runner_name=$(kubectl get runner --output=jsonpath="{.items[*].metadata.name}") | ||
done | ||
echo "Checking if RunnerDeployment repo test is set" | ||
if [ "${TEST_REPO}" ] && [ ! "${USE_RUNNERSET}" ]; then | ||
runner_name= | ||
count=0 | ||
while [ $count -le 30 ]; do | ||
echo "Finding Runner ..." | ||
runner_name=$(kubectl get runner --output=jsonpath="{.items[*].metadata.name}") | ||
if [ "${runner_name}" ]; then | ||
while [ $count -le 30 ]; do | ||
runner_pod_name= | ||
echo "Found Runner \""${runner_name}"\"" | ||
echo "Finding underlying pod ..." | ||
runner_pod_name=$(kubectl get pod --output=jsonpath="{.items[*].metadata.name}" | grep ${runner_name}) | ||
if [ "${runner_pod_name}" ]; then | ||
echo "Found underlying pod \""${runner_pod_name}"\"" | ||
echo "Waiting for pod \""${runner_pod_name}"\" to become ready..." | ||
kubectl wait pod/${runner_pod_name} --for condition=ready --timeout 270s | ||
break 2 | ||
fi | ||
sleep 1 | ||
let "count=count+1" | ||
done | ||
fi | ||
sleep 1 | ||
let "count=count+1" | ||
done | ||
if [ $count -ge 30 ]; then | ||
repo_runnerdeployment_passed=false | ||
else | ||
repo_runnerdeployment_passed=true | ||
fi | ||
echo "Checking if RunnerSet repo test is set" | ||
elif [ "${TEST_REPO}" ] && [ "${USE_RUNNERSET}" ]; then | ||
runnerset_name= | ||
count=0 | ||
while [ $count -le 30 ]; do | ||
echo "Finding RunnerSet ..." | ||
runnerset_name=$(kubectl get runnerset --output=jsonpath="{.items[*].metadata.name}") | ||
if [ "${runnerset_name}" ]; then | ||
while [ $count -le 30 ]; do | ||
runnerset_pod_name= | ||
echo "Found RunnerSet \""${runnerset_name}"\"" | ||
echo "Finding underlying pod ..." | ||
runnerset_pod_name=$(kubectl get pod --output=jsonpath="{.items[*].metadata.name}" | grep ${runnerset_name}) | ||
echo "BEFORE IF" | ||
if [ "${runnerset_pod_name}" ]; then | ||
echo "AFTER IF" | ||
echo "Found underlying pod \""${runnerset_pod_name}"\"" | ||
echo "Waiting for pod \""${runnerset_pod_name}"\" to become ready..." | ||
kubectl wait pod/${runnerset_pod_name} --for condition=ready --timeout 270s | ||
break 2 | ||
fi | ||
sleep 1 | ||
let "count=count+1" | ||
done | ||
fi | ||
sleep 1 | ||
let "count=count+1" | ||
done | ||
if [ $count -ge 30 ]; then | ||
repo_runnerset_passed=false | ||
else | ||
repo_runnerset_passed=true | ||
fi | ||
fi | ||
|
||
echo Found runner ${runner_name}. | ||
|
||
# Wait a bit to make sure the runner pod is created before looking for it. | ||
sleep 2 | ||
|
||
pod_name= | ||
|
||
while [ -z "${pod_name}" ]; do | ||
echo Finding the runner pod... 1>&2 | ||
sleep 1 | ||
pod_name=$(kubectl get pod --output=jsonpath="{.items[*].metadata.name}" | grep ${runner_name}) | ||
done | ||
|
||
echo Found pod ${pod_name}. | ||
|
||
echo Waiting for pod ${runner_name} to become ready... 1>&2 | ||
|
||
kubectl wait pod/${runner_name} --for condition=ready --timeout 270s | ||
|
||
echo All tests passed. 1>&2 | ||
if [ ${repo_runnerset_passed} == true ] || [ ${repo_runnerset_passed} == "skipped" ] && \ | ||
[ ${repo_runnerdeployment_passed} == true ] || [ ${repo_runnerdeployment_passed} == "skipped" ]; then | ||
echo "INFO : All tests passed or skipped" | ||
echo "RunnerSet Repo Test Status : ${repo_runnerset_passed}" | ||
echo "RunnerDeployment Repo Test Status : ${repo_runnerdeployment_passed}" | ||
else | ||
echo "ERROR : Some tests failed" | ||
echo "RunnerSet Repo Test Status : ${repo_runnerset_passed}" | ||
echo "RunnerDeployment Repo Test Status : ${repo_runnerdeployment_passed}" | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
apiVersion: actions.summerwind.dev/v1alpha1 | ||
kind: RunnerSet | ||
metadata: | ||
name: example-runnerset | ||
spec: | ||
# MANDATORY because it is based on StatefulSet: Results in a below error when omitted: | ||
# missing required field "selector" in dev.summerwind.actions.v1alpha1.RunnerSet.spec | ||
selector: | ||
matchLabels: | ||
app: example-runnerset | ||
|
||
# MANDATORY because it is based on StatefulSet: Results in a below error when omitted: | ||
# missing required field "serviceName" in dev.summerwind.actions.v1alpha1.RunnerSet.spec] | ||
serviceName: example-runnerset | ||
|
||
#replicas: 1 | ||
ephemeral: false | ||
|
||
repository: ${TEST_REPO} | ||
# | ||
# Custom runner image | ||
# | ||
image: ${RUNNER_NAME}:${RUNNER_TAG} | ||
# | ||
# dockerd within runner container | ||
# | ||
## Replace `mumoshu/actions-runner-dind:dev` with your dind image | ||
#dockerdWithinRunnerContainer: true | ||
# | ||
# Set the MTU used by dockerd-managed network interfaces (including docker-build-ubuntu) | ||
# | ||
#dockerMTU: 1450 | ||
#Runner group | ||
# labels: | ||
# - "mylabel 1" | ||
# - "mylabel 2" | ||
|
||
# | ||
# Non-standard working directory | ||
# | ||
# workDir: "/" | ||
template: | ||
metadata: | ||
labels: | ||
app: example-runnerset | ||
spec: | ||
containers: | ||
- name: runner | ||
imagePullPolicy: IfNotPresent | ||
#- name: docker | ||
# #image: mumoshu/actions-runner-dind:dev |
Oops, something went wrong.