a54d6878e72702d7d98e309a34bb706c5f274c61
[osm/devops.git] / installers / helm / osm / templates / grafana / grafana-deployment.yaml
1 {{- if .Values.grafana.enabled -}}
2 #######################################################################################
3 # Copyright ETSI Contributors and Others.
4 #
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
8 #
9 #    http://www.apache.org/licenses/LICENSE-2.0
10 #
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
14 # implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #######################################################################################
18 apiVersion: apps/v1
19 kind: Deployment
20 metadata:
21   labels:
22     app: grafana
23   name: grafana
24 spec:
25   replicas: 1
26   selector:
27     matchLabels:
28       app: grafana
29   template:
30     metadata:
31       labels:
32         app: grafana
33     spec:
34       containers:
35       - env:
36         - name: LABEL
37           value: grafana_dashboard
38         - name: FOLDER
39           value: "/tmp/dashboards/Kubernetes Cluster"
40         - name: RESOURCE
41           value: both
42         - name: NAMESPACE
43           value: monitoring
44         image: kiwigrid/k8s-sidecar:1.15.6
45         imagePullPolicy: IfNotPresent
46         name: grafana-sc-dashboard
47         resources: {}
48         terminationMessagePath: /dev/termination-log
49         terminationMessagePolicy: File
50         volumeMounts:
51         - mountPath: "/tmp/dashboards/Kubernetes Cluster"
52           name: sc-dashboard-volume-k8s
53         - mountPath: "/tmp/dashboards/Open Source MANO"
54           name: sc-dashboard-volume-osm
55       - env:
56         - name: GF_SECURITY_ADMIN_USER
57           valueFrom:
58             secretKeyRef:
59               key: admin-user
60               name: grafana
61         - name: GF_SECURITY_ADMIN_PASSWORD
62           valueFrom:
63             secretKeyRef:
64               key: admin-password
65               name: grafana
66         image: grafana/grafana:8.1.1
67         imagePullPolicy: IfNotPresent
68         livenessProbe:
69           failureThreshold: 10
70           httpGet:
71             path: /api/health
72             port: 3000
73             scheme: HTTP
74           initialDelaySeconds: 60
75           periodSeconds: 10
76           successThreshold: 1
77           timeoutSeconds: 30
78         name: grafana
79         ports:
80         - containerPort: 80
81           name: service
82           protocol: TCP
83         - containerPort: 3000
84           name: grafana
85           protocol: TCP
86         readinessProbe:
87           failureThreshold: 3
88           httpGet:
89             path: /api/health
90             port: 3000
91             scheme: HTTP
92           periodSeconds: 10
93           successThreshold: 1
94           timeoutSeconds: 1
95         resources: {}
96         terminationMessagePath: /dev/termination-log
97         terminationMessagePolicy: File
98         volumeMounts:
99         - mountPath: /etc/grafana/grafana.ini
100           name: config
101           subPath: grafana.ini
102         - mountPath: /var/lib/grafana
103           name: storage
104         - mountPath: "/tmp/dashboards/Kubernetes Cluster"
105           name: sc-dashboard-volume-k8s
106         - mountPath: "/tmp/dashboards/Open Source MANO"
107           name: sc-dashboard-volume-osm
108         - mountPath: /etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml
109           name: sc-dashboard-provider
110           subPath: provider.yaml
111         - mountPath: /etc/grafana/provisioning/datasources
112           name: sc-datasources-volume
113       dnsPolicy: ClusterFirst
114       initContainers:
115       - env:
116         - name: METHOD
117           value: LIST
118         - name: LABEL
119           value: grafana_datasource
120         - name: FOLDER
121           value: /etc/grafana/provisioning/datasources
122         - name: RESOURCE
123           value: both
124         image: kiwigrid/k8s-sidecar:1.15.6
125         imagePullPolicy: IfNotPresent
126         name: grafana-sc-datasources
127         resources: {}
128         terminationMessagePath: /dev/termination-log
129         terminationMessagePolicy: File
130         volumeMounts:
131         - mountPath: /etc/grafana/provisioning/datasources
132           name: sc-datasources-volume
133       restartPolicy: Always
134       schedulerName: default-scheduler
135       securityContext:
136         {{- toYaml .Values.global.podSecurityContext | nindent 8 }}
137       serviceAccount: grafana
138       serviceAccountName: grafana
139       terminationGracePeriodSeconds: 30
140       volumes:
141       - configMap:
142           defaultMode: 420
143           name: grafana
144         name: config
145       - emptyDir: {}
146         name: storage
147       - emptyDir: {}
148         name: sc-dashboard-volume-k8s
149       - emptyDir: {}
150         name: sc-dashboard-volume-osm
151       - configMap:
152           defaultMode: 420
153           name: grafana-dashboard-provider
154         name: sc-dashboard-provider
155       - emptyDir: {}
156         name: sc-datasources-volume
157 {{- end -}}