Merge pull request #1080 from adrianmoisey/add-dns-test
CodeQL / Analyze (go) (push) Failing after 51s
Scorecard supply-chain security / Scorecard analysis (push) Failing after 42s

Add DNS lookup plugin
This commit is contained in:
Kubernetes Prow Robot
2025-10-05 03:42:57 -07:00
committed by GitHub
2 changed files with 30 additions and 0 deletions
+6
View File
@@ -15,6 +15,12 @@
"reason": "ConntrackFull",
"path": "./config/plugin/network_problem.sh",
"timeout": "3s"
},
{
"type": "temporary",
"reason": "DNSUnreachable",
"path": "./config/plugin/dns_problem.sh",
"timeout": "3s"
}
]
}
+24
View File
@@ -0,0 +1,24 @@
#!/bin/bash
# This plugin checks for dns network issues.
readonly OK=0
readonly NONOK=1
readonly UNKNOWN=2
readonly KUBERNETES_SERVICE='kubernetes.default'
# Check getent command is present
if ! command -v getent >/dev/null; then
echo "Could not find 'getent' - require getent"
exit $UNKNOWN
fi
# Return success if a DNS lookup of the kubernetes service is successful
if getent hosts "${KUBERNETES_SERVICE}" >/dev/null; then
echo "DNS lookup to ${KUBERNETES_SERVICE} is working"
exit $OK
else
echo "DNS lookup to ${KUBERNETES_SERVICE} is not working"
exit $NONOK
fi