Skip to content
Snippets Groups Projects
Commit 1384573c authored by Sören Henning's avatar Sören Henning
Browse files

Merge branch 'master' into theodolite-kotlin

parents 71bd421f 70a5b2ae
No related branches found
No related tags found
3 merge requests!159Re-implementation of Theodolite with Kotlin/Quarkus,!157Update Graal Image in CI pipeline,!83WIP: Re-implementation of Theodolite with Kotlin/Quarkus
Pipeline #2268 passed
Showing
with 124 additions and 11 deletions
...@@ -28,7 +28,7 @@ stages: ...@@ -28,7 +28,7 @@ stages:
paths: paths:
- .gradle - .gradle
before_script: before_script:
- cd benchmarks - cd theodolite-benchmarks
- export GRADLE_USER_HOME=`pwd`/.gradle - export GRADLE_USER_HOME=`pwd`/.gradle
build-benchmarks: build-benchmarks:
...@@ -37,8 +37,8 @@ build-benchmarks: ...@@ -37,8 +37,8 @@ build-benchmarks:
script: ./gradlew --build-cache assemble script: ./gradlew --build-cache assemble
artifacts: artifacts:
paths: paths:
- "benchmarks/build/libs/*.jar" - "theodolite-benchmarks/build/libs/*.jar"
- "benchmarks/*/build/distributions/*.tar" - "theodolite-benchmarks/*/build/distributions/*.tar"
expire_in: 1 day expire_in: 1 day
test-benchmarks: test-benchmarks:
...@@ -50,7 +50,7 @@ test-benchmarks: ...@@ -50,7 +50,7 @@ test-benchmarks:
artifacts: artifacts:
reports: reports:
junit: junit:
- "benchmarks/**/build/test-results/test/TEST-*.xml" - "theodolite-benchmarks/**/build/test-results/test/TEST-*.xml"
checkstyle-benchmarks: checkstyle-benchmarks:
stage: check stage: check
...@@ -61,7 +61,7 @@ checkstyle-benchmarks: ...@@ -61,7 +61,7 @@ checkstyle-benchmarks:
script: ./gradlew checkstyle --continue script: ./gradlew checkstyle --continue
artifacts: artifacts:
paths: paths:
- "benchmarks/*/build/reports/checkstyle/main.html" - "theodolite-benchmarks/*/build/reports/checkstyle/main.html"
when: on_failure when: on_failure
expire_in: 1 day expire_in: 1 day
...@@ -74,7 +74,7 @@ pmd-benchmarks: ...@@ -74,7 +74,7 @@ pmd-benchmarks:
script: ./gradlew pmd --continue script: ./gradlew pmd --continue
artifacts: artifacts:
paths: paths:
- "benchmarks/*/build/reports/pmd/*.html" - "theodolite-benchmarks/*/build/reports/pmd/*.html"
when: on_failure when: on_failure
expire_in: 1 day expire_in: 1 day
...@@ -87,7 +87,7 @@ spotbugs-benchmarks: ...@@ -87,7 +87,7 @@ spotbugs-benchmarks:
script: ./gradlew spotbugs --continue script: ./gradlew spotbugs --continue
artifacts: artifacts:
paths: paths:
- "benchmarks/*/build/reports/spotbugs/*.html" - "theodolite-benchmarks/*/build/reports/spotbugs/*.html"
when: on_failure when: on_failure
expire_in: 1 day expire_in: 1 day
...@@ -114,10 +114,10 @@ spotbugs-benchmarks: ...@@ -114,10 +114,10 @@ spotbugs-benchmarks:
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME && $CI_COMMIT_TAG" - if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME && $CI_COMMIT_TAG"
when: always when: always
- changes: - changes:
- benchmarks/* - theodolite-benchmarks/*
- benchmarks/$JAVA_PROJECT_NAME/**/* - theodolite-benchmarks/$JAVA_PROJECT_NAME/**/*
- benchmarks/application-kafkastreams-commons/**/* - theodolite-benchmarks/application-kafkastreams-commons/**/*
- benchmarks/workload-generator-commons/**/* - theodolite-benchmarks/workload-generator-commons/**/*
if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME" if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME"
when: always when: always
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME" - if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $IMAGE_NAME && $JAVA_PROJECT_NAME"
...@@ -254,3 +254,30 @@ deploy-theodolite: ...@@ -254,3 +254,30 @@ deploy-theodolite:
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW" - if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: manual when: manual
allow_failure: true allow_failure: true
# Theodolite Random Scheduler
deploy-random-scheduler:
stage: deploy
extends:
- .dind
script:
- DOCKER_TAG_NAME=$(echo $CI_COMMIT_REF_SLUG- | sed 's/^master-$//')
- docker build --pull -t theodolite-random-scheduler execution/infrastructure/random-scheduler
- "[ ! $CI_COMMIT_TAG ] && docker tag theodolite-random-scheduler $CR_HOST/$CR_ORG/theodolite-random-scheduler:${DOCKER_TAG_NAME}latest"
- "[ $CI_COMMIT_TAG ] && docker tag theodolite-random-scheduler $CR_HOST/$CR_ORG/theodolite-random-scheduler:$CI_COMMIT_TAG"
- echo $CR_PW | docker login $CR_HOST -u $CR_USER --password-stdin
- docker push $CR_HOST/$CR_ORG/theodolite-random-scheduler
- docker logout
rules:
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW && $CI_COMMIT_TAG"
when: always
- changes:
- execution/infrastructure/random-scheduler/**/*
if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: always
- if: "$CR_HOST && $CR_ORG && $CR_USER && $CR_PW"
when: manual
allow_failure: true
\ No newline at end of file
FROM alpine:3.12
RUN apk update && apk add bash curl jq
RUN curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl \
&& chmod +x ./kubectl \
&& mv ./kubectl /usr/local/bin/kubectl
ADD schedule.sh /bin/schedule
CMD /bin/schedule
# Theodolite Random Scheduler
This directory contains the Theodolite Random Scheduler that schedules pods on random nodes.
## Build and Push
Run the following commands
- `docker build -t theodolite-random-scheduler .`
- `docker tag theodolite-random-scheduler <user>/theodolite-random-scheduler`
- `docker push <user>/theodolite-random-scheduler`
## Deployment
Deploy the `deployment.yaml` file into Kubernetes. Note, that the `TARGET_NAMESPACE` environment variable specifies the operating namespace of the random scheduler.
apiVersion: apps/v1
kind: Deployment
metadata:
name: random-scheduler
labels:
app: random-scheduler
namespace: kube-system
spec:
replicas: 1
selector:
matchLabels:
app: random-scheduler
template:
metadata:
labels:
app: random-scheduler
spec:
serviceAccount: random-scheduler
containers:
- name: random-scheduler
image: ghcr.io/cau-se/theodolite-random-scheduler:latest
imagePullPolicy: Always
env:
- name: TARGET_NAMESPACE
value: default
apiVersion: v1
kind: ServiceAccount
metadata:
namespace: kube-system
name: random-scheduler
labels:
app: random-scheduler
component: random-scheduler
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: random-scheduler
subjects:
- kind: ServiceAccount
name: random-scheduler
namespace: kube-system
roleRef:
kind: ClusterRole
apiGroup: rbac.authorization.k8s.io
name: system:kube-scheduler
\ No newline at end of file
#!/bin/bash
# use kubectl in proxy mode in order to allow curl requesting the k8's api server
kubectl proxy --port 8080 &
echo "Target Namespace: $TARGET_NAMESPACE"
while true;
do
for PODNAME in $(kubectl get pods -n $TARGET_NAMESPACE -o json | jq '.items[] | select(.spec.schedulerName == "random-scheduler") | select(.spec.nodeName == null) | .metadata.name' | tr -d '"');
do
NODES=($(kubectl get nodes -o json | jq '.items[].metadata.name' | tr -d '"'))
NUMNODES=${#NODES[@]}
CHOSEN=${NODES[$[$RANDOM % $NUMNODES]]}
curl --header "Content-Type:application/json" --request POST --data '{"apiVersion":"v1", "kind": "Binding", "metadata": {"name": "'$PODNAME'"}, "target": {"apiVersion": "v1", "kind": "Node", "name": "'$CHOSEN'"}}' localhost:8080/api/v1/namespaces/$TARGET_NAMESPACE/pods/$PODNAME/binding/
echo "Assigned $PODNAME to $CHOSEN"
done
sleep 1
done
\ No newline at end of file
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment