104 lines
3.6 KiB
YAML
104 lines
3.6 KiB
YAML
![]() |
{{- define "openstack-cluster.loki-stack.hookScript" -}}
|
||
|
# Ensure that the dashboard configmaps belong to the Helm release for the manifest object
|
||
|
helm-adopt \
|
||
|
loki-stack-dashboards \
|
||
|
{{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }} \
|
||
|
configmap/loki-stack-grafana-datasource \
|
||
|
--namespace {{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }}
|
||
|
helm-adopt \
|
||
|
loki-stack-dashboards \
|
||
|
{{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }} \
|
||
|
configmap/loki-stack-grafana-dashboard \
|
||
|
--namespace {{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }}
|
||
|
# At some point in the evolution of the promtail chart, the selector labels for the daemonset changed
|
||
|
# This is an immutable field, so we remove the daemonset with the old labels before upgrading
|
||
|
# NOTE: Once the upgrade to the new labels has occurred, this will be a no-op
|
||
|
kubectl delete daemonset \
|
||
|
-l release=loki-stack,app=promtail \
|
||
|
-n {{ .Values.addons.monitoring.lokiStack.release.namespace }}
|
||
|
{{- end }}
|
||
|
|
||
|
{{-
|
||
|
if and
|
||
|
.Values.addons.enabled
|
||
|
.Values.addons.monitoring.enabled
|
||
|
.Values.addons.monitoring.lokiStack.enabled
|
||
|
}}
|
||
|
---
|
||
|
apiVersion: v1
|
||
|
kind: Secret
|
||
|
metadata:
|
||
|
name: {{ include "openstack-cluster.componentName" (list . "loki-stack") }}-config
|
||
|
labels:
|
||
|
{{- include "openstack-cluster.componentLabels" (list . "loki-stack") | nindent 4 }}
|
||
|
{{ .Values.addons.watchLabel }}: ""
|
||
|
stringData:
|
||
|
values: |
|
||
|
{{- toYaml .Values.addons.monitoring.lokiStack.release.values | nindent 4 }}
|
||
|
---
|
||
|
apiVersion: addons.stackhpc.com/v1alpha1
|
||
|
kind: HelmRelease
|
||
|
metadata:
|
||
|
name: {{ include "openstack-cluster.componentName" (list . "loki-stack") }}
|
||
|
labels: {{ include "openstack-cluster.componentLabels" (list . "loki-stack") | nindent 4 }}
|
||
|
spec:
|
||
|
clusterName: {{ include "openstack-cluster.clusterName" . }}
|
||
|
bootstrap: true
|
||
|
chart: {{ toYaml .Values.addons.monitoring.lokiStack.chart | nindent 4 }}
|
||
|
targetNamespace: {{ .Values.addons.monitoring.lokiStack.release.namespace }}
|
||
|
releaseName: loki-stack
|
||
|
valuesSources:
|
||
|
- secret:
|
||
|
name: {{ include "openstack-cluster.componentName" (list . "loki-stack") }}-config
|
||
|
key: values
|
||
|
---
|
||
|
{{-
|
||
|
include
|
||
|
"openstack-cluster.hookJob"
|
||
|
(list
|
||
|
.
|
||
|
"pre-upgrade"
|
||
|
"loki-stack-migrate"
|
||
|
"openstack-cluster.loki-stack.hookScript"
|
||
|
)
|
||
|
}}
|
||
|
---
|
||
|
apiVersion: addons.stackhpc.com/v1alpha1
|
||
|
kind: Manifests
|
||
|
metadata:
|
||
|
name: {{ include "openstack-cluster.componentName" (list . "loki-stack") }}-dashboards
|
||
|
labels: {{ include "openstack-cluster.componentLabels" (list . "loki-stack") | nindent 4 }}
|
||
|
spec:
|
||
|
clusterName: {{ include "openstack-cluster.clusterName" . }}
|
||
|
bootstrap: true
|
||
|
targetNamespace: {{ .Values.addons.monitoring.kubePrometheusStack.release.namespace }}
|
||
|
releaseName: loki-stack-dashboards
|
||
|
manifestSources:
|
||
|
- template: |
|
||
|
apiVersion: v1
|
||
|
kind: ConfigMap
|
||
|
metadata:
|
||
|
name: loki-stack-grafana-datasource
|
||
|
labels:
|
||
|
grafana_datasource: "1"
|
||
|
data:
|
||
|
loki-datasource.yaml: |-
|
||
|
apiVersion: 1
|
||
|
datasources:
|
||
|
- name: Loki
|
||
|
type: loki
|
||
|
url: http://loki-stack.{{ .Values.addons.monitoring.lokiStack.release.namespace }}:3100
|
||
|
access: proxy
|
||
|
version: 1
|
||
|
- template: |
|
||
|
apiVersion: v1
|
||
|
kind: ConfigMap
|
||
|
metadata:
|
||
|
name: loki-stack-grafana-dashboard
|
||
|
labels:
|
||
|
grafana_dashboard: "1"
|
||
|
data:
|
||
|
loki-dashboard.json: |
|
||
|
{{- .Files.Get "grafana-dashboards/loki-dashboard.json" | nindent 12 }}
|
||
|
{{- end }}
|