Update ARC versions

This commit is contained in:
Corneil du Plessis
2023-01-16 13:52:30 +02:00
parent c47eb0028e
commit 44f7bed5c8
11 changed files with 101 additions and 43 deletions

View File

@@ -17,7 +17,8 @@
"machine_type": "e2-highcpu-16",
"runner_scaling": "manual",
"scale_down": 1,
"arc_version": "v0.26.0",
"helm_version": "0.21.1"
"arc_version": "v0.27.0",
"helm_version": "0.21.1",
"actions_runner_version": "ubuntu:22.04"
}
}

View File

@@ -76,26 +76,26 @@ case $ARCH in
;;
esac
# the specific template
cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci-change.yaml
cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci.yaml
IMAGE_SHA=$(wget -q -O- https://hub.docker.com/v2/repositories/summerwind/actions-runner/tags | jq --arg os $OS --arg arch $ARCH '.results | map(select(.name="latest")) | .[0].images | map(select(.os==$os and .architecture==$arch)) | .[0].digest' | sed 's/\"//g')
if [ "$IMAGE_SHA" == "" ]; then
IMAGE_SHA="latest"
ARC_RUNNER_VER=$($SCDIR/determine-default.sh stream-apps-gh-runners "actions_runner_version")
if [ "$ARC_RUNNER_VER" == "" ]; then
ARC_RUNNER_VER=latest
fi
sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-stream-ci-change.yaml
sed -i 's/tag-placeholder/'"$ARC_RUNNER_VER"'/g' runners-stream-ci.yaml
if [ "$SCALING" == "auto" ]; then
MAX_RUNNERS=$((MAX_RUNNERS - DEC))
echo "Runners: changing scaling min: $MIN_RUNNERS, max: $MAX_RUNNERS"
sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci-change.yaml
sed -i 's/min-replicas-placeholder/'"$MIN_RUNNERS"'/g' runners-stream-ci-change.yaml
sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci.yaml
sed -i 's/min-replicas-placeholder/'"$MIN_RUNNERS"'/g' runners-stream-ci.yaml
else
echo "Runners:$CURRENT decrease by $DEC to $TARGET"
sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-stream-ci-change.yaml
sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-stream-ci.yaml
fi
cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci-change.yaml
cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci.yaml
RC=$?
if ((RC != 0)); then
kubectl apply -f runners-stream-ci-change.yaml
kubectl apply -f runners-stream-ci.yaml
echo "Runners: changed to $RUNNERS"
if [ "$SCALING" != "auto" ]; then
$SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-stream-ci --all-namespaces=true
@@ -103,5 +103,5 @@ if ((RC != 0)); then
else
echo "Runners: unchanged"
fi
rm -f runners-stream-ci-change.yaml
rm -f runners-stream-ci.yaml
$SCDIR/check-runners.sh

View File

@@ -102,13 +102,27 @@ else
$SCDIR/wait-deployment.sh $SVC $NS
fi
echo "Creating runners"
kubectl apply -f "$SCDIR/k8s/runners-stream-ci-large.yaml"
ARC_VER=$($SCDIR/determine-default.sh stream-apps-gh-runners "arc_version")
ARC_RUNNER_VER=$($SCDIR/determine-default.sh stream-apps-gh-runners "actions_runner_version")
if [ "$ARC_RUNNER_VER" == "" ]; then
ARC_RUNNER_VER=latest
fi
SCALING=$($SCDIR/determine-default.sh stream-apps-gh-runners runner_scaling)
cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci.yaml
sed -i 's/tag-placeholder/'"$ARC_RUNNER_VER"'/g' runners-stream-ci.yaml
echo "actions runner version = $ARC_RUNNER_VER"
cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci.yaml
RC=$?
if ((RC != 0)); then
echo "Expected changes to $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml"
cat runners-stream-ci.yaml
fi
kubectl apply -f runners-stream-ci.yaml
SCALING=$($SCDIR/determine-default.sh stream-apps-gh-runners "runner_scaling")
if [ "$SCALING" == "" ] || [ "$SCALING" == "null" ]; then
echo "Cannot determine runner_scaling"
exit 2
fi
kubectl apply -f "$SCDIR/k8s/runners-stream-ci-${SCALING}.yaml"
if [ "$SCALING" != "auto" ]; then
$SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-stream-ci
fi

View File

@@ -29,7 +29,7 @@ INC=$1
# shellcheck disable=SC2003
MAX_RUNNERS=$2
SCALING=$($SCDIR/determine-default.sh stream-apps-gh-runners runner_scaling)
cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci-change.yaml
cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci.yaml
if [ "$SCALING" == "auto" ]; then
if [ "$MAX_RUNNERS" == "" ]; then
@@ -80,24 +80,25 @@ case $ARCH in
echo "Architecture:$ARCH may not be supported by summerwind/actions-runner"
;;
esac
IMAGE_SHA=$(wget -q -O- https://hub.docker.com/v2/repositories/summerwind/actions-runner/tags | jq --arg os $OS --arg arch $ARCH '.results | map(select(.name="latest")) | .[0].images | map(select(.os==$os and .architecture==$arch)) | .[0].digest' | sed 's/\"//g')
if [ "$IMAGE_SHA" == "" ]; then
IMAGE_SHA="latest"
ARC_RUNNER_VER=$($SCDIR/determine-default.sh stream-apps-gh-runners "actions_runner_version")
if [ "$ARC_RUNNER_VER" == "" ]; then
ARC_RUNNER_VER=latest
fi
sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-stream-ci-change.yaml
sed -i 's/tag-placeholder/'"$ARC_RUNNER_VER"'/g' runners-stream-ci.yaml
if [ "$SCALING" == "auto" ]; then
echo "Runners: changing scaling min: $MIN_RUNNERS, max: $MAX_RUNNERS"
sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci-change.yaml
sed -i 's/min-replicas-placeholder/'"$MIN_RUNNERS"'/g' runners-stream-ci-change.yaml
sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci.yaml
sed -i 's/min-replicas-placeholder/'"$MIN_RUNNERS"'/g' runners-stream-ci.yaml
else
echo "Runners:$CURRENT increase by $INC to $TARGET"
sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-stream-ci-change.yaml
sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-stream-ci.yaml
fi
cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci-change.yaml
echo "actions runner version = $ARC_RUNNER_VER"
cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci.yaml
RC=$?
if ((RC != 0)); then
kubectl apply -f runners-stream-ci-change.yaml
kubectl apply -f runners-stream-ci.yaml
echo "Runners: changes applied"
if [ "$SCALING" != "auto" ]; then
$SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-stream-ci --all-namespaces=true

View File

@@ -5,7 +5,7 @@ metadata:
spec:
template:
spec:
image: 'summerwind/actions-runner-dind'
image: 'summerwind/actions-runner-dind:tag-placeholder'
priorityClassName: high-priority
dockerdWithinRunnerContainer: true
imagePullPolicy: IfNotPresent

View File

@@ -5,7 +5,7 @@ metadata:
spec:
template:
spec:
image: 'summerwind/actions-runner-dind:latest'
image: 'summerwind/actions-runner-dind:tag-placeholder'
priorityClassName: high-priority
dockerdWithinRunnerContainer: true
imagePullPolicy: IfNotPresent

View File

@@ -0,0 +1,41 @@
apiVersion: actions.summerwind.dev/v1alpha1
kind: RunnerDeployment
metadata:
name: runners-stream-ci-large
spec:
template:
spec:
image: 'summerwind/actions-runner-dind:tag-placeholder'
priorityClassName: high-priority
dockerdWithinRunnerContainer: true
imagePullPolicy: IfNotPresent
imagePullSecrets:
- name: stream-metadata-default
repository: spring-cloud/stream-applications
githubAPICredentialsFrom:
secretRef:
name: controller-manager-secret
resources:
requests:
cpu: "3000m"
memory: "3Gi"
labels:
- stream-ci-large
---
apiVersion: actions.summerwind.dev/v1alpha1
kind: HorizontalRunnerAutoscaler
metadata:
name: runners-stream-ci-large-scaling
spec:
githubAPICredentialsFrom:
secretRef:
name: controller-manager-secret
minReplicas: 0
maxReplicas: 2
scaleTargetRef:
kind: RunnerDeployment
name: runners-stream-ci-large
scaleUpTriggers:
- githubEvent:
workflowJob: {}
duration: "20m"

View File

@@ -5,7 +5,7 @@ metadata:
spec:
template:
spec:
image: 'summerwind/actions-runner-dind:latest'
image: 'summerwind/actions-runner-dind:tag-placeholder'
priorityClassName: high-priority
dockerdWithinRunnerContainer: true
imagePullPolicy: IfNotPresent

View File

@@ -6,7 +6,7 @@ spec:
replicas: replicas-placeholder
template:
spec:
image: 'summerwind/actions-runner-dind:latest'
image: 'summerwind/actions-runner-dind:tag-placeholder'
dockerdWithinRunnerContainer: true
priorityClassName: high-priority
imagePullPolicy: IfNotPresent

View File

@@ -6,7 +6,7 @@ spec:
replicas: 2
template:
spec:
image: 'summerwind/actions-runner-dind:latest'
image: 'summerwind/actions-runner-dind:tag-placeholder'
dockerdWithinRunnerContainer: true
priorityClassName: high-priority
imagePullPolicy: IfNotPresent

View File

@@ -41,29 +41,30 @@ case $ARCH in
echo "Architecture:$ARCH may not be supported by summerwind/actions-runner"
;;
esac
IMAGE_SHA=$(wget -q -O- https://hub.docker.com/v2/repositories/summerwind/actions-runner/tags | jq --arg os $OS --arg arch $ARCH '.results | map(select(.name="latest")) | .[0].images | map(select(.os==$os and .architecture==$arch)) | .[0].digest' | sed 's/\"//g')
if [ "$IMAGE_SHA" == "" ]; then
IMAGE_SHA="latest"
fi
SCALING=$($SCDIR/determine-default.sh stream_apps_gh_runners runner_scaling)
cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci-change.yaml
sed -i 's/tag-placeholder/'"$IMAGE_SHA"'/g' runners-stream-ci-change.yaml
cp $SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml runners-stream-ci.yaml
ARC_RUNNER_VER=$($SCDIR/determine-default.sh stream-apps-gh-runners "actions_runner_version")
if [ "$ARC_RUNNER_VER" == "" ]; then
ARC_RUNNER_VER=latest
fi
sed -i 's/tag-placeholder/'"$ARC_RUNNER_VER"'/g' runners-stream-ci.yaml
if [ "$SCALING" == "auto" ]; then
if [ "$MAX_RUNNERS" == "" ]; then
MAX_RUNNERS=$(max_replicas)
fi
echo "Runners: Max runners to $MAX_RUNNERS"
echo "Runners: changing scaling min: $TARGET, max: $MAX_RUNNERS"
sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci-change.yaml
sed -i 's/min-replicas-placeholder/'"$TARGET"'/g' runners-stream-ci-change.yaml
sed -i 's/max-replicas-placeholder/'"$MAX_RUNNERS"'/g' runners-stream-ci.yaml
sed -i 's/min-replicas-placeholder/'"$TARGET"'/g' runners-stream-ci.yaml
else
echo "Runners:$CURRENT change to $TARGET"
sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-stream-ci-change.yaml
sed -i 's/replicas-placeholder/'"$TARGET"'/g' runners-stream-ci.yaml
fi
cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci-change.yaml
cmp --silent "$SCDIR/k8s/runners-stream-ci-${SCALING}-template.yaml" runners-stream-ci.yaml
RC=$?
if ((RC != 0)); then
kubectl apply -f runners-stream-ci-change.yaml
kubectl apply -f runners-stream-ci.yaml
echo "Runners: applying changes"
# if [ "$SCALING" != "auto" ]; then
# $SCDIR/wait-k8s.sh 1 --for=condition=ready --timeout=1m pod -l runner-deployment-name=runners-stream-ci --all-namespaces=true
@@ -71,5 +72,5 @@ if ((RC != 0)); then
else
echo "Runners:no changes required"
fi
rm -f runners-stream-ci-change.yaml
rm -f runners-stream-ci.yaml
$SCDIR/check-runners.sh