feat(providers): add provider.auto-stop-on-startup argument (#346)

This feature adds the capability to stop unregistered running instances upon startup.

Previously, you had to stop running instances manually or issue an initial request that will shut down instances afterwards.

With this change, all discovered instances will be shutdown. They need to be registered using labels. E.g.: sablier.enable=true

Fixes #153
This commit is contained in:
Alexis Couvreur
2024-07-04 12:06:21 -04:00
parent fbb6e38d53
commit dfb9bacf59
68 changed files with 1116 additions and 106 deletions

View File

@@ -24,9 +24,15 @@ services:
whoami:
image: containous/whoami:v1.5.0
labels:
- sablier.enable=true
- sablier.group=E2E
nginx:
image: nginx:1.27.0
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 5s
interval: 5s
labels:
- sablier.enable=true
- sablier.group=E2E

View File

@@ -79,4 +79,14 @@ server {
set $sablierDynamicTheme hacker-terminal;
js_content sablier.call;
}
location /group {
set $sablierDynamicShowDetails true;
set $sablierDynamicRefreshFrequency 5s;
set $sablierNginxInternalRedirect @whoami;
set $sablierGroup E2E;
set $sablierDynamicName "Group E2E";
set $sablierDynamicTheme hacker-terminal;
js_content sablier.call;
}
}

View File

@@ -10,7 +10,6 @@ docker version
prepare_docker_classic() {
docker compose -f $DOCKER_COMPOSE_FILE -p $DOCKER_COMPOSE_PROJECT_NAME up -d
docker compose -f $DOCKER_COMPOSE_FILE -p $DOCKER_COMPOSE_PROJECT_NAME stop whoami nginx
}
destroy_docker_classic() {
@@ -35,5 +34,6 @@ run_docker_classic_test Test_Dynamic
run_docker_classic_test Test_Blocking
run_docker_classic_test Test_Multiple
run_docker_classic_test Test_Healthy
run_docker_classic_test Test_Group
exit $errors

View File

@@ -28,6 +28,9 @@ services:
whoami:
image: containous/whoami:v1.5.0
deploy:
labels:
- sablier.enable=true
- sablier.group=E2E
replicas: 0
nginx:
@@ -36,4 +39,7 @@ services:
test: ["CMD", "curl", "-f", "http://localhost"]
interval: 5s
deploy:
labels:
- sablier.enable=true
- sablier.group=E2E
replicas: 0

View File

@@ -79,4 +79,14 @@ server {
set $sablierDynamicTheme hacker-terminal;
js_content sablier.call;
}
location /group {
set $sablierDynamicShowDetails true;
set $sablierDynamicRefreshFrequency 5s;
set $sablierNginxInternalRedirect @whoami;
set $sablierGroup E2E;
set $sablierDynamicName "Group E2E";
set $sablierDynamicTheme hacker-terminal;
js_content sablier.call;
}
}

View File

@@ -47,5 +47,6 @@ run_docker_swarm_test Test_Dynamic
run_docker_swarm_test Test_Blocking
run_docker_swarm_test Test_Multiple
run_docker_swarm_test Test_Healthy
run_docker_swarm_test Test_Group
exit $errors

View File

@@ -4,6 +4,8 @@ metadata:
name: whoami-deployment
labels:
app: whoami
sablier.enable: true
sablier.group: E2E
spec:
replicas: 0
selector:
@@ -36,6 +38,8 @@ metadata:
name: nginx-deployment
labels:
app: nginx
sablier.enable: true
sablier.group: E2E
spec:
replicas: 0
selector:
@@ -98,4 +102,23 @@ spec:
service:
name: nginx-service
port:
number: 80
number: 80
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: group-ingress
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: localhost
http:
paths:
- path: /group
pathType: Prefix
backend:
service:
name: nginx-service
port:
number: 80

View File

@@ -16,7 +16,6 @@ spec:
app: sablier
spec:
serviceAccountName: sablier
serviceAccount: sablier
containers:
- name: sablier
image: acouvreur/sablier:local