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

Scaling policy list filter with job and type ignores type #9227

Closed
lgfa29 opened this issue Oct 30, 2020 · 1 comment · Fixed by #9312
Closed

Scaling policy list filter with job and type ignores type #9227

lgfa29 opened this issue Oct 30, 2020 · 1 comment · Fixed by #9312
Assignees
Labels
stage/needs-investigation theme/autoscaling Issues related to supporting autoscaling type/bug

Comments

@lgfa29
Copy link
Contributor

lgfa29 commented Oct 30, 2020

Nomad version

Nomad v1.0.0-beta2+ent (877c4b3c4a19a548f7dce72a12fcb152c325636a)

Operating system and Environment details

MacOS

Issue

When querying for scaling policies, if both job and type are specified, only job will be used to filter results.

Reproduction steps

$ nomad run example.nomad
$ curl -s 'http://localhost:4646/v1/scaling/policies?job=example&type=horizontal' | jq '.'
[
  {
    "ID": "0aaa0bea-15ca-e085-99d0-7cb0a172c951",
    "Enabled": false,
    "Type": "horizontal",
    "Target": {
      "Group": "foo",
      "Namespace": "default",
      "Job": "example"
    },
    "CreateIndex": 21,
    "ModifyIndex": 21
  },
  {
    "ID": "87777f10-6219-d901-6551-7b50ed5f4a70",
    "Enabled": true,
    "Type": "vertical_cpu",
    "Target": {
      "Namespace": "default",
      "Job": "example",
      "Group": "foo",
      "Task": "foo"
    },
    "CreateIndex": 21,
    "ModifyIndex": 21
  },
  {
    "ID": "8f26421c-8e99-433d-1c14-abe2dd23eb16",
    "Enabled": true,
    "Type": "vertical_mem",
    "Target": {
      "Task": "foo",
      "Namespace": "default",
      "Job": "example",
      "Group": "foo"
    },
    "CreateIndex": 21,
    "ModifyIndex": 21
  }
]

Expected Result

[
  {
    "ID": "0aaa0bea-15ca-e085-99d0-7cb0a172c951",
    "Enabled": false,
    "Type": "horizontal",
    "Target": {
      "Group": "foo",
      "Namespace": "default",
      "Job": "example"
    },
    "CreateIndex": 21,
    "ModifyIndex": 21
  },
]

Job file (if appropriate)

job "example" {
  datacenters = ["dc1"]
  group "foo" {
    scaling {
      enabled = false
      min     = 1
      max     = 20
      type    = "horizontal"
      policy {
        cooldown = "20s"
        check "avg_instance_sessions" {
          source = "prometheus"
          query  = "query"
          strategy "target-value" {
            target = 5
          }
        }
      }
    }
    task "foo" {
      driver = "raw_exec"
      config {
        command = "/bin/sleep"
        args    = ["10"]
      }
      scaling "cpu" {
        policy {
          check "check" {
            query = "query"
          }
        }
      }
      scaling "mem" {
        policy {
          check "check" {
            query = "query"
          }
        }
      }
    }
  }
}
@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 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
stage/needs-investigation theme/autoscaling Issues related to supporting autoscaling type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants