-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
changing the folder name to be plural and added a new node monitor to…
… test if there is a node stuck in the "notready" state.
- Loading branch information
1 parent
8cc37a3
commit e0dc474
Showing
4 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,43 @@ | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: node-not-ready-cron | ||
namespace: default | ||
spec: | ||
schedule: "*/5 * * * *" | ||
jobTemplate: | ||
spec: | ||
template: | ||
metadata: | ||
labels: | ||
app: gen3job | ||
spec: | ||
serviceAccountName: node-monitor | ||
containers: | ||
- name: kubectl | ||
image: quay.io/cdis/awshelper | ||
env: | ||
- name: SLACK_WEBHOOK_URL | ||
valueFrom: | ||
configMapKeyRef: | ||
name: global | ||
key: slack_webhook | ||
|
||
command: ["/bin/bash"] | ||
args: | ||
- "-c" | ||
- | | ||
#!/bin/sh | ||
# Get nodes that show "NodeStatusNeverUpdated" | ||
NODES=$(kubectl get nodes -o json | jq -r '.items[] | select(.status.conditions[] | select(.type == "Ready" and .status == "Unknown")) | .metadata.name') | ||
if [ -n "$NODES" ]; then | ||
echo "Nodes reporting 'NodeStatusNeverUpdated', sending an alert:" | ||
echo "$NODES" | ||
# Send alert to Slack | ||
curl -X POST -H 'Content-type: application/json' --data "{\"text\":\"WARNING: Node \`${NODES}\` is stuck in "NotReady"!\"}" $SLACK_WEBHOOK_URL | ||
else | ||
echo "No nodes reporting 'NodeStatusNeverUpdated'" | ||
fi | ||
restartPolicy: OnFailure |