| romeromonser | 599d5e2 | 2020-03-06 10:23:29 +0100 | [diff] [blame] | 1 | # Copyright 2020 Minsait - Indra S.A. |
| 2 | # |
| 3 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | # you may not use this file except in compliance with the License. |
| 5 | # You may obtain a copy of the License at |
| 6 | # |
| 7 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | # |
| 9 | # Unless required by applicable law or agreed to in writing, software |
| 10 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | # See the License for the specific language governing permissions and |
| 13 | # limitations under the License. |
| 14 | # Author: Jose Manuel Palacios (jmpalacios@minsait.com) |
| 15 | # Author: Alberto Limon (alimonj@minsait.com) |
| 16 | |
| 17 | apiVersion: rbac.authorization.k8s.io/v1 |
| 18 | kind: ClusterRole |
| 19 | metadata: |
| 20 | labels: |
| 21 | app: grafana |
| 22 | name: grafana-clusterrole |
| 23 | rules: |
| 24 | - apiGroups: |
| 25 | - "" |
| 26 | resources: |
| 27 | - configmaps |
| 28 | - secrets |
| 29 | verbs: |
| 30 | - get |
| 31 | - watch |
| 32 | - list |
| 33 | --- |
| 34 | apiVersion: rbac.authorization.k8s.io/v1 |
| 35 | kind: ClusterRoleBinding |
| 36 | metadata: |
| 37 | labels: |
| 38 | app: grafana |
| 39 | name: grafana-clusterrolebinding |
| 40 | roleRef: |
| 41 | apiGroup: rbac.authorization.k8s.io |
| 42 | kind: ClusterRole |
| 43 | name: grafana-clusterrole |
| 44 | subjects: |
| 45 | - kind: ServiceAccount |
| 46 | name: grafana |
| 47 | namespace: osm |
| 48 | --- |
| 49 | apiVersion: v1 |
| 50 | data: |
| 51 | admin-password: YWRtaW4= |
| 52 | admin-user: YWRtaW4= |
| 53 | kind: Secret |
| 54 | metadata: |
| 55 | labels: |
| 56 | app: grafana |
| 57 | name: grafana |
| 58 | type: Opaque |
| 59 | --- |
| 60 | apiVersion: v1 |
| 61 | kind: ServiceAccount |
| 62 | metadata: |
| 63 | labels: |
| 64 | app: grafana |
| 65 | name: grafana |
| 66 | --- |
| 67 | apiVersion: v1 |
| 68 | data: |
| 69 | provider.yaml: |- |
| 70 | apiVersion: 1 |
| 71 | providers: |
| 72 | - name: 'Kubernetes Cluster' |
| 73 | orgId: 1 |
| 74 | folder: 'Kubernetes Cluster' |
| 75 | type: file |
| 76 | disableDeletion: false |
| 77 | options: |
| 78 | path: '/tmp/dashboards/Kubernetes Cluster' |
| 79 | - name: 'Open Source MANO' |
| 80 | orgId: 1 |
| 81 | folder: 'Open Source MANO' |
| 82 | type: file |
| 83 | disableDeletion: false |
| 84 | options: |
| 85 | path: '/tmp/dashboards/Open Source MANO' |
| 86 | kind: ConfigMap |
| 87 | metadata: |
| 88 | labels: |
| 89 | app: grafana |
| 90 | name: grafana-dashboard-provider |
| 91 | --- |
| 92 | apiVersion: v1 |
| 93 | kind: ConfigMap |
| 94 | metadata: |
| 95 | labels: |
| 96 | grafana_datasource: "1" |
| 97 | name: grafana-datasource |
| 98 | data: |
| 99 | datasource.yaml: |- |
| 100 | apiVersion: 1 |
| 101 | datasources: |
| 102 | - name: osm_prometheus |
| 103 | type: prometheus |
| 104 | url: http://prometheus:9090 |
| 105 | access: proxy |
| 106 | allowUiUpdates: true |
| 107 | isDefault: true |
| 108 | - name: Prometheus |
| 109 | type: prometheus |
| 110 | url: http://osm-monitoring-prometheus-prometheus.monitoring:9090 |
| 111 | access: proxy |
| 112 | allowUiUpdates: true |
| 113 | isDefault: false |
| 114 | --- |
| 115 | apiVersion: v1 |
| 116 | data: |
| 117 | grafana.ini: | |
| 118 | [log] |
| 119 | mode = console |
| 120 | [paths] |
| 121 | data = /var/lib/grafana/data |
| 122 | logs = /var/log/grafana |
| 123 | plugins = /var/lib/grafana/plugins |
| 124 | provisioning = /etc/grafana/provisioning |
| 125 | kind: ConfigMap |
| 126 | metadata: |
| 127 | labels: |
| 128 | app: grafana |
| 129 | name: grafana |
| 130 | --- |
| 131 | apiVersion: apps/v1 |
| 132 | kind: Deployment |
| 133 | metadata: |
| 134 | labels: |
| 135 | app: grafana |
| 136 | name: grafana |
| 137 | spec: |
| 138 | replicas: 1 |
| 139 | selector: |
| 140 | matchLabels: |
| 141 | app: grafana |
| 142 | template: |
| 143 | metadata: |
| 144 | labels: |
| 145 | app: grafana |
| 146 | spec: |
| 147 | containers: |
| 148 | - env: |
| 149 | - name: LABEL |
| 150 | value: grafana_dashboard |
| 151 | - name: FOLDER |
| 152 | value: "/tmp/dashboards/Kubernetes Cluster" |
| 153 | - name: RESOURCE |
| 154 | value: both |
| 155 | - name: NAMESPACE |
| 156 | value: monitoring |
| 157 | image: kiwigrid/k8s-sidecar:0.1.20 |
| 158 | imagePullPolicy: IfNotPresent |
| 159 | name: grafana-sc-dashboard |
| 160 | resources: {} |
| 161 | terminationMessagePath: /dev/termination-log |
| 162 | terminationMessagePolicy: File |
| 163 | volumeMounts: |
| 164 | - mountPath: "/tmp/dashboards/Kubernetes Cluster" |
| 165 | name: sc-dashboard-volume-k8s |
| 166 | - mountPath: "/tmp/dashboards/Open Source MANO" |
| 167 | name: sc-dashboard-volume-osm |
| 168 | - env: |
| 169 | - name: GF_SECURITY_ADMIN_USER |
| 170 | valueFrom: |
| 171 | secretKeyRef: |
| 172 | key: admin-user |
| 173 | name: grafana |
| 174 | - name: GF_SECURITY_ADMIN_PASSWORD |
| 175 | valueFrom: |
| 176 | secretKeyRef: |
| 177 | key: admin-password |
| 178 | name: grafana |
| 179 | image: grafana/grafana:6.3.5 |
| 180 | imagePullPolicy: IfNotPresent |
| 181 | livenessProbe: |
| 182 | failureThreshold: 10 |
| 183 | httpGet: |
| 184 | path: /api/health |
| 185 | port: 3000 |
| 186 | scheme: HTTP |
| 187 | initialDelaySeconds: 60 |
| 188 | periodSeconds: 10 |
| 189 | successThreshold: 1 |
| 190 | timeoutSeconds: 30 |
| 191 | name: grafana |
| 192 | ports: |
| 193 | - containerPort: 80 |
| 194 | name: service |
| 195 | protocol: TCP |
| 196 | - containerPort: 3000 |
| 197 | name: grafana |
| 198 | protocol: TCP |
| 199 | readinessProbe: |
| 200 | failureThreshold: 3 |
| 201 | httpGet: |
| 202 | path: /api/health |
| 203 | port: 3000 |
| 204 | scheme: HTTP |
| 205 | periodSeconds: 10 |
| 206 | successThreshold: 1 |
| 207 | timeoutSeconds: 1 |
| 208 | resources: {} |
| 209 | terminationMessagePath: /dev/termination-log |
| 210 | terminationMessagePolicy: File |
| 211 | volumeMounts: |
| 212 | - mountPath: /etc/grafana/grafana.ini |
| 213 | name: config |
| 214 | subPath: grafana.ini |
| 215 | - mountPath: /var/lib/grafana |
| 216 | name: storage |
| 217 | - mountPath: "/tmp/dashboards/Kubernetes Cluster" |
| 218 | name: sc-dashboard-volume-k8s |
| 219 | - mountPath: "/tmp/dashboards/Open Source MANO" |
| 220 | name: sc-dashboard-volume-osm |
| 221 | - mountPath: /etc/grafana/provisioning/dashboards/sc-dashboardproviders.yaml |
| 222 | name: sc-dashboard-provider |
| 223 | subPath: provider.yaml |
| 224 | - mountPath: /etc/grafana/provisioning/datasources |
| 225 | name: sc-datasources-volume |
| 226 | dnsPolicy: ClusterFirst |
| 227 | initContainers: |
| 228 | - env: |
| 229 | - name: METHOD |
| 230 | value: LIST |
| 231 | - name: LABEL |
| 232 | value: grafana_datasource |
| 233 | - name: FOLDER |
| 234 | value: /etc/grafana/provisioning/datasources |
| 235 | - name: RESOURCE |
| 236 | value: both |
| 237 | image: kiwigrid/k8s-sidecar:0.1.20 |
| 238 | imagePullPolicy: IfNotPresent |
| 239 | name: grafana-sc-datasources |
| 240 | resources: {} |
| 241 | terminationMessagePath: /dev/termination-log |
| 242 | terminationMessagePolicy: File |
| 243 | volumeMounts: |
| 244 | - mountPath: /etc/grafana/provisioning/datasources |
| 245 | name: sc-datasources-volume |
| 246 | restartPolicy: Always |
| 247 | schedulerName: default-scheduler |
| 248 | securityContext: |
| 249 | fsGroup: 472 |
| 250 | runAsUser: 472 |
| 251 | serviceAccount: grafana |
| 252 | serviceAccountName: grafana |
| 253 | terminationGracePeriodSeconds: 30 |
| 254 | volumes: |
| 255 | - configMap: |
| 256 | defaultMode: 420 |
| 257 | name: grafana |
| 258 | name: config |
| 259 | - emptyDir: {} |
| 260 | name: storage |
| 261 | - emptyDir: {} |
| 262 | name: sc-dashboard-volume-k8s |
| 263 | - emptyDir: {} |
| 264 | name: sc-dashboard-volume-osm |
| 265 | - configMap: |
| 266 | defaultMode: 420 |
| 267 | name: grafana-dashboard-provider |
| 268 | name: sc-dashboard-provider |
| 269 | - emptyDir: {} |
| 270 | name: sc-datasources-volume |
| 271 | --- |
| 272 | apiVersion: v1 |
| 273 | kind: Service |
| 274 | metadata: |
| 275 | labels: |
| 276 | app: grafana |
| 277 | name: grafana |
| 278 | spec: |
| 279 | ports: |
| 280 | - name: service |
| 281 | nodePort: 3000 |
| 282 | port: 3000 |
| 283 | protocol: TCP |
| 284 | targetPort: 3000 |
| 285 | selector: |
| 286 | app: grafana |
| 287 | sessionAffinity: None |
| 288 | type: NodePort |