Skip to content
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

Enable passing DNS info to the rkt driver #892

Merged
merged 1 commit into from
Mar 10, 2016
Merged

Conversation

achanda
Copy link
Contributor

@achanda achanda commented Mar 8, 2016

Pass DNS servers and search domains to the rkt CLI. These get written to the container's resolv.conf.

@@ -183,6 +186,20 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e
// Add CPU isolator
cmdArgs = append(cmdArgs, fmt.Sprintf("--cpu=%vm", int64(task.Resources.CPU)))

// Add DNS servers
for _, ip := range driverConfig.DNSServers {
if net.ParseIP(ip) != nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if err := net.ParseIP(ip); err != nil {
   msg := fmt.Errorf("invalid ip address for container dns server %q: %v", ip, err)
   d.logger.Printf("[ERR] driver.rkt: %v", msg)
   return msg
} else {
   cmdArgs = append(cmdArgs, fmt.Sprintf("--dns=%s", ip))
}

@dadgar
Copy link
Contributor

dadgar commented Mar 8, 2016

LGTM

@achanda
Copy link
Contributor Author

achanda commented Mar 9, 2016

@dadgar ParseIP returns a nil if the given string is not an IP. So, I toggled the check.

// Add DNS servers
for _, ip := range driverConfig.DNSServers {
if err := net.ParseIP(ip); err == nil {
msg := fmt.Errorf("invalid ip address for container dns server %q: %v", ip, err)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah if it is will then get rid of the ": %v" part and error in the msg. And now that I think of it, make the log level DEBUG. It is not a Nomad error

dadgar added a commit that referenced this pull request Mar 10, 2016
Enable passing DNS info to the rkt driver
@dadgar dadgar merged commit e0283ab into hashicorp:master Mar 10, 2016
@achanda achanda deleted the rkt_dns branch March 10, 2016 17:14
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants