Skip to content

Commit

Permalink
Merge pull request #1021 from kruize/mvp_demo
Browse files Browse the repository at this point in the history
Merge 0.0.20_rm changes from mvp_demo to master
  • Loading branch information
dinogun authored Nov 3, 2023
2 parents bd203f3 + d66f896 commit 032dce5
Show file tree
Hide file tree
Showing 80 changed files with 5,634 additions and 3,468 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/get-pr-number.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Get PR Number

on:
workflow_call:
outputs:
pr_number:
value: ${{ jobs.get_pr_number.outputs.output1 }}

jobs:
get_pr_number:
runs-on: ubuntu-latest
outputs:
output1: ${{ steps.pr.outputs.pr_number }}
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Get PR number
id: pr
run: |
echo "Commit SHA: ${{ github.sha }}"
pr_number=$(curl -s -X GET \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}/commits/${{ github.sha }}/pulls" \
| jq -r '.[0].number')
echo "pr_number=${pr_number}"
echo "pr_number=${pr_number}" >> $GITHUB_OUTPUT
11 changes: 10 additions & 1 deletion .github/workflows/rm-release-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@ jobs:
echo Running Kruize remote monitoring functional testsuite on minikube
cd tests
./test_autotune.sh -c minikube -i ${{ github.event.inputs.image }} --testsuite=remote_monitoring_tests --resultsdir=${GITHUB_WORKSPACE}
- name: Run Kruize remote monitoring stress test on minikube
if: always()
run: |
ps -ef | grep python
echo Running Kruize remote monitoring stress test on minikube
cd autotune
cd tests/scripts/remote_monitoring_tests/stress_test
./remote_monitoring_stress_test.sh -c minikube -i ${{ github.event.inputs.image }} -u 100 -e 30 -d 120 -t 1200 -r ${GITHUB_WORKSPACE}
- name: Run Kruize remote monitoring fault tolerant tests on minikube
if: always()
Expand All @@ -43,7 +52,7 @@ jobs:
run: |
cd ${GITHUB_WORKSPACE}
ls
tar cvf kruize_test_results.tar kruize_test_results
tar cvf kruize_release_test_results.tar kruize_test_results remote-monitoring*
ls
- name: Upload results
Expand Down
72 changes: 67 additions & 5 deletions .github/workflows/test-on-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,9 @@ jobs:
- name: Build autotune
run: |
echo Build autotune
./build.sh -i autotune_operator:test
pr_number=${{ github.event.pull_request.number }}
echo "pr_number=${pr_number}" >> "$GITHUB_ENV"
./build.sh -i autotune_operator:pr_${pr_number}
docker images | grep autotune
- name: Check cluster info on minikube
run: |
Expand All @@ -48,11 +50,15 @@ jobs:
echo "***************************************************************"
cat ./manifests/autotune/autotune-operator-deployment.yaml_template
echo "***************************************************************"
./deploy.sh -c minikube -i autotune_operator:test
echo "PR_NUMBER = ${{ env.pr_number }}"
./deploy.sh -c minikube -i autotune_operator:pr_${{ env.pr_number }}
sleep 20
- name: Capture ffdc logs
if: always()
run: |
echo "Capturing ffdc logs"
./scripts/ffdc.sh -d ${GITHUB_WORKSPACE}
- name: Archive results
if: always()
Expand All @@ -76,6 +82,8 @@ jobs:
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
with:
repository: kruize/autotune
- name: Setup Minikube
uses: manusa/[email protected]
with:
Expand All @@ -84,7 +92,9 @@ jobs:
- name: Build crc
run: |
echo Build crc
./build.sh -i autotune_operator:test
pr_number=${{ github.event.pull_request.number }}
echo "pr_number=${pr_number}" >> "$GITHUB_ENV"
./build.sh -i autotune_operator:pr_${pr_number}
docker images | grep autotune
- name: Check cluster info on minikube
run: |
Expand All @@ -102,12 +112,13 @@ jobs:
cp ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml.old
sed -e "s/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g" ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml.old > ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml
cat ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml
cd tests
./test_autotune.sh -c minikube -i autotune_operator:test --testsuite=remote_monitoring_tests --testcase=test_e2e --resultsdir=${GITHUB_WORKSPACE}
echo "PR_NUMBER = ${{ env.pr_number }}"
./test_autotune.sh -c minikube -i autotune_operator:pr_${{ env.pr_number }} --testsuite=remote_monitoring_tests --testcase=test_e2e --resultsdir=${GITHUB_WORKSPACE}
- name: Capture ffdc logs
if: always()
run: |
echo "Capturing ffdc logs"
./scripts/ffdc.sh -m crc -d ${GITHUB_WORKSPACE}/kruize_test_results
- name: Archive results
if: always()
Expand All @@ -123,3 +134,54 @@ jobs:
path: ./crc_results.tar
retention-days: 2


test_crc_manifest_build:
# The type of runner that the job will run on
runs-on: ubuntu-20.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Setup Minikube
uses: manusa/[email protected]
with:
minikube version: 'v1.16.0'
kubernetes version: 'v1.19.2'

- name: Check cluster info on minikube
run: |
kubectl cluster-info
kubectl get pods -n kube-system
- name: Install Prometheus on minikube
run: |
echo Install Prometheus on minikube
cd scripts
./prometheus_on_minikube.sh -as
- name: Test with manifest kruize build in crc mode
run: |
echo Test with manifest kruize build in crc mode
echo "***************************************************************"
cd tests
./test_autotune.sh -c minikube --testsuite=remote_monitoring_tests --testcase=test_e2e --resultsdir=${GITHUB_WORKSPACE}
- name: Capture ffdc logs
if: always()
run: |
./scripts/ffdc.sh -m crc -d ${GITHUB_WORKSPACE}/kruize_test_results
- name: Archive results
if: always()
run: |
cd ${GITHUB_WORKSPACE}
tar cvf crc_manifest_results.tar kruize_test_results
- name: Upload results
if: always()
uses: actions/upload-artifact@v3
with:
name: crc-manifest-results
path: ./crc_manifest_results.tar
retention-days: 2

35 changes: 26 additions & 9 deletions .github/workflows/test-on-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,26 @@ on:
workflow_dispatch:

jobs:
get_pr:
uses: ./.github/workflows/get-pr-number.yaml

# This workflow contains three jobs called "build job" , "deploy autotune" and "deploy crc"
build_job:
needs: get_pr
# The type of runner that the job will run on
runs-on: ubuntu-20.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Get PR number
run: |
echo "PR_NUMBER=${{ needs.get_pr.outputs.pr_number }}" >> $GITHUB_ENV
- name: Build monitoring
run: |
echo Build monitoring
./build.sh -i autotune_operator:test -o autotune_optuna:test
./build.sh -i autotune_operator:pr_${{ env.PR_NUMBER }} -o autotune_optuna:pr_${{ env.PR_NUMBER }}
docker images | grep autotune
- name: docker login
uses: docker/login-action@v2
Expand All @@ -35,17 +43,21 @@ jobs:
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Push
run: |
docker tag autotune_operator:test kruize/autotune_operator:test
docker push kruize/autotune_operator:test
docker tag autotune_operator:pr_${{ env.PR_NUMBER }} kruize/autotune_operator:pr_${{ env.PR_NUMBER }}
docker push kruize/autotune_operator:pr_${{ env.PR_NUMBER }}
deploy_autotune:
# The type of runner that the job will run on
needs: build_job
needs: [build_job, get_pr]

runs-on: ubuntu-20.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Get PR number
run: |
echo "PR_NUMBER=${{ needs.get_pr.outputs.pr_number }}" >> $GITHUB_ENV
- name: Setup Minikube
uses: manusa/[email protected]
with:
Expand All @@ -57,13 +69,14 @@ jobs:
kubectl get pods -n kube-system
- name: Install Prometheus on minikube
run: |
echo Install Prometheus on minikube
echo Install Prometheus on minikube
cd scripts
./prometheus_on_minikube.sh -as
- name: Deploy kruize in experiment mode
run: |
echo Deploy Kruize in experiment mode
./deploy.sh -c minikube -i kruize/autotune_operator:test
echo "PR_NUMBER = ${{ env.PR_NUMBER }}"
./deploy.sh -c minikube -i kruize/autotune_operator:pr_${{ env.PR_NUMBER }}
sleep 20
- name: Capture ffdc logs
if: always()
Expand All @@ -85,12 +98,15 @@ jobs:

deploy_crc:
# The type of runner that the job will run on
needs: build_job
needs: [build_job, get_pr]
runs-on: ubuntu-20.04

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- name: Get PR number
run: |
echo "PR_NUMBER=${{ needs.get_pr.outputs.pr_number }}" >> $GITHUB_ENV
- name: Setup Minikube
uses: manusa/[email protected]
with:
Expand All @@ -102,7 +118,7 @@ jobs:
kubectl get pods -n kube-system
- name: Install Prometheus on minikube
run: |
echo Install Prometheus on minikube
echo Install Prometheus on minikube
cd scripts
./prometheus_on_minikube.sh -as
- name: Deploy Kruize in crc mode
Expand All @@ -113,7 +129,8 @@ jobs:
sed -e "s/imagePullPolicy: Always/imagePullPolicy: IfNotPresent/g" ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml.old > ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml
cat ./manifests/crc/default-db-included-installation/minikube/kruize-crc-minikube.yaml
cd tests
./test_autotune.sh -c minikube -i kruize/autotune_operator:test --testsuite=remote_monitoring_tests --testcase=test_e2e --resultsdir=${GITHUB_WORKSPACE}
echo "PR_NUMBER = ${{ env.PR_NUMBER }}"
./test_autotune.sh -c minikube -i kruize/autotune_operator:pr_${{ env.PR_NUMBER }} --testsuite=remote_monitoring_tests --testcase=test_e2e --resultsdir=${GITHUB_WORKSPACE}
- name: Capture ffdc logs
if: always()
run: |
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__pycache__/
9 changes: 8 additions & 1 deletion deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ target="autotune"
# docker: loop timeout is turned off by default
timeout=-1

# Test with the kruize docker image specified in the deployment yaml
use_yaml_build=0

function ctrlc_handler() {
# Check if cluster type is docker
if [[ "$cluster_type" == "docker" ]]; then
Expand All @@ -103,6 +106,7 @@ function usage() {
echo " -n: Namespace to which autotune is deployed [Default - monitoring namespace for cluster type minikube]"
echo " -d: Config maps directory [Default - manifests/configmaps]"
echo " -m: Target mode selection [autotune | crc]"
echo " -b: Test with the kruize docker image in the deployment yaml"
exit -1
}

Expand All @@ -119,7 +123,7 @@ function check_cluster_type() {
}

# Iterate through the commandline options
while getopts ac:d:i:k:m:n:o:p:stu:-: gopts; do
while getopts ac:d:i:k:m:n:o:p:stub-: gopts; do
case ${gopts} in
-)
case "${OPTARG}" in
Expand Down Expand Up @@ -171,6 +175,9 @@ while getopts ac:d:i:k:m:n:o:p:stu:-: gopts; do
u)
KRUIZE_UI_DOCKER_IMAGE="${OPTARG}"
;;
b)
use_yaml_build=1
;;
[?])
usage
;;
Expand Down
Loading

0 comments on commit 032dce5

Please sign in to comment.