From e8b0428e41374df38e54df655957d0e844b5bd10 Mon Sep 17 00:00:00 2001 From: Stefan Reimer Date: Mon, 3 Aug 2020 17:44:58 +0100 Subject: [PATCH] Add istio for prometheus --- .../templates/istio-service.yaml | 17 +++++++++++++++++ charts/kubezero-metrics/values.yaml | 10 +++++++++- deploy/templates/values.yaml | 11 +++++++++-- deploy/values.yaml | 5 ++++- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/charts/kubezero-metrics/templates/istio-service.yaml b/charts/kubezero-metrics/templates/istio-service.yaml index b2437a59..5b7c3bd1 100644 --- a/charts/kubezero-metrics/templates/istio-service.yaml +++ b/charts/kubezero-metrics/templates/istio-service.yaml @@ -14,3 +14,20 @@ spec: - destination: host: metrics-grafana {{- end }} +--- +{{- if .Values.prometheus.istio.enabled }} +apiVersion: networking.istio.io/v1alpha3 +kind: VirtualService +metadata: + name: prometheus + namespace: monitoring +spec: + hosts: + - {{ .Values.prometheus.istio.url }} + gateways: + - {{ .Values.prometheus.istio.gateway }} + http: + - route: + - destination: + host: metrics-prometheus-operato-prometheus +{{- end }} diff --git a/charts/kubezero-metrics/values.yaml b/charts/kubezero-metrics/values.yaml index de4f334b..766cbf0c 100644 --- a/charts/kubezero-metrics/values.yaml +++ b/charts/kubezero-metrics/values.yaml @@ -4,6 +4,12 @@ grafana: url: "" gateway: ingressgateway.istio-system.svc.cluster.local +prometheus: + istio: + enabled: false + url: "" + gateway: ingressgateway.istio-system.svc.cluster.local + prometheus-operator: defaultRules: create: true @@ -64,7 +70,9 @@ prometheus-operator: enabled: true prometheusSpec: - retention: 10d + retention: 8d + portName: http-prometheus + resources: requests: memory: 512Mi diff --git a/deploy/templates/values.yaml b/deploy/templates/values.yaml index bdadb2c4..d3c1eccb 100644 --- a/deploy/templates/values.yaml +++ b/deploy/templates/values.yaml @@ -95,10 +95,17 @@ kubezero: metrics: enabled: {{ .Values.metrics.enabled }} values: - {{- if and .Values.metrics.istio.enabled .Values.istio.enabled }} + {{- if and .Values.metrics.istio.grafana.enabled .Values.istio.enabled }} grafana: istio: - {{- with .Values.metrics.istio }} + {{- with .Values.metrics.istio.grafana }} + {{- toYaml . | nindent 10 }} + {{- end }} + {{- end }} + {{- if and .Values.metrics.istio.prometheus.enabled .Values.istio.enabled }} + prometheus: + istio: + {{- with .Values.metrics.istio.prometheus }} {{- toYaml . | nindent 10 }} {{- end }} {{- end }} diff --git a/deploy/values.yaml b/deploy/values.yaml index 2bbbfe77..8bc82cfa 100644 --- a/deploy/values.yaml +++ b/deploy/values.yaml @@ -28,7 +28,10 @@ istio: metrics: enabled: false istio: - enabled: false + grafana: + enabled: false + prometheus: + enabled: false # Deprecated once metrics goes live prometheus: