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

Fix rkt volumes #2027

Merged
merged 4 commits into from
Nov 28, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
## 0.5.1 (Unreleased)

IMPROVEMENTS:
* driver/rkt: Support rkt's `--dns=host` and `--dns=none` options [GH-2028]

BUG FIXES:
* agent/config: Fix use of IPv6 addresses [GH-2036]
* cli: Improve parsing error when a job without a name is specified [GH-2030]
* client: Fix race on StreamFramer Destroy which would cause a panic [GH-2007]
* driver/docker: Make container exist errors non-retriable by task runner
[GH-2033]
* driver/rkt: Fix validation of rkt volumes [GH-2027]

## 0.5.0 (November 16, 2016)

Expand Down
22 changes: 15 additions & 7 deletions client/driver/rkt.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ func (d *RktDriver) Validate(config map[string]interface{}) error {
"debug": &fields.FieldSchema{
Type: fields.TypeBool,
},
"volumes": &fields.FieldSchema{
Type: fields.TypeArray,
},
},
}

Expand Down Expand Up @@ -306,13 +309,18 @@ func (d *RktDriver) Start(ctx *ExecContext, task *structs.Task) (DriverHandle, e
cmdArgs = append(cmdArgs, fmt.Sprintf("--cpu=%vm", int64(task.Resources.CPU)))

// 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", ip)
d.logger.Printf("[DEBUG] driver.rkt: %v", msg)
return nil, msg
} else {
cmdArgs = append(cmdArgs, fmt.Sprintf("--dns=%s", ip))
if len(driverConfig.DNSServers) == 1 && (driverConfig.DNSServers[0] == "host" || driverConfig.DNSServers[0] == "none") {
// Special case single item lists with the special values "host" or "none"
cmdArgs = append(cmdArgs, fmt.Sprintf("--dns=%s", driverConfig.DNSServers[0]))
} else {
for _, ip := range driverConfig.DNSServers {
if err := net.ParseIP(ip); err == nil {
msg := fmt.Errorf("invalid ip address for container dns server %q", ip)
d.logger.Printf("[DEBUG] driver.rkt: %v", msg)
return nil, msg
} else {
cmdArgs = append(cmdArgs, fmt.Sprintf("--dns=%s", ip))
}
}
}

Expand Down