Merge "helm-toolkit prometheus service annotation clean up"

This commit is contained in:
Zuul 2018-01-22 09:16:58 +00:00 committed by Gerrit Code Review
commit 95bcb412f2
2 changed files with 20 additions and 12 deletions

View File

@ -22,14 +22,14 @@ limitations under the License.
# pod's declared ports (default is a port-free target if none are declared).
{{- define "helm-toolkit.snippets.prometheus_pod_annotations" -}}
{{- $pod := index . 0 -}}
{{- if $pod.prometheus_scrape }}
prometheus.io/scrape: {{ $pod.prometheus_scrape | quote }}
{{- $config := index . 0 -}}
{{- if $config.scrape }}
prometheus.io/scrape: {{ $config.scrape | quote }}
{{- end }}
{{- if $pod.prometheus_path }}
prometheus.io/path: {{ $pod.prometheus_path | quote }}
{{- if $config.path }}
prometheus.io/path: {{ $config.path | quote }}
{{- end }}
{{- if $pod.prometheus_port }}
prometheus.io/port: {{ $pod.prometheus_port | quote }}
{{- if $config.port }}
prometheus.io/port: {{ $config.port | quote }}
{{- end }}
{{- end -}}

View File

@ -21,9 +21,17 @@ limitations under the License.
# service then set this appropriately.
{{- define "helm-toolkit.snippets.prometheus_service_annotations" -}}
{{- $endpoint := index . 0 -}}
prometheus.io/scrape: {{ $endpoint.scrape | quote }}
prometheus.io/scheme: {{ $endpoint.scheme.default | quote }}
prometheus.io/path: {{ $endpoint.path.default | quote }}
prometheus.io/port: {{ $endpoint.scrape_port | quote }}
{{- $config := index . 0 -}}
{{- if $config.scrape }}
prometheus.io/scrape: {{ $config.scrape | quote }}
{{- end }}
{{- if $config.scheme }}
prometheus.io/scheme: {{ $config.scheme | quote }}
{{- end }}
{{- if $config.path }}
prometheus.io/path: {{ $config.path | quote }}
{{- end }}
{{- if $config.port }}
prometheus.io/port: {{ $config.port | quote }}
{{- end }}
{{- end -}}