-
Notifications
You must be signed in to change notification settings - Fork 664
Add DNS lookup plugin #1080
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
adrianmoisey
wants to merge
1
commit into
kubernetes:master
Choose a base branch
from
adrianmoisey:add-dns-test
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+30
−0
Open
Add DNS lookup plugin #1080
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,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 to the Kubernetes host 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 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getent
seems the most common tool available in a host, but do we want to usehosts
ornslookup
just in casegetent
is not available?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I picked it since I assumed it would be the most available. I could change the logic to fall back to other tools, if
getent
isn't available?May be in this order:
getent
host
nslookup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will be good to know what install each tool in debian and red hat per example, I think gerent comes as part as libc so that makes it pretty common
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using containers, and I don't know if that's a good idea:
Red Hat:
Debian:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems getent is the way to go