Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

e2e limits_file_watcher_on_docker #387

Merged
merged 1 commit into from
Nov 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Comment on lines +29 to +30
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a comment to warn about some configuration that, for unknown reason to me yet, events are not triggered when the file changes. That happens exactly when the file is mounted.

When the parent dir is mounted, then events are triggered whenever the limits file is updated.

- ./:/opt/kuadrant/limits
Loading