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

api: /v1/jobs always include namespaces #10434

Merged
merged 1 commit into from
Apr 23, 2021
Merged

api: /v1/jobs always include namespaces #10434

merged 1 commit into from
Apr 23, 2021

Conversation

notnoop
Copy link
Contributor

@notnoop notnoop commented 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.

Sample /v1/api response before
[
  {
    "CreateIndex": 10,
    "Datacenters": [
      "dc1"
    ],
    "ID": "example",
    "JobModifyIndex": 10,
    "JobSummary": {
      "Children": {
        "Dead": 0,
        "Pending": 0,
        "Running": 0
      },
      "CreateIndex": 10,
      "JobID": "example",
      "ModifyIndex": 14,
      "Namespace": "default",
      "Summary": {
        "cache": {
          "Complete": 0,
          "Failed": 0,
          "Lost": 0,
          "Queued": 0,
          "Running": 1,
          "Starting": 0
        }
      }
    },
    "ModifyIndex": 11,
    "Multiregion": null,
    "Name": "example",
    "ParameterizedJob": false,
    "ParentID": "",
    "Periodic": false,
    "Priority": 50,
    "Status": "running",
    "StatusDescription": "",
    "Stop": false,
    "SubmitTime": 1619192400425852000,
    "Type": "service"
  }
]
Sample /v1/api response: After
[
  {
    "CreateIndex": 10,
    "Datacenters": [
      "dc1"
    ],
    "ID": "example",
    "JobModifyIndex": 10,
    "JobSummary": {
      "Children": {
        "Dead": 0,
        "Pending": 0,
        "Running": 0
      },
      "CreateIndex": 10,
      "JobID": "example",
      "ModifyIndex": 14,
      "Namespace": "default",
      "Summary": {
        "cache": {
          "Complete": 0,
          "Failed": 0,
          "Lost": 0,
          "Queued": 0,
          "Running": 1,
          "Starting": 0
        }
      }
    },
    "ModifyIndex": 11,
    "Multiregion": null,
    "Name": "example",
    "Namespace": "default",
    "ParameterizedJob": false,
    "ParentID": "",
    "Periodic": false,
    "Priority": 50,
    "Status": "running",
    "StatusDescription": "",
    "Stop": false,
    "SubmitTime": 1619192552309353000,
    "Type": "service"
  }
]

Fixes #10431

@notnoop notnoop self-assigned this Apr 23, 2021
Copy link
Contributor

@DingoEatingFuzz DingoEatingFuzz left a comment

Choose a reason for hiding this comment

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

LGTM, thank you for the quick turnaround.

@notnoop notnoop merged commit d2a8c5d into main Apr 23, 2021
@notnoop notnoop deleted the f-job-list-include-ns branch April 23, 2021 20:36
@github-actions
Copy link

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

Successfully merging this pull request may close these issues.

Response from /v1/jobs does not include Namespace property
2 participants