Skip to content

Equinix k8s Action #323

Equinix k8s Action

Equinix k8s Action #323

name: Equinix k8s Action
on:
workflow_dispatch:
inputs:
termination_time:
description: 'Cluster termination time in hours after now'
required: true
default: '1'
control_plan:
description: 'control plane machine type'
required: false
default: 'c3.small.x86'
node_plan:
description: 'node machine type'
required: false
default: 'c3.small.x86'
metro:
description: 'metro location'
required: false
default: 'da'
schedule:
- cron: '0 18 * * *'
permissions:
pull-requests: write
contents: write
repository-projects: write
packages: write
jobs:
Create-k8s-cluster:
name: "Create Cluster"
uses: ./.github/workflows/create_equinix_k8s_cluster.yml
secrets: inherit
with:
termination_time: ${{ github.event.inputs.termination_time || '1' }}
control_plan: ${{ github.event.inputs.control_plan }}
node_plan: ${{ github.event.inputs.node_plan }}
metro: ${{ github.event.inputs.metro }}
Test-K8s:
name: "Test K8s"
needs: Create-k8s-cluster
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Config kube
uses: ./.github/actions/kube_config
with:
## kube config
artifact_name: kubeconfig-${{ github.run_id }}
- name: Set up Kepler
uses: ./.github/actions/setup_kepler
- name: Pull kube-burner
run: |
git clone https://github.com/kube-burner/kube-burner
curl -sS -L "https://github.com/kube-burner/kube-burner/releases/download/v1.9.5/kube-burner-V1.9.5-linux-x86_64.tar.gz" | tar -xzC kube-burner/ kube-burner
- name: Run kube-burner node-density
run: |
cp kube-burner/examples/metrics-profiles/metrics.yaml kube-burner/examples/workloads/kubelet-density/metrics.yaml
cd kube-burner/examples/workloads/kubelet-density
sed -i 's/qps: 2/qps: 20/g' kubelet-density.yml
sed -i 's/burst: 2/burst: 20/g' kubelet-density.yml
sed -i 's/jobIterations: 25/jobIterations: 80/g' kubelet-density.yml
echo "indexers:" >> kubelet-density.yml
echo " - type: local" >> kubelet-density.yml
echo " metricsDirectory: collected-metrics" >> kubelet-density.yml
export START_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
../../../kube-burner init -c kubelet-density.yml -u http://localhost:9090 --metrics-profile metrics.yaml
# sleep a min after test
sleep 60
export END_TIME=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
touch /tmp/kepler-stress-test-metrics.txt
# Retrieve metrics related to Kepler cpu and memory utilization over time
curl -G 'http://localhost:9090/api/v1/query_range' \
--data-urlencode 'query=sum (rate (container_cpu_usage_seconds_total{namespace="kepler"}[1m])) / sum(machine_cpu_cores) * 100' \
--data-urlencode "start=${START_TIME}" --data-urlencode "end=${END_TIME}" --data-urlencode "step=5" \
| jq -r '.data.result[0].values[] | @tsv' | awk '{printf "Time: %s, Utilization: %s%%\n", strftime("%Y-%m-%d %H:%M:%S", $1), $2}' \
| tee /tmp/kepler-stress-test-metrics.txt
# Retrieve the kube-apiserver cpu and memory utilization over time
curl -G 'http://localhost:9090/api/v1/query_range' \
--data-urlencode 'query=sum (rate (container_cpu_usage_seconds_total{namespace="kube-system", pod=~"kube-apiserver-.*"}[1m])) / sum(machine_cpu_cores) * 100' \
--data-urlencode "start=${START_TIME}" --data-urlencode "end=${END_TIME}" --data-urlencode "step=5" \
| jq -r '.data.result[0].values[] | @tsv' | awk '{printf "Time: %s, Utilization: %s%%\n", strftime("%Y-%m-%d %H:%M:%S", $1), $2}' \
| tee -a /tmp/kepler-stress-test-kube-apiserver-metrics.txt
cd ${GITHUB_WORKSPACE}
echo -n "| " $END_TIME >> docs/kepler-stress-test-metrics.md
MEAN_SD_OUTPUT=$(./util/calc_mean_sd.awk /tmp/kepler-stress-test-metrics.txt)
KUBE_APISERVER_MEAN_SD_OUTPUT=$(./util/calc_mean_sd.awk /tmp/kepler-stress-test-kube-apiserver-metrics.txt)
echo $MEAN_SD_OUTPUT " " $KUBE_APISERVER_MEAN_SD_OUTPUT >> docs/kepler-stress-test-metrics.md
- name: git add the /tmp/kepler-stress-test-metrics.txt
run: |
git config --global user.email "dependabot[bot]@users.noreply.github.com"
git config --global user.name "dependabot[bot]"
git add docs/kepler-stress-test-metrics.md
git commit -m "kepler stress test metrics result at ${END_TIME}" -s
git push origin main
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}