Skip to content

Commit

Permalink
e2e limits_file_watcher_on_docker
Browse files Browse the repository at this point in the history
Signed-off-by: Eguzki Astiz Lezaun <[email protected]>
  • Loading branch information
eguzki committed Nov 20, 2024
1 parent b41e335 commit ea9bce8
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 4 deletions.
49 changes: 47 additions & 2 deletions .github/workflows/e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
command: |
ip=$(kubectl get nodes -lkubernetes.io/hostname!=kind-control-plane -ojsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}')
port=$(kubectl get service limitador -o jsonpath='{.spec.ports[?(@.name=="http")].nodePort}')
curl -s "http://${ip}:${port}/limits/test" | tee output-limits.json
curl -s "http://${ip}:${port}/limits/test" | tee output-limits.json
jq --exit-status '.[] | select(.max_value == 1000)' output-limits.json
- name: Update limit in the configmap
run: |
Expand All @@ -87,5 +87,50 @@ jobs:
command: |
ip=$(kubectl get nodes -lkubernetes.io/hostname!=kind-control-plane -ojsonpath='{.items[*].status.addresses[?(@.type=="InternalIP")].address}')
port=$(kubectl get service limitador -o jsonpath='{.spec.ports[?(@.name=="http")].nodePort}')
curl -s "http://${ip}:${port}/limits/test" | tee output-limits-new.json
curl -s "http://${ip}:${port}/limits/test" | tee output-limits-new.json
jq --exit-status '.[] | select(.max_value == 2000)' output-limits-new.json
limits_file_watcher_on_docker:
name: Limits File Watcher in docker environment
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Run docker compose
run: |
docker compose -f ./limitador-server/sandbox/docker-compose-limitador-memory.yaml up -d
- name: Wait for limitador availability
uses: nick-fields/retry@v2
with:
timeout_seconds: 10
max_attempts: 10
command: |
curl --fail -s "http://127.0.0.1:18080/status"
- name: Read limits from HTTP endpoint
uses: nick-fields/retry@v2
with:
timeout_seconds: 10
max_attempts: 10
command: |
curl -s "http://127.0.0.1:18080/limits/test_namespace" | tee output-limits.json
NUM_LIMITS=$(jq --exit-status 'length' output-limits.json) && test ${NUM_LIMITS} -eq 3
- name: Update limits
run: |
cat <<EOF >> ./limitador-server/sandbox/limits.yaml
- namespace: other_namespace
max_value: 1
seconds: 10
conditions:
- "a == '1'"
variables: []
EOF
- name: Read new limits from HTTP endpoint
uses: nick-fields/retry@v2
with:
timeout_seconds: 10
max_attempts: 10
retry_wait_seconds: 30
command: |
curl -s "http://127.0.0.1:18080/limits/other_namespace" | tee other-limits.json
NUM_LIMITS=$(jq --exit-status 'length' other-limits.json) && test ${NUM_LIMITS} -eq 1
5 changes: 3 additions & 2 deletions limitador-server/sandbox/docker-compose-limitador-memory.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
version: '3.8'
services:
limitador:
image: ${LIMITADOR_IMAGE:-limitador-testing}
Expand Down Expand Up @@ -27,4 +26,6 @@ services:
- "18080:8080"
- "18081:8081"
volumes:
- ./limits.yaml:/opt/kuadrant/limits/limits.yaml
# the entire path needs to be mounted
# or inotify events are not triggered for updates on the mounted file
- ./:/opt/kuadrant/limits

0 comments on commit ea9bce8

Please sign in to comment.