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

UI - Provide default executable for 'exec' on tasks #24155

Open
davidlublink opened this issue Oct 9, 2024 · 2 comments
Open

UI - Provide default executable for 'exec' on tasks #24155

davidlublink opened this issue Oct 9, 2024 · 2 comments

Comments

@davidlublink
Copy link

Proposal

It would be nice if when clicking the 'exec' button on a task, instead of offering the last command entered as a default, allow the job to provide a default command.

Many modern containers don't contain bash and sometimes don't contain sh, it can be very confusing for an operator trying to 'exec' into a task without having full knowledge of that container.

In this proposal, we add a new parameter default_exec_command to the task:

task "myawesometask" {
   driver = "docker"
   config {
     image = "bash"
     default_exec_command="bash"
   }
}

When trying to 'exec' into the task via the web us, the command 'bash' would be auto filled in the popup:

image

The Nomad operator, by default, would be able to change the command(as is the case now) before entering the container, however a second parameter 'exec_command_can_not_be_changed=yes' could be set that would make the parameter read-only. In other words, if this second parameter is set, the Nomad operator running 'exec' would have no choice but to execute the command exactly as provided by the Nomad job definition.

Use-cases

  1. Task uses docker without bash or sh, job writer wants to provide the executable path to the Nomad operator
  2. Nomad Operator has limited access to Nomad and needs to be able to execute an interactive action. Since the action stanza doesn't allow for interactions, the job writer could set the 'default_exec_command' and 'exec_command_can_not_be_changed' parameters and give that operator the ability to gain access to the container in a limited fashion
  3. Faster access to containers, often times when accessing a task I'll accept the default command forgetting that the container I am accessing might not have bash.

Attempted Solutions

Not really any attempted solutions, it's just manual steps that humans have to do each time an allocation's task is access through the 'exec' command.

@philrenaud
Copy link
Contributor

Hey, this is a neat idea. I wonder if the task level is the right place to put this, though. Jobspecs can get lengthy and are stored in raft and therefore replicated / adding more information there can cause slow-downs.

What if this were an agent config, or a user setting, settable via the UI?

Is this the sort of default you'd also expect when running nomad alloc exec via the CLI, or just in the web UI?

@philrenaud philrenaud self-assigned this Oct 9, 2024
@tgross
Copy link
Member

tgross commented Oct 9, 2024

What if this were an agent config, or a user setting, settable via the UI?

The default command is likely to vary across tasks, especially with docker driver tasks (or similar image-isolated task drivers) where the Docker image determines whether a given shell or command is available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

No branches or pull requests

3 participants