-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add DNS check to bootstrap #164
Conversation
Sometimes DNS is not configured correctly, but during the launcher process DNS is required to setup all the needed resources. This creates a check by creating a pod where nslookup is performed.
bootstrap/main.go
Outdated
@@ -111,6 +111,21 @@ func mainImpl() { | |||
} | |||
} | |||
|
|||
// TODO: Should we check always? |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
bootstrap/main.go
Outdated
// able to connect to the server to correctly setup the needed resources. | ||
if !ok { | ||
fmt.Println("DNS is not working in this Kubernetes cluster. We require correct DNS setup in the Kubernetes cluster.") | ||
os.Exit(1) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
ns := "weave" | ||
|
||
// Create weave namespace, as this happens before any resources are created. | ||
_, err := CreateNamespace(c, ns) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
pkg/kubectl/kubectl.go
Outdated
} | ||
|
||
// Create pod to perform nslookup on a passed domain to check DNS is working. | ||
_, err = Execute(c, "run", "-n", "weave", "--image", "busybox", "--command", podName, "nslookup --timeout=10", domain, "--restart=Never", "--pod-running-timeout=10s") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Looks good! Just some minor questions! |
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.
Approach looks to me, a couple of additional comment.
pkg/kubectl/kubectl.go
Outdated
} | ||
|
||
// Create pod to perform nslookup on a passed domain to check DNS is working. | ||
_, err = Execute(c, "run", "-n", "weave", "--image", "busybox", "--command", podName, "nslookup --timeout=10", domain, "--restart=Never", "--pod-running-timeout=10s") |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
pkg/kubectl/kubectl.go
Outdated
} | ||
|
||
// Get fresh pod data. | ||
podJSON, err = Execute(c, "get", "pod", podName, "-ojson", "-n", ns) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
pkg/kubectl/kubectl.go
Outdated
// ExecuteJSON execute kubectl <args> and returns the combined json stdout and err output. | ||
func ExecuteJSON(c client, args ...string) (string, error) { | ||
return c.Execute(append(args, "-ojson")) | ||
} |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@dlespiau @leth PTALA, thanks!
|
BTW not sure what's up with tests not running? :/ Could it be because I have this branch on my fork, did not have a look at circle ci setup yet in this project. |
Ah yes, we push branches on the same repo. The reason is that we don't want anyone being able to start a test run by just opening a pull request (it could be a pull request with a commit changing what the tests will be running). The "Build forked pull requests" option in CircleCI is turned off for this project. This way we make sure that only people with the rights to push to this repository can run test code in CI. |
Adding a line on stdout saying that we're doing a pre-flight check sounds really useful "Checking the Kubernetes installation" or similar. It'll be especially useful for people having to wait for that 1 minute timeout, making it not awful! |
Closing in favor of #166 to let the tests run. |
Sometimes DNS is not configured correctly, but during the launcher
process, DNS is required to setup all the needed resources. This creates
a check by creating a pod where nslookup is performed.
Closes #158.
Note: Opened as more of a preview PR, if we agree on this implementation will add a test or two to this PR. :)