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

Request namespace is ignored on job register #9893

Closed
cgbaker opened this issue Jan 26, 2021 · 1 comment · Fixed by #10875
Closed

Request namespace is ignored on job register #9893

cgbaker opened this issue Jan 26, 2021 · 1 comment · Fixed by #10875
Assignees
Milestone

Comments

@cgbaker
Copy link
Contributor

cgbaker commented Jan 26, 2021

Nomad version

1.0.2, and probably some ways back into 0.12.x (enterprise) and 0.11.x (enterprise)

Issue

When doing the API -> structs conversion, the namespace query parameter is overwritten by the namespace from the job. But if the job didn't have a namespace, it was assigned the default namespace. Therefore, it is not possible to register a job in another namespace than default without specifying the namespace in the jobspec.

I was originally concerned about ACL checking, but verified in the code and through experimentation that the appropriate namespace is ACL checked.

Reproduction steps

  1. Create a job file with no namespace; nomad job init -short test.nomad will suffice.
  2. Create a new namespace: nomad namespace apply test
  3. Try to register the job in namespace test: nomad job run -namespace=test test.nomad
  4. Observe that the job was actually created in default (if you were running nomad with debug logging, you should see the ?namespace=test HTTP request)
$ nomad job init -short test.nomad
Example job file written to test.nomad

$ nomad namespace apply test
Successfully applied namespace "test"!

$ nomad job run -namespace=test test.nomad
==> Monitoring evaluation "cd66e44c"
    Evaluation triggered by job "example"
    Evaluation within deployment: "bc09221e"
    Allocation "81677e45" created: node "dd656e74", group "cache"
    Evaluation status changed: "pending" -> "complete"
==> Evaluation "cd66e44c" finished with status "complete"

$ nomad status
ID       Type     Priority  Status   Submit Date
example  service  50        running  2020-10-16T20:11:57Z

$ nomad job status -namespace=test
No running jobs

$ nomad job status -namespace=default
ID       Type     Priority  Status   Submit Date
example  service  50        running  2020-10-16T20:11:57Z
@github-actions
Copy link

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.
If you have found a problem that seems similar to this, 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 Oct 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants