helm-toolkit prometheus service annotation clean up
This adds checks for the fields in the service annotations for prometheus, similar to the checks made for the pod annotations. It also moves prometheus annotations under a prometheus: key under a top-level monitoring tree to allow for other monitoring mechanisms independent of the endpoints tree Change-Id: I4be6d6ad8e74e8ca52bd224ceddad785577bf6c7
This commit is contained in:
parent
9b40b8656d
commit
9ffc748979
@ -39,6 +39,8 @@ limitations under the License.
|
||||
{{- $_ := set .Values "pod_dependency" .Values.dependencies.calico_node -}}
|
||||
{{- end -}}
|
||||
|
||||
{{- $prometheus_annotations := $envAll.Values.monitoring.prometheus.calico_node }}
|
||||
|
||||
{{- $serviceAccountName := "calico-cni-plugin"}}
|
||||
{{ tuple $envAll $envAll.Values.pod_dependency $serviceAccountName | include "helm-toolkit.snippets.kubernetes_pod_rbac_serviceaccount" }}
|
||||
---
|
||||
@ -93,7 +95,9 @@ spec:
|
||||
# reserves resources for critical add-on pods so that they can be rescheduled after
|
||||
# a failure. This annotation works in tandem with the toleration below.
|
||||
scheduler.alpha.kubernetes.io/critical-pod: ''
|
||||
{{ tuple $envAll.Values.pod.annotations.calico_node | include "helm-toolkit.snippets.prometheus_pod_annotations" | indent 8 }}
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
{{ tuple $prometheus_annotations | include "helm-toolkit.snippets.prometheus_pod_annotations" | indent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
hostNetwork: true
|
||||
tolerations:
|
||||
|
@ -44,10 +44,6 @@ images:
|
||||
- calico_kube_policy_controller
|
||||
|
||||
pod:
|
||||
annotations:
|
||||
calico_node:
|
||||
prometheus_port: 9091
|
||||
prometheus_scrape: true
|
||||
resources:
|
||||
enabled: false
|
||||
jobs:
|
||||
@ -104,6 +100,13 @@ endpoints:
|
||||
peer:
|
||||
default: 6667
|
||||
|
||||
monitoring:
|
||||
prometheus:
|
||||
enabled: true
|
||||
calico_node:
|
||||
scrape: true
|
||||
port: 9091
|
||||
|
||||
networking:
|
||||
podSubnet: 192.168.0.0/16
|
||||
#NOTE(portdirect): this should be the physical MTU, the appropriate MTU
|
||||
|
@ -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 -}}
|
||||
|
@ -1,12 +1,9 @@
|
||||
{{/*
|
||||
Copyright 2017 The Openstack-Helm Authors.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@ -24,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 -}}
|
||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||
|
||||
{{- if .Values.manifests.service_controller_manager }}
|
||||
{{- $envAll := . }}
|
||||
{{- $endpoint := $envAll.Values.endpoints.kube_controller_manager }}
|
||||
{{- $prometheus_annotations := $envAll.Values.monitoring.prometheus.kube_controller_manager }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@ -25,7 +25,9 @@ metadata:
|
||||
labels:
|
||||
{{ tuple $envAll "controller-manager" "metrics" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
annotations:
|
||||
{{ tuple $endpoint | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
{{ tuple $prometheus_annotations | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
component: kube-controller-manager
|
||||
|
@ -14,18 +14,20 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/}}
|
||||
|
||||
{{- if .Values.manifests.service_kube_metrics }}
|
||||
{{- if .Values.manifests.service_kube_state_metrics }}
|
||||
{{- $envAll := . }}
|
||||
{{- $endpoint := $envAll.Values.endpoints.kube_metrics }}
|
||||
{{- $prometheus_annotations := $envAll.Values.monitoring.prometheus.kube_state_metrics }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ tuple "kube_metrics" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
||||
name: {{ tuple "kube_state_metrics" "internal" . | include "helm-toolkit.endpoints.hostname_short_endpoint_lookup" }}
|
||||
labels:
|
||||
{{ tuple $envAll "kube-state-metrics" "metrics" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
annotations:
|
||||
{{ tuple $endpoint | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
{{ tuple $prometheus_annotations | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||
|
||||
{{- if .Values.manifests.service_scheduler }}
|
||||
{{- $envAll := . }}
|
||||
{{- $endpoint := $envAll.Values.endpoints.kube_scheduler }}
|
||||
{{- $prometheus_annotations := $envAll.Values.monitoring.prometheus.kube_scheduler }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@ -25,7 +25,9 @@ metadata:
|
||||
labels:
|
||||
{{ tuple $envAll "kube-scheduler" "metrics" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
annotations:
|
||||
{{ tuple $endpoint | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
{{ tuple $prometheus_annotations | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
component: kube-scheduler
|
||||
|
@ -102,10 +102,10 @@ endpoints:
|
||||
port:
|
||||
registry:
|
||||
node: 5000
|
||||
kube_metrics:
|
||||
kube_state_metrics:
|
||||
namespace: null
|
||||
hosts:
|
||||
default: kube-metrics
|
||||
default: kube-state-metrics
|
||||
host_fqdn_override:
|
||||
default: null
|
||||
path:
|
||||
@ -115,22 +115,26 @@ endpoints:
|
||||
port:
|
||||
http:
|
||||
default: 8080
|
||||
scrape: true
|
||||
scrape_port: 8080
|
||||
kube_scheduler:
|
||||
scheme:
|
||||
default: 'http'
|
||||
path:
|
||||
default: /metrics
|
||||
scrape: true
|
||||
scrape_port: 10251
|
||||
kube_controller_manager:
|
||||
scheme:
|
||||
default: 'http'
|
||||
path:
|
||||
default: /metrics
|
||||
scrape: true
|
||||
scrape_port: 10252
|
||||
|
||||
monitoring:
|
||||
prometheus:
|
||||
enabled: true
|
||||
kube_state_metrics:
|
||||
scrape: true
|
||||
kube_scheduler:
|
||||
scrape: true
|
||||
kube_controller_manager:
|
||||
scrape: true
|
||||
|
||||
network:
|
||||
kube_state_metrics:
|
||||
@ -142,7 +146,7 @@ manifests:
|
||||
clusterrolebinding: true
|
||||
deployment: true
|
||||
job_image_repo_sync: true
|
||||
service_kube_metrics: true
|
||||
service_kube_state_metrics: true
|
||||
service_controller_manager: true
|
||||
service_scheduler: true
|
||||
serviceaccount: true
|
||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||
|
||||
{{- if .Values.manifests.service }}
|
||||
{{- $envAll := . }}
|
||||
{{- $endpoint := $envAll.Values.endpoints.node_metrics }}
|
||||
{{- $prometheus_annotations := $envAll.Values.monitoring.prometheus.node_exporter }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@ -25,7 +25,9 @@ metadata:
|
||||
labels:
|
||||
{{ tuple $envAll "node_exporter" "metrics" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
annotations:
|
||||
{{ tuple $endpoint | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
{{ tuple $prometheus_annotations | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: ClusterIP
|
||||
clusterIP: None
|
||||
|
@ -92,6 +92,12 @@ conditional_dependencies:
|
||||
- service: local_image_registry
|
||||
endpoint: node
|
||||
|
||||
monitoring:
|
||||
prometheus:
|
||||
enabled: true
|
||||
node_exporter:
|
||||
scrape: true
|
||||
|
||||
network:
|
||||
node_exporter:
|
||||
port: 9100
|
||||
@ -123,8 +129,8 @@ endpoints:
|
||||
port:
|
||||
metrics:
|
||||
default: 9100
|
||||
scrape: true
|
||||
scrape_port: 9100
|
||||
prometheus_port:
|
||||
default: 9100
|
||||
|
||||
manifests:
|
||||
configmap_bin: true
|
||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||
|
||||
{{- if .Values.manifests.service }}
|
||||
{{- $envAll := . }}
|
||||
{{- $endpoint := $envAll.Values.endpoints.prometheus_openstack_exporter }}
|
||||
{{- $prometheus_annotations := $envAll.Values.monitoring.prometheus.openstack_exporter }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@ -25,7 +25,9 @@ metadata:
|
||||
labels:
|
||||
{{ tuple $envAll "prometheus-openstack-exporter" "metrics" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
annotations:
|
||||
{{ tuple $endpoint | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
{{ tuple $prometheus_annotations | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
- name: http
|
||||
|
@ -144,7 +144,6 @@ endpoints:
|
||||
port:
|
||||
exporter:
|
||||
default: 9103
|
||||
scrape: true
|
||||
identity:
|
||||
name: keystone
|
||||
auth:
|
||||
@ -178,6 +177,16 @@ endpoints:
|
||||
api:
|
||||
default: 80
|
||||
|
||||
monitoring:
|
||||
prometheus:
|
||||
enabled: true
|
||||
openstack_exporter:
|
||||
scrape: true
|
||||
|
||||
network:
|
||||
openstack_metrics_exporter:
|
||||
port: 9103
|
||||
|
||||
manifests:
|
||||
configmap_bin: true
|
||||
deployment: true
|
||||
|
@ -16,7 +16,7 @@ limitations under the License.
|
||||
|
||||
{{- if .Values.manifests.service }}
|
||||
{{- $envAll := . }}
|
||||
{{- $endpoint := $envAll.Values.endpoints.monitoring }}
|
||||
{{- $prometheus_annotations := $envAll.Values.monitoring.prometheus.prometheus }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
@ -25,7 +25,9 @@ metadata:
|
||||
labels:
|
||||
{{ tuple $envAll "prometheus" "metrics" | include "helm-toolkit.snippets.kubernetes_metadata_labels" | indent 4 }}
|
||||
annotations:
|
||||
{{ tuple $endpoint | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- if .Values.monitoring.prometheus.enabled }}
|
||||
{{ tuple $prometheus_annotations | include "helm-toolkit.snippets.prometheus_service_annotations" | indent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
ports:
|
||||
- name: prom-metrics
|
||||
|
@ -112,8 +112,6 @@ endpoints:
|
||||
api:
|
||||
default: 9090
|
||||
public: 80
|
||||
scrape: true
|
||||
scrape_port: 9090
|
||||
alerts:
|
||||
name: alertmanager
|
||||
namespace: null
|
||||
@ -147,6 +145,12 @@ conditional_dependencies:
|
||||
- service: local_image_registry
|
||||
endpoint: node
|
||||
|
||||
monitoring:
|
||||
prometheus:
|
||||
enabled: true
|
||||
prometheus:
|
||||
scrape: true
|
||||
|
||||
network:
|
||||
prometheus:
|
||||
ingress:
|
||||
|
Loading…
Reference in New Issue
Block a user