-
Notifications
You must be signed in to change notification settings - Fork 488
Fix overriding of prometheus scrape #624
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
Fix overriding of prometheus scrape #624
Conversation
The prometheus.io.scrape annotation was being overridden in faas-netes if it was set. This means a user could never set it to true for a functtion using something like faas-cli store deploy figlet --annotation prometheus.io.scrape=true This was tested by writing unit tests to validate that the operator did not do the same thing and writing a new test for faas-netes's deployment handler to check that if its set, its not overridden. Then tested on k3d, using: 1) k3d create 2)arkade install openfaas 3) set the faas-netes container to the one created from this commit 4) faas-cli store deploy figlet --annotation prometheus.io.scrape=true 5) validate that the annotation was not overridden (kubectl get deploy -n openfaas-fn figlet -o yaml) Signed-off-by: Alistair Hey <[email protected]>
5f65bfd
to
b733782
Compare
if merged this would need:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That was quick! Here's a quick Q
annotations := buildAnnotations(request) | ||
|
||
if len(annotations) != 1 { | ||
t.Errorf("want: %d annotations got: %d", 1, len(annotations)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You could probably add a return there, or use t.Fatalf
that @LucasRoesler introduced me to, which returns out of the test.
Also extract "true"
to want := "true"
please.
I'll merge, but send in the alteration after.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approved with a comment.
Signed-off-by: Alistair Hey <[email protected]>
Signed-off-by: Alistair Hey <[email protected]>
Description
The prometheus.io.scrape annotation was being overridden in faas-netes
if it was set. This means a user could never set it to true for a
functtion using something like faas-cli store deploy figlet --annotation
prometheus.io.scrape=true
Signed-off-by: Alistair Hey [email protected]
Motivation and Context
fixes Allow Prometheus scraping annotation to be specified #621
How Has This Been Tested?
This was tested by writing unit tests to validate that the operator did
not do the same thing and writing a new test for faas-netes's deployment
handler to check that if its set, its not overridden.
Then tested on k3d, using:
2)arkade install openfaas
-n openfaas-fn figlet -o yaml)
Types of changes
Checklist:
git commit -s