-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
548ac2f
commit f5b0ce3
Showing
4 changed files
with
28 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
# Charm Pebble health checks | ||
command: | ||
{{ if .Vars.enable_pebble_tests }} | ||
{{ if .Vars.enable_pebble_tests }} | ||
# $root is required to access the root context of the current template, | ||
# which refers to the entire data structure being passed into the template. | ||
# This provides access to .Vars and .Env in loops like the one below. | ||
{{- $root := . -}} | ||
{{range $app := .Vars.apps.k8s}} | ||
pebble-{{$app.name}}: | ||
exec: juju ssh -m {{ $root.Vars.model_name }} {{$app.name}}/0 /charm/bin/pebble health | ||
exit-status: 0 | ||
stdout: | ||
have-patterns: | ||
- healthy | ||
stderr: "" | ||
pebble-{{$app.name}}: | ||
exec: juju ssh -m {{ $root.Vars.model_name }} {{$app.name}}/0 /charm/bin/pebble health | ||
exit-status: 0 | ||
stdout: | ||
have-patterns: | ||
- healthy | ||
stderr: "" | ||
{{end}} | ||
{{end}} | ||
k8s-charms: | ||
exec: bash goss/scripts/test-k8s-probes.sh | ||
exit-status: 0 | ||
stdout: "" | ||
stderr: "" | ||
{{end}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
pod_ips=$(kubectl get pods -n cos-model -o jsonpath='{.items[*].status.podIP}' | tr ' ' '\n') | ||
|
||
# Loop over each IP address | ||
echo "$pod_ips" | while IFS= read -r ip; do | ||
|
||
health=$(curl -sL http://$ip:38812/v1/health | jq -r '.result.healthy') | ||
if [ "$health" != "true" ]; then | ||
echo "Curl failed for $ip" | ||
fi | ||
done |