-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: RunnerSet backed by StatefulSet #629
Changes from 12 commits
dc0e1bf
aedaab5
6993a6d
2439e91
0cdf017
61697b2
352c799
1a8e645
626ba60
3f88ce8
69b43fa
0669ef9
2d95900
1a15420
2aac467
a2b9da4
35ffe60
3c4c6ca
5336e31
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,13 +11,19 @@ TEST_REPO ?= ${DOCKER_USER}/actions-runner-controller | |
TEST_ORG ?= | ||
TEST_ORG_REPO ?= | ||
SYNC_PERIOD ?= 5m | ||
USE_RUNNERSET ?= | ||
KUBECONTEXT ?= kind-acceptance | ||
CLUSTER ?= acceptance | ||
|
||
# From https://github.com/VictoriaMetrics/operator/pull/44 | ||
YAML_DROP=$(YQ) delete --inplace | ||
YAML_DROP_PREFIX=spec.validation.openAPIV3Schema.properties.spec.properties | ||
|
||
# If you encounter errors like the below, you are very likely to update this to follow e.g. CRD version change: | ||
# CustomResourceDefinition.apiextensions.k8s.io "runners.actions.summerwind.dev" is invalid: spec.preserveUnknownFields: Invalid value: true: must be false in order to use defaults in the schema | ||
YAML_DROP_PREFIX=spec.versions[0].schema.openAPIV3Schema.properties.spec.properties | ||
|
||
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion) | ||
CRD_OPTIONS ?= "crd:trivialVersions=true" | ||
CRD_OPTIONS ?= "crd:trivialVersions=true,generateEmbeddedObjectMeta=true" | ||
|
||
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set) | ||
ifeq (,$(shell go env GOBIN)) | ||
|
@@ -158,20 +164,20 @@ acceptance: release/clean acceptance/pull docker-build release | |
acceptance/run: acceptance/kind acceptance/load acceptance/setup acceptance/deploy acceptance/tests acceptance/teardown | ||
|
||
acceptance/kind: | ||
kind create cluster --name acceptance --config acceptance/kind.yaml | ||
kind create cluster --name ${CLUSTER} --config acceptance/kind.yaml | ||
|
||
# Set TMPDIR to somewhere under $HOME when you use docker installed with Ubuntu snap | ||
# Otherwise `load docker-image` fail while running `docker save`. | ||
# See https://kind.sigs.k8s.io/docs/user/known-issues/#docker-installed-with-snap | ||
acceptance/load: | ||
kind load docker-image ${NAME}:${VERSION} --name acceptance | ||
kind load docker-image quay.io/brancz/kube-rbac-proxy:v0.10.0 --name acceptance | ||
kind load docker-image ${RUNNER_NAME}:${RUNNER_TAG} --name acceptance | ||
kind load docker-image docker:dind --name acceptance | ||
kind load docker-image quay.io/jetstack/cert-manager-controller:v1.0.4 --name acceptance | ||
kind load docker-image quay.io/jetstack/cert-manager-cainjector:v1.0.4 --name acceptance | ||
kind load docker-image quay.io/jetstack/cert-manager-webhook:v1.0.4 --name acceptance | ||
kubectl cluster-info --context kind-acceptance | ||
kind load docker-image ${NAME}:${VERSION} --name ${CLUSTER} | ||
kind load docker-image quay.io/brancz/kube-rbac-proxy:v0.10.0 --name ${CLUSTER} | ||
kind load docker-image ${RUNNER_NAME}:${RUNNER_TAG} --name ${CLUSTER} | ||
kind load docker-image docker:dind --name ${CLUSTER} | ||
kind load docker-image quay.io/jetstack/cert-manager-controller:v1.0.4 --name ${CLUSTER} | ||
kind load docker-image quay.io/jetstack/cert-manager-cainjector:v1.0.4 --name ${CLUSTER} | ||
kind load docker-image quay.io/jetstack/cert-manager-webhook:v1.0.4 --name ${CLUSTER} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Worth bumping to v1.1.1 in this PR? v1.1.1 is the last of the v1.X.X series. I run v1.1.1 on EKS and have done across multiple controller versions. v1.1.1 is fairly old at this point but we should consider bumping it but a newer major version outside of this PR so if there are issues (I don't see why there would be tbh) they are dealt with seperately to this work. I can vouch for v1.1.1 so it would be nice to bump to latest of that series in this PR seen as we have done various bumps already. Perhaps it's worth having |
||
kubectl cluster-info --context ${KUBECONTEXT} | ||
|
||
# Pull the docker images for acceptance | ||
acceptance/pull: | ||
|
@@ -191,11 +197,12 @@ acceptance/setup: | |
sleep 5 | ||
|
||
acceptance/teardown: | ||
kind delete cluster --name acceptance | ||
kind delete cluster --name ${CLUSTER} | ||
|
||
acceptance/deploy: | ||
NAME=${NAME} DOCKER_USER=${DOCKER_USER} VERSION=${VERSION} RUNNER_NAME=${RUNNER_NAME} RUNNER_TAG=${RUNNER_TAG} TEST_REPO=${TEST_REPO} \ | ||
TEST_ORG=${TEST_ORG} TEST_ORG_REPO=${TEST_ORG_REPO} SYNC_PERIOD=${SYNC_PERIOD} \ | ||
USE_RUNNERSET=${USE_RUNNERSET} \ | ||
acceptance/deploy.sh | ||
|
||
acceptance/tests: | ||
|
@@ -205,8 +212,14 @@ acceptance/tests: | |
github-release: release | ||
ghr ${VERSION} release/ | ||
|
||
# find or download controller-gen | ||
# download controller-gen if necessary | ||
# Find or download controller-gen | ||
# | ||
# Note that controller-gen newer than 0.4.1 is needed for https://github.com/kubernetes-sigs/controller-tools/issues/444#issuecomment-680168439 | ||
# Otherwise we get errors like the below: | ||
# Error: failed to install CRD crds/actions.summerwind.dev_runnersets.yaml: CustomResourceDefinition.apiextensions.k8s.io "runnersets.actions.summerwind.dev" is invalid: [spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec].properties[containers].items.properties[ports].items.properties[protocol].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property, spec.validation.openAPIV3Schema.properties[spec].properties[template].properties[spec].properties[initContainers].items.properties[ports].items.properties[protocol].default: Required value: this property is in x-kubernetes-list-map-keys, so it must have a default or be a required property] | ||
# | ||
# Note that controller-gen newer than 0.6.0 is needed due to https://github.com/kubernetes-sigs/controller-tools/issues/448 | ||
# Otherwise ObjectMeta embedded in Spec results in empty on the storage. | ||
controller-gen: | ||
ifeq (, $(shell which controller-gen)) | ||
ifeq (, $(wildcard $(GOBIN)/controller-gen)) | ||
|
@@ -215,7 +228,7 @@ ifeq (, $(wildcard $(GOBIN)/controller-gen)) | |
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\ | ||
cd $$CONTROLLER_GEN_TMP_DIR ;\ | ||
go mod init tmp ;\ | ||
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0 ;\ | ||
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.6.0 ;\ | ||
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\ | ||
} | ||
endif | ||
|
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if all the images used in
acceptance/load
aren't already on your local machine then this fails.acceptance/pull
needs to be done afteracceptance/kind