Commit 815ef473 by Guangbo Chen Committed by Alena Prokharchyk

Add Kiali config to istio to reuse cluster-monitoring

parent ca23d42c
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: ConfigMap
metadata:
......@@ -14,3 +15,4 @@ data:
{{- include "grafana-default.yaml.tpl" . | indent 4}}
run.sh: |-
{{- include "install-custom-resources.sh.tpl" . | indent 4}}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
{{- $files := .Files }}
{{- range $path, $bytes := .Files.Glob "dashboards/*.json" }}
{{- $filename := trimSuffix (ext $path) (base $path) }}
......@@ -16,3 +17,4 @@ data:
{{ base $path }}: '{{ $files.Get $path }}'
---
{{- end }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: ConfigMap
metadata:
......@@ -23,3 +24,4 @@ data:
{{ toYaml $value | indent 4 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: ServiceAccount
{{- if .Values.global.imagePullSecrets }}
......@@ -92,3 +93,4 @@ spec:
affinity:
{{- include "nodeaffinity" . | indent 6 }}
{{- include "podAntiAffinity" . | indent 6 }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: apps/v1
kind: Deployment
metadata:
......@@ -147,3 +148,4 @@ spec:
configMap:
name: istio-grafana-configuration-dashboards-{{ $filename }}
{{- end }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
{{- if .Values.ingress.enabled -}}
apiVersion: extensions/v1beta1
kind: Ingress
......@@ -38,3 +39,4 @@ spec:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: ConfigMap
metadata:
......@@ -76,3 +77,4 @@ data:
}
}
}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
{{- if .Values.persistence.enabled }}
kind: PersistentVolumeClaim
apiVersion: v1
......@@ -17,3 +18,4 @@ spec:
requests:
storage: {{ .Values.persistence.size }}
{{- end }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: Service
metadata:
......@@ -22,3 +23,4 @@ spec:
port: 80
selector:
app: grafana
{{- end -}}
......@@ -22,7 +22,24 @@ data:
{{- end }}
{{- end }}
grafana:
{{- if eq .Values.global.monitoring.type "cluster-monitoring" }}
url: https://{{ .Values.global.rancher.domain }}/k8s/clusters/{{ .Values.global.rancher.clusterId }}/api/v1/namespaces/cattle-prometheus/services/http:access-grafana:80/proxy/
service_namespace: cattle-prometheus
service: access-grafana
{{- else if eq .Values.global.monitoring.type "built-in" }}
{{- if and .Values.global.rancher (and .Values.global.rancher.domain .Values.global.rancher.clusterId) }}
url: https://{{ .Values.global.rancher.domain }}/k8s/clusters/{{ .Values.global.rancher.clusterId }}/api/v1/namespaces/{{ .Release.Namespace }}/services/http:grafana:80/proxy/
{{- end }}
{{- else }}
custom_metrics_url: "http://prometheus.{{ .Release.Namespace }}:9090"
{{- if .Values.dashboard.grafanaURL }}
url: {{ .Values.dashboard.grafanaURL }}
{{- end }}
{{- end }}
prometheus:
{{- if eq .Values.global.monitoring.type "cluster-monitoring" }}
url: "http://access-prometheus.cattle-prometheus:80"
{{- else }}
url: {{ .Values.prometheusAddr }}
{{- end }}
......@@ -41,12 +41,6 @@ spec:
- "-v"
- "4"
env:
{{- if and .Values.global.rancher (and .Values.global.rancher.domain .Values.global.rancher.clusterId) }}
{{- if not .Values.dashboard.grafanaURL }}
- name: GRAFANA_URL
value: 'https://{{ .Values.global.rancher.domain }}/k8s/clusters/{{ .Values.global.rancher.clusterId }}/api/v1/namespaces/{{ .Release.Namespace }}/services/http:grafana:80/proxy/'
{{- end }}
{{- end }}
- name: ACTIVE_NAMESPACE
valueFrom:
fieldRef:
......@@ -65,8 +59,6 @@ spec:
name: {{ .Values.dashboard.secretName }}
key: passphrase
optional: true
- name: PROMETHEUS_SERVICE_URL
value: {{ .Values.prometheusAddr }}
{{- if .Values.contextPath }}
- name: SERVER_WEB_ROOT
value: {{ .Values.contextPath }}
......
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
......@@ -22,3 +23,4 @@ rules:
verbs: ["get"]
- nonResourceURLs: ["/metrics"]
verbs: ["get"]
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
......@@ -15,3 +16,4 @@ subjects:
- kind: ServiceAccount
name: prometheus
namespace: {{ .Release.Namespace }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: ConfigMap
metadata:
......@@ -279,3 +280,4 @@ data:
- source_labels: [__meta_kubernetes_pod_name]
action: replace
target_label: pod_name
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
# TODO: the original template has service account, roles, etc
apiVersion: apps/v1
kind: Deployment
......@@ -103,3 +104,4 @@ spec:
tolerations:
{{ toYaml .Values.tolerations | indent 6 }}
{{- end }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
{{- if .Values.ingress.enabled -}}
apiVersion: extensions/v1beta1
kind: Ingress
......@@ -38,3 +39,4 @@ spec:
{{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}}
{{- end -}}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: ConfigMap
metadata:
......@@ -80,3 +81,4 @@ data:
}
}
}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: Service
metadata:
......@@ -42,3 +43,4 @@ spec:
- name: access-prometheus
protocol: TCP
port: 80
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1
kind: ServiceAccount
{{- if .Values.global.imagePullSecrets }}
......@@ -14,3 +15,4 @@ metadata:
chart: {{ template "prometheus.chart" . }}
heritage: {{ .Release.Service }}
release: {{ .Release.Name }}
{{- end -}}
......@@ -545,3 +545,8 @@ global:
# This field is set to false by default, so 'helm template ...'
# will ignore the helm test yaml files when generating the template
enableHelmTest: false
# Specify the monitoring server config of istio
monitoring:
# options includes built-in, cluster-monitoring and custom, default to internal
type: built-in
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment