-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Restrict task drivers to namespaces #11807
Comments
In a discussion on this topic I proposed an idea that I'd like to reiterate here. My idea was to make drivers behave like vault modules, where you can mount them to backends. This would tie in well with the concept of drivers that are external plugins and may be extremely special purpose. I also think this would provide a neat way to resolve the concerns raised in #9258 by allowing the docker driver to be remounted with different options in different namespaces. |
Dropping some open-ended thoughts here...
Something that makes this a little challenging is that task drivers are fingerprinted on the clients and they're "opaque" to the server. You can see this in the specialized behavior we have for
The difference from a semantics perspective is that Vault modules are global to the cluster whereas task drivers are specific to clients. The situation we have now is that they can be "loaded/unloaded" via the configuration file on a per client basis. But dynamically loadable client configuration is a cool idea for sure (and something I think we'll want for node metadata and some storage ideas I've been kicking around). Some other stuff to consider... If we did this as ACLs, what does the ACL policy configuration look like? Do we make extended capabilities for namespace "prod" {
policy = "read"
capabilities = [
"submit-job",
"submit-job-raw_exec",
"submit-job-docker",
]
} Could we do this as a client-side plugin configuration? plugin "raw_exec" {
config {
enabled = true
namespaces = ["system-admin", "dev"]
}
} That'd have to be implemented for each of the plugins, which is easy for internal plugins but a scattered for community plugins. In any case, we could conceivably do something like this as a first step and get it all wired up to the scheduler, and then have dynamic client configuration as a separate body of work. |
Hi @tgross, thank you for your thoughtful response (as usual :)).
That is a good question and I purposely didn't think to much about it in the issue post since I wanted to gauge interested in it first. Ie is this something you'd be willing to support at all… But to answer your question after a bit more thinking: Something like So maybe it would make more sense as a
I guess that would be okay, like for builtin plugins that do not configure
Sounds good to me. If we can get commit-commitment from the nomad team I might be able to play with it [After we figured out which approach we wanna take] :) |
Hey @apollo13 I think that approach sounds great! I floated the idea internally to some folks and that kicked off a very quick Request For Comments doc that's being circulated among interested HashiCorp folks. I'm going to share this doc below for your comments as well: [RFC] Restrict Task Drivers by NamespaceBackgroundSpecific Nomad task drivers can currently be disabled on individual client nodes with the This would allow operators to enable “less secure” loosely constrained task drivers (ex. ImplementationAdd a new diff --git a/nomad/structs/structs.go b/nomad/structs/structs.go
index f19656fce..cb098b413 100644
--- a/nomad/structs/structs.go
+++ b/nomad/structs/structs.go
@@ -4948,11 +4948,20 @@ type Namespace struct {
// cross-regions.
Hash []byte
+ // Capabilities is the set of capabilities allowed for this namespace
+ Capabilities *NamespaceCapabilities
+
// Raft Indexes
CreateIndex uint64
ModifyIndex uint64
}
+// NamespaceCapabilities represents a set of capabilities allowed for this
+// namespace, to be checked at job submission time.
+type NamespaceCapabilities struct {
+ EnabledTaskDrivers []string
+}
+
func (n *Namespace) Validate() error {
var mErr multierror.Error On job submission the admission controllers hook will check if the job's namespace has a The existing namespace Register API only needs to have the new field added in order to add this feature. But the existing nomad namespace apply command does not accept a specification file in the way that we do for quotas. For the initial implementation, we'll add a new command line argument An operator may update a namespace after a job that uses that namespace has been submitted. Nomad does not currently reconcile the state of running allocations against configuration changes except for jobs and node updates that force an allocation to be rescheduled. The Abandoned Ideas
Future Work
|
Closed by #11813, which will ship in Nomad 1.3.0! |
I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues. |
Proposal
It would be great if access to task drivers were guarded by an ACL.
Use-cases
Nomad is a great task scheduler, but with great power comes great responsibility. For instance in some cases a nomad admin might want to execute
raw_exec
tasks on nodes, butraw_exec
shouldn't be available to "normal" users. Maybe it doesn't even need ACLs but solely a config option that ties the availability of task drivers to certain namespaces.WDYT? Any other creative ideas -- or did I miss something?
Attempted Solutions
I don't see an easy workaround :)
The text was updated successfully, but these errors were encountered: