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 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
...@@ -14,3 +15,4 @@ data: ...@@ -14,3 +15,4 @@ data:
{{- include "grafana-default.yaml.tpl" . | indent 4}} {{- include "grafana-default.yaml.tpl" . | indent 4}}
run.sh: |- run.sh: |-
{{- include "install-custom-resources.sh.tpl" . | indent 4}} {{- include "install-custom-resources.sh.tpl" . | indent 4}}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
{{- $files := .Files }} {{- $files := .Files }}
{{- range $path, $bytes := .Files.Glob "dashboards/*.json" }} {{- range $path, $bytes := .Files.Glob "dashboards/*.json" }}
{{- $filename := trimSuffix (ext $path) (base $path) }} {{- $filename := trimSuffix (ext $path) (base $path) }}
...@@ -16,3 +17,4 @@ data: ...@@ -16,3 +17,4 @@ data:
{{ base $path }}: '{{ $files.Get $path }}' {{ base $path }}: '{{ $files.Get $path }}'
--- ---
{{- end }} {{- end }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
...@@ -23,3 +24,4 @@ data: ...@@ -23,3 +24,4 @@ data:
{{ toYaml $value | indent 4 }} {{ toYaml $value | indent 4 }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
{{- if .Values.global.imagePullSecrets }} {{- if .Values.global.imagePullSecrets }}
...@@ -92,3 +93,4 @@ spec: ...@@ -92,3 +93,4 @@ spec:
affinity: affinity:
{{- include "nodeaffinity" . | indent 6 }} {{- include "nodeaffinity" . | indent 6 }}
{{- include "podAntiAffinity" . | indent 6 }} {{- include "podAntiAffinity" . | indent 6 }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
metadata: metadata:
...@@ -147,3 +148,4 @@ spec: ...@@ -147,3 +148,4 @@ spec:
configMap: configMap:
name: istio-grafana-configuration-dashboards-{{ $filename }} name: istio-grafana-configuration-dashboards-{{ $filename }}
{{- end }} {{- end }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Ingress kind: Ingress
...@@ -38,3 +39,4 @@ spec: ...@@ -38,3 +39,4 @@ spec:
{{ toYaml .Values.ingress.tls | indent 4 }} {{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
...@@ -76,3 +77,4 @@ data: ...@@ -76,3 +77,4 @@ data:
} }
} }
} }
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
{{- if .Values.persistence.enabled }} {{- if .Values.persistence.enabled }}
kind: PersistentVolumeClaim kind: PersistentVolumeClaim
apiVersion: v1 apiVersion: v1
...@@ -17,3 +18,4 @@ spec: ...@@ -17,3 +18,4 @@ spec:
requests: requests:
storage: {{ .Values.persistence.size }} storage: {{ .Values.persistence.size }}
{{- end }} {{- end }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
...@@ -22,3 +23,4 @@ spec: ...@@ -22,3 +23,4 @@ spec:
port: 80 port: 80
selector: selector:
app: grafana app: grafana
{{- end -}}
...@@ -22,7 +22,24 @@ data: ...@@ -22,7 +22,24 @@ data:
{{- end }} {{- end }}
{{- end }} {{- end }}
grafana: 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" custom_metrics_url: "http://prometheus.{{ .Release.Namespace }}:9090"
{{- if .Values.dashboard.grafanaURL }} {{- if .Values.dashboard.grafanaURL }}
url: {{ .Values.dashboard.grafanaURL }} url: {{ .Values.dashboard.grafanaURL }}
{{- end }} {{- 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: ...@@ -41,12 +41,6 @@ spec:
- "-v" - "-v"
- "4" - "4"
env: 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 - name: ACTIVE_NAMESPACE
valueFrom: valueFrom:
fieldRef: fieldRef:
...@@ -65,8 +59,6 @@ spec: ...@@ -65,8 +59,6 @@ spec:
name: {{ .Values.dashboard.secretName }} name: {{ .Values.dashboard.secretName }}
key: passphrase key: passphrase
optional: true optional: true
- name: PROMETHEUS_SERVICE_URL
value: {{ .Values.prometheusAddr }}
{{- if .Values.contextPath }} {{- if .Values.contextPath }}
- name: SERVER_WEB_ROOT - name: SERVER_WEB_ROOT
value: {{ .Values.contextPath }} value: {{ .Values.contextPath }}
......
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole kind: ClusterRole
metadata: metadata:
...@@ -22,3 +23,4 @@ rules: ...@@ -22,3 +23,4 @@ rules:
verbs: ["get"] verbs: ["get"]
- nonResourceURLs: ["/metrics"] - nonResourceURLs: ["/metrics"]
verbs: ["get"] verbs: ["get"]
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding kind: ClusterRoleBinding
metadata: metadata:
...@@ -15,3 +16,4 @@ subjects: ...@@ -15,3 +16,4 @@ subjects:
- kind: ServiceAccount - kind: ServiceAccount
name: prometheus name: prometheus
namespace: {{ .Release.Namespace }} namespace: {{ .Release.Namespace }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
...@@ -279,3 +280,4 @@ data: ...@@ -279,3 +280,4 @@ data:
- source_labels: [__meta_kubernetes_pod_name] - source_labels: [__meta_kubernetes_pod_name]
action: replace action: replace
target_label: pod_name 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 # TODO: the original template has service account, roles, etc
apiVersion: apps/v1 apiVersion: apps/v1
kind: Deployment kind: Deployment
...@@ -103,3 +104,4 @@ spec: ...@@ -103,3 +104,4 @@ spec:
tolerations: tolerations:
{{ toYaml .Values.tolerations | indent 6 }} {{ toYaml .Values.tolerations | indent 6 }}
{{- end }} {{- end }}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
{{- if .Values.ingress.enabled -}} {{- if .Values.ingress.enabled -}}
apiVersion: extensions/v1beta1 apiVersion: extensions/v1beta1
kind: Ingress kind: Ingress
...@@ -38,3 +39,4 @@ spec: ...@@ -38,3 +39,4 @@ spec:
{{ toYaml .Values.ingress.tls | indent 4 }} {{ toYaml .Values.ingress.tls | indent 4 }}
{{- end -}} {{- end -}}
{{- end -}} {{- end -}}
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1 apiVersion: v1
kind: ConfigMap kind: ConfigMap
metadata: metadata:
...@@ -80,3 +81,4 @@ data: ...@@ -80,3 +81,4 @@ data:
} }
} }
} }
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1 apiVersion: v1
kind: Service kind: Service
metadata: metadata:
...@@ -42,3 +43,4 @@ spec: ...@@ -42,3 +43,4 @@ spec:
- name: access-prometheus - name: access-prometheus
protocol: TCP protocol: TCP
port: 80 port: 80
{{- end -}}
{{- if and .Values.enabled (eq .Values.global.monitoring.type "built-in") -}}
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
{{- if .Values.global.imagePullSecrets }} {{- if .Values.global.imagePullSecrets }}
...@@ -14,3 +15,4 @@ metadata: ...@@ -14,3 +15,4 @@ metadata:
chart: {{ template "prometheus.chart" . }} chart: {{ template "prometheus.chart" . }}
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
{{- end -}}
...@@ -545,3 +545,8 @@ global: ...@@ -545,3 +545,8 @@ global:
# This field is set to false by default, so 'helm template ...' # This field is set to false by default, so 'helm template ...'
# will ignore the helm test yaml files when generating the template # will ignore the helm test yaml files when generating the template
enableHelmTest: false 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