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

Add a driver for rkt #165

Merged
merged 15 commits into from
Oct 7, 2015
Merged

Add a driver for rkt #165

merged 15 commits into from
Oct 7, 2015

Conversation

achanda
Copy link
Contributor

@achanda achanda commented Sep 29, 2015

  • Adds a driver for rkt
  • Adds associated tests

@ryanuber
Copy link
Member

Awesome! Thanks @achanda. Would it be possible to use the native Go rkt interface here? I'm not familiar with it myself but it thinking it will be more resilient than using the CLI.

@achanda
Copy link
Contributor Author

achanda commented Sep 29, 2015

@ryanuber ah, I was looking for something like that. Thanks for the pointer. Let me look around.

}
d.logger.Printf("[DEBUG] Started ACI: %q", name)
h := &rktHandle{
proc: cmd.Process,
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be acmd? It's using the cmd from line 92 above, where we invoke rkt trust

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, fixed.

@catsby
Copy link
Contributor

catsby commented Sep 29, 2015

Thanks for the contribution! Let us know what you find out about the rkt interface Ryan mentioned

@achanda
Copy link
Contributor Author

achanda commented Sep 30, 2015

@ryanuber @catsby I had a chat with the rkt guys. While they are working on a way to provide read only info (image etc.), there are no plans to drive rkt through an API. What makes that more difficult is that rkt does not run a daemon in the background. Kubernetes uses rkt in a similar way as this PR. I took a look at their code and noticed that they are spawning the binary in a similar way. However, their rkt package is too tightly integrated with kubernetes.


node.Attributes["driver.rkt"] = "1"
node.Attributes["driver.rkt.version"] = rktMatches[0]
node.Attributes["driver.appc.version"] = appcMatches[1]
Copy link
Member

Choose a reason for hiding this comment

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

This should probably still be nested under the driver.rkt namespace, since appc itself isn't the driver.

@ryanuber
Copy link
Member

ryanuber commented Oct 1, 2015

@achanda thanks for looking into the client stuff! Understood, and I think this approach is fine if that's the case. I left a few minor comments but overall looking really good! Can you also add some driver documentation in the website/ directory to detail the config options, limitations, etc?

@achanda
Copy link
Contributor Author

achanda commented Oct 1, 2015

@ryanuber all done.

return false, fmt.Errorf("Unable to parse Rkt version string: %#v", rktMatches)
}

node.Attributes["driver.rkt"] = "1"
Copy link
Member

Choose a reason for hiding this comment

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

Missed this on the first pass, we set this to true in the Docker driver here. I think we should keep these uniform.

@ryanuber
Copy link
Member

ryanuber commented Oct 1, 2015

Thanks! I took a final pass and just noted a few more (super) minor things. Thanks again, looks like a merge is coming soon!

if !ok || trust_prefix == "" {
return nil, fmt.Errorf("Missing trust prefix for rkt")
}
trust_args := []string{
Copy link
Contributor

Choose a reason for hiding this comment

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

I would remove this an inline it into the exec.Command.

@ryanuber ryanuber mentioned this pull request Oct 1, 2015
}
data, err := json.Marshal(pid)
if err != nil {
log.Printf("[ERR] failed to marshal rkt PID to JSON: %s", err)
Copy link
Contributor

Choose a reason for hiding this comment

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

You will want to pass the logger from the Driver into the Handle. We support redirecting logs to files or other sources so this would break that it interface by using the default logger.

@achanda
Copy link
Contributor Author

achanda commented Oct 6, 2015

@ryanuber I changed to Start and rebased on master. These tests are passing on my box now. Please check.

cmd.Stdout = &outBuf
cmd.Stderr = &errBuf
d.logger.Printf("[DEBUG] driver.rkt: starting rkt command: %q", cmd.Args)
if err := cmd.Start(); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

This one should still be Run because you don't want to do rkt run before trust has finished

The trust needs to be added before anything can progress
Name: "etcd",
Config: map[string]string{
"trust_prefix": "coreos.com/etcd",
"name": "coreos.com/etcd:v2.0.4",
Copy link
Contributor

Choose a reason for hiding this comment

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

You will want to run something that exits to test the wait. This test just times out right now

@dadgar
Copy link
Contributor

dadgar commented Oct 7, 2015

Can you also run gofmt on all of the files. They are off a little. You can do this by running make format

Abhishek Chanda and others added 2 commits October 7, 2015 15:15
This overrides the default exec command in the ACI
dadgar added a commit that referenced this pull request Oct 7, 2015
@dadgar dadgar merged commit 7ab84c2 into hashicorp:master Oct 7, 2015
@ryanuber
Copy link
Member

ryanuber commented Oct 7, 2015

@achanda thanks for working through this with us! We are amped to have rkt supported in Nomad.

@achanda
Copy link
Contributor Author

achanda commented Oct 8, 2015

Thanks @ryanuber and all other reviewers :)

@achanda achanda deleted the rkt branch October 8, 2015 00:14
@dadgar
Copy link
Contributor

dadgar commented Nov 13, 2015

@achanda: This was missed in the original review but the driver does not do resource enforcement which is part of the driver API. This poses a problem because Nomad can make no guarantee about the cpu/memory usage of the task and which ports it is using. Given your experience with rkt do you have any thoughts on improving this driver. Otherwise we may have to remove it until it can be implemented in a fashion that respects the resource constraints.

@achanda
Copy link
Contributor Author

achanda commented Nov 13, 2015

@dadgar CPU, memory and network isolation can be definitely be achieved using rkt. I will start working on those.

@dadgar
Copy link
Contributor

dadgar commented Nov 13, 2015

@achanda: Awesome look forward to it. This was caught as we were reviewing for the Nomad 0.2 release. So to make the cut, this would need to be done by Monday, otherwise we could just disable for 0.2 and enable it in a latter version. Sorry for the short notice.

@achanda
Copy link
Contributor Author

achanda commented Nov 13, 2015

@dadgar ok, let me see what I can do.

@achanda
Copy link
Contributor Author

achanda commented Nov 13, 2015

@dadgar here is what I found, since the rkt CLI does not accept CPU and memory restrictions directly, the easiest way to achieve this will be using systemd-run, which will add another dependency. I am not familiar with the --pod-manifest flag, that can work but will need more effort than I can manage by Monday. Another way of doing this will be to add these options to the rkt CLI itself, but that won't work in a few days. Please let me know if we want to run rkt via systemd, otherwise the only option might be to remove this driver for now.

@dadgar
Copy link
Contributor

dadgar commented Nov 14, 2015

@achanda: The system-d run solution is not quite enough. That provides CPU/Memory isolation but it doesn't fix port allocations. Whatever is in the manifest is what will be used. That needs to be fixed as well. My opinion is these really should be adjustable during rkt run similar to docker.

So we discussed it and we are going to leave the driver in for 0.2 but update the documentation to mark it as experimental. This allows the driver to be improved as changes to the rkt ecosystem occur.

@github-actions
Copy link

github-actions bot commented May 3, 2023

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 May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants