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

[bug] parsing policy source and query can result in panic #99

Closed
jrasell opened this issue Apr 21, 2020 · 0 comments · Fixed by #114
Closed

[bug] parsing policy source and query can result in panic #99

jrasell opened this issue Apr 21, 2020 · 0 comments · Fixed by #114
Assignees
Milestone

Comments

@jrasell
Copy link
Member

jrasell commented Apr 21, 2020

The top level params within a scaling policy are opaque to Nomad and therefore does not go through validation during job registration. It is the responsibility of the Autoscaler to parse the top level params safely without panics.

Currently the autoscaler assumes the source and query params are key/value string parameters. This is fine if the policy is correctly forms, but results in a panic if the operator has made a configuration error.

Example:

source = {
  name = "prometheus"
 }

Panic:

panic: interface conversion: interface {} is []interface {}, not string

goroutine 66 [running]:
github.com/hashicorp/nomad-autoscaler/policystorage.(*Nomad).Get(0xc0004e6008, 0xc000017410, 0x24, 0x10000000194b020, 0x1000000000001, 0x0)
	/Users/jrasell/go/src/github.com/hashicorp/nomad-autoscaler/policystorage/nomad.go:50 +0x552
github.com/hashicorp/nomad-autoscaler/agent.(*Agent).Run.func1(0xc00088a050, 0x195b800, 0xc000092580, 0xc0004e6008, 0x1965c20, 0xc0007a0180, 0xc000031920, 0xc000017410, 0x24)
	/Users/jrasell/go/src/github.com/hashicorp/nomad-autoscaler/agent/agent.go:84 +0xa6
created by github.com/hashicorp/nomad-autoscaler/agent.(*Agent).Run
	/Users/jrasell/go/src/github.com/hashicorp/nomad-autoscaler/agent/agent.go:78 +0x60f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant