Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

fixing prometheus scrape annotation #2278

Merged
merged 2 commits into from
Jul 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion chart/flux/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ spec:
metadata:
annotations:
{{- if .Values.prometheus.enabled }}
prometheus.io.scrape: "true"
prometheus.io/scrape: "true"
{{- end }}
{{- if .Values.annotations }}
{{- .Values.annotations | toYaml | trimSuffix "\n" | nindent 8 }}
Expand Down
2 changes: 1 addition & 1 deletion chart/flux/templates/helm-operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
metadata:
annotations:
{{- if .Values.prometheus.enabled }}
prometheus.io.scrape: "true"
prometheus.io/scrape: "true"
{{- end }}
{{- if .Values.helmOperator.annotations }}
{{- .Values.helmOperator.annotations | toYaml | trimSuffix "\n" | nindent 8 }}
Expand Down
20 changes: 10 additions & 10 deletions cluster/kubernetes/policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ func TestUpdatePolicies(t *testing.T) {
}{
{
name: "adding annotation with others existing",
in: []string{"prometheus.io.scrape", "'false'"},
out: []string{"prometheus.io.scrape", "'false'", "flux.weave.works/automated", "'true'"},
in: []string{"prometheus.io/scrape", "'false'"},
out: []string{"prometheus.io/scrape", "'false'", "flux.weave.works/automated", "'true'"},
update: resource.PolicyUpdate{
Add: policy.Set{policy.Automated: "true"},
},
Expand All @@ -38,8 +38,8 @@ func TestUpdatePolicies(t *testing.T) {
},
{
name: "adding annotation when already has annotation and others",
in: []string{"flux.weave.works/automated", "'true'", "prometheus.io.scrape", "'false'"},
out: []string{"flux.weave.works/automated", "'true'", "prometheus.io.scrape", "'false'"},
in: []string{"flux.weave.works/automated", "'true'", "prometheus.io/scrape", "'false'"},
out: []string{"flux.weave.works/automated", "'true'", "prometheus.io/scrape", "'false'"},
update: resource.PolicyUpdate{
Add: policy.Set{policy.Automated: "true"},
},
Expand All @@ -54,8 +54,8 @@ func TestUpdatePolicies(t *testing.T) {
},
{
name: "add and remove different annotations at the same time",
in: []string{"flux.weave.works/automated", "'true'", "prometheus.io.scrape", "'false'"},
out: []string{"prometheus.io.scrape", "'false'", "flux.weave.works/locked", "'true'"},
in: []string{"flux.weave.works/automated", "'true'", "prometheus.io/scrape", "'false'"},
out: []string{"prometheus.io/scrape", "'false'", "flux.weave.works/locked", "'true'"},
update: resource.PolicyUpdate{
Add: policy.Set{policy.Locked: "true"},
Remove: policy.Set{policy.Automated: "true"},
Expand All @@ -72,8 +72,8 @@ func TestUpdatePolicies(t *testing.T) {
},
{
name: "remove annotation with others existing",
in: []string{"flux.weave.works/automated", "true", "prometheus.io.scrape", "false"},
out: []string{"prometheus.io.scrape", "false"},
in: []string{"flux.weave.works/automated", "true", "prometheus.io/scrape", "false"},
out: []string{"prometheus.io/scrape", "false"},
update: resource.PolicyUpdate{
Remove: policy.Set{policy.Automated: "true"},
},
Expand All @@ -96,8 +96,8 @@ func TestUpdatePolicies(t *testing.T) {
},
{
name: "remove annotation with only others",
in: []string{"prometheus.io.scrape", "false"},
out: []string{"prometheus.io.scrape", "false"},
in: []string{"prometheus.io/scrape", "false"},
out: []string{"prometheus.io/scrape", "false"},
update: resource.PolicyUpdate{
Remove: policy.Set{policy.Automated: "true"},
},
Expand Down
4 changes: 2 additions & 2 deletions cluster/kubernetes/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,7 @@ spec:
labels:
name: authfe
annotations:
prometheus.io.port: "8080"
prometheus.io/port: "8080"
spec:
# blank comment spacers in the following
containers:
Expand Down Expand Up @@ -522,7 +522,7 @@ spec:
labels:
name: authfe
annotations:
prometheus.io.port: "8080"
prometheus.io/port: "8080"
spec:
# blank comment spacers in the following
containers:
Expand Down
2 changes: 1 addition & 1 deletion deploy-helm/weave-cloud-helm-operator-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
template:
metadata:
annotations:
prometheus.io.scrape: "false"
prometheus.io/scrape: "false"
labels:
app: flux-helm-operator
spec:
Expand Down
2 changes: 1 addition & 1 deletion deploy/flux-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ spec:
template:
metadata:
annotations:
prometheus.io.port: "3031" # tell prometheus to scrape /metrics endpoint's port.
prometheus.io/port: "3031" # tell prometheus to scrape /metrics endpoint's port.
labels:
name: flux
spec:
Expand Down