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

Response from /v1/jobs does not include Namespace property #10431

Closed
DingoEatingFuzz opened this issue Apr 23, 2021 · 1 comment · Fixed by #10434
Closed

Response from /v1/jobs does not include Namespace property #10431

DingoEatingFuzz opened this issue Apr 23, 2021 · 1 comment · Fixed by #10434
Assignees
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. type/bug

Comments

@DingoEatingFuzz
Copy link
Contributor

When fetching all jobs for a namespace, the stubbed jobs in the response do not include the Namespace. Yes, it could technically be extracted from the URL, but I would expect the response objects to include all identifying properties.

The property is already in the JobListStub struct, but it isn't provided in the Stub method:

nomad/nomad/structs/structs.go

Lines 4334 to 4354 in f743780

func (j *Job) Stub(summary *JobSummary) *JobListStub {
return &JobListStub{
ID: j.ID,
ParentID: j.ParentID,
Name: j.Name,
Datacenters: j.Datacenters,
Multiregion: j.Multiregion,
Type: j.Type,
Priority: j.Priority,
Periodic: j.IsPeriodic(),
ParameterizedJob: j.IsParameterized(),
Stop: j.Stop,
Status: j.Status,
StatusDescription: j.StatusDescription,
CreateIndex: j.CreateIndex,
ModifyIndex: j.ModifyIndex,
JobModifyIndex: j.JobModifyIndex,
SubmitTime: j.SubmitTime,
JobSummary: summary,
}
}

This was tested on main.

@notnoop notnoop self-assigned this Apr 23, 2021
@notnoop notnoop added the stage/accepted Confirmed, and intend to work on. No timeline committment though. label Apr 23, 2021
notnoop pushed a commit that referenced this issue Apr 23, 2021
Add Namespace as a top-level field in `/v1/jobs` stub.

The `/v1/jobs` endpoint already includes the namespace under `JobSummary`, though the API is odd, as typically the job ID and Namespace are in the same level, and the oddity complicates the UI frontend development.

The downside of adding it is redundant field, that makes the response body a bit bigger, specially for clusters with large jobs. Though, it should compress nicely and I expect the overhead to be small to overall response size. The benefit of a cleaner and more consistent API seem worth it.

Fixes #10431
@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 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stage/accepted Confirmed, and intend to work on. No timeline committment though. type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants