Skip to content
This repository was archived by the owner on Jan 19, 2024. It is now read-only.

Commit 7072fdd

Browse files
authored
Exercise for readiness and liveness probes added. (#3)
* Exercise for readiness and liveness probes added. * Bugfix in reading JWT encryption and signing keys from ENV variable * Microgateway updated to 3.0.1 * check ready state is reached in verification
1 parent abea65c commit 7072fdd

File tree

7 files changed

+65
-4
lines changed

7 files changed

+65
-4
lines changed

.scripts/verify.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ else
2323
exit 1
2424
fi
2525

26+
mgw_ready_count="$(kubectl get pod -l app=microgateway | grep 1/1 | wc -l)"
27+
28+
if [[ $mgw_ready_count -eq 1 ]]; then
29+
echo "OK: Microgateway is ready"
30+
else
31+
echo "NOK: Microgateway is not running - number of pods ready: $mgw_ready_count"
32+
exit 1
33+
fi
34+
2635
if [[ -f "${TUTORIAL_DIR}/../.scripts/verify.sh" ]]; then
2736
${TUTORIAL_DIR}/../.scripts/verify.sh
2837
fi

.templates/microgateway/deployment.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ spec:
2222
- name: dockerregcred
2323
initContainers:
2424
- name: configbuilder
25-
image: docker.io/ergon/airlock-microgateway-configbuilder:3.0.0
25+
image: docker.io/ergon/airlock-microgateway-configbuilder:3.0.1
2626
imagePullPolicy: IfNotPresent
2727
volumeMounts:
2828
- name: config
@@ -44,7 +44,7 @@ spec:
4444
value: "Europe/Zurich"
4545
containers:
4646
- name: microgateway
47-
image: docker.io/ergon/airlock-microgateway:3.0.0
47+
image: docker.io/ergon/airlock-microgateway:3.0.1
4848
imagePullPolicy: IfNotPresent
4949
volumeMounts:
5050
- name: config-files

.templates/wordpress/config/install-simple-jwt-login.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ wp plugin install /var/tmp/plugins/simple-jwt-login/simple-jwt-login.zip --activ
33
wp option update simple_jwt_login_settings "
44
{
55
\"route_namespace\":\"simple-jwt-login\/v1\/\",
6-
\"decryption_key\":\"${JWT_DECRYPTION_KEY2:-c3VwZXJsb25ndGV4dHRoYXRpc3VzZWRmb3Jqd3R0b2tlbgo=}\",
6+
\"decryption_key\":\"${JWT_DECRYPTION_KEY:-c3VwZXJsb25ndGV4dHRoYXRpc3VzZWRmb3Jqd3R0b2tlbgo=}\",
77
\"jwt_algorithm\":\"HS512\",
88
\"jwt_login_by\":0,
99
\"jwt_login_by_parameter\":\"email\",
@@ -19,7 +19,7 @@ wp option update simple_jwt_login_settings "
1919
\"require_register_auth\":true,
2020
\"auth_codes\":[
2121
{
22-
\"code\":\"${JWT_AUTH_CODE2:-superlongtextthatisusedforjwttoken}\",
22+
\"code\":\"${JWT_AUTH_CODE:-superlongtextthatisusedforjwttoken}\",
2323
\"role\":\"\",
2424
\"expiration_date\":\"\"
2525
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
5+
bases:
6+
- ../solution
7+
8+
patchesStrategicMerge:
9+
- patch-probes.yaml
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
apiVersion: apps/v1
3+
kind: Deployment
4+
metadata:
5+
name: microgateway
6+
spec:
7+
template:
8+
spec:
9+
containers:
10+
- name: microgateway
11+
readinessProbe:
12+
httpGet:
13+
port: 443
14+
livenessProbe:
15+
httpGet:
16+
port: 443
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
apps:
3+
- virtual_host:
4+
name: echoserver
5+
hostname: echoserver.virtinc.local
6+
mappings:
7+
- name: echoserver
8+
backend:
9+
name: echoserver
10+
hosts:
11+
- name: echoserver
12+
protocol: http
13+
port: 8080
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
apiVersion: kustomize.config.k8s.io/v1beta1
3+
kind: Kustomization
4+
5+
bases:
6+
- ../../.templates/ingress
7+
- ../../.templates/microgateway
8+
- ../../.templates/echoserver
9+
10+
configMapGenerator:
11+
- name: microgateway-config
12+
behavior: replace
13+
files:
14+
- config/config.yaml

0 commit comments

Comments
 (0)