mirror of
https://github.com/carlosedp/cluster-monitoring.git
synced 2024-11-20 19:07:17 +01:00
Add Grafana persistence
This commit is contained in:
parent
86ce17c455
commit
2acf11bcd5
@ -88,8 +88,9 @@ spec:
|
|||||||
runAsUser: 65534
|
runAsUser: 65534
|
||||||
serviceAccountName: grafana
|
serviceAccountName: grafana
|
||||||
volumes:
|
volumes:
|
||||||
- emptyDir: {}
|
- name: grafana-storage
|
||||||
name: grafana-storage
|
persistentVolumeClaim:
|
||||||
|
claimName: grafana-storage
|
||||||
- name: grafana-datasources
|
- name: grafana-datasources
|
||||||
secret:
|
secret:
|
||||||
secretName: grafana-datasources
|
secretName: grafana-datasources
|
||||||
|
11
manifests/grafana-storage.yaml
Normal file
11
manifests/grafana-storage.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: PersistentVolumeClaim
|
||||||
|
metadata:
|
||||||
|
name: grafana-storage
|
||||||
|
namespace: monitoring
|
||||||
|
spec:
|
||||||
|
accessModes:
|
||||||
|
- ReadWriteMany
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
storage: 2Gi
|
@ -89,46 +89,36 @@ local kp = (import 'kube-prometheus/kube-prometheus.libsonnet') +
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
# Override command for Grafana persist data
|
# Override deployment for Grafana data persistence
|
||||||
// grafana+:: {
|
grafana+:: {
|
||||||
// local pvc = k.core.v1.persistentVolumeClaim,
|
deployment+: {
|
||||||
// local deployment = k.apps.v1beta2.deployment,
|
spec+: {
|
||||||
// local container = deployment.mixin.spec.template.spec.containersType,
|
template+: {
|
||||||
// local containerVolumeMount = container.volumeMountsType,
|
spec+: {
|
||||||
// local volume = deployment.mixin.spec.template.spec.volumesType,
|
volumes:
|
||||||
// local grafanaStorage = pvc.new() + pvc.mixin.metadata.withNamespace($._config.namespace) +
|
std.map(
|
||||||
// pvc.mixin.metadata.withName("grafana-storage") +
|
function(v)
|
||||||
// pvc.mixin.spec.withAccessModes('ReadWriteMany') +
|
if v.name == 'grafana-storage' then
|
||||||
// pvc.mixin.spec.resources.withRequests({ storage: '2Gi' }),
|
{'name':'grafana-storage',
|
||||||
// deployment+: {
|
'persistentVolumeClaim': {
|
||||||
// // local storageVolumeName = grafanaStorage,
|
'claimName': 'grafana-storage'}
|
||||||
// // local storageVolume = volume.fromPersistentVolumeClaim(grafanaStorage),
|
}
|
||||||
// // },
|
else
|
||||||
// // {
|
v,
|
||||||
// spec+: {
|
super.volumes
|
||||||
// template+: {
|
),
|
||||||
// spec+: {
|
},
|
||||||
// containers:
|
},
|
||||||
// std.map(
|
},
|
||||||
// function(c)
|
},
|
||||||
// if c.name == 'grafana' then
|
storage:
|
||||||
// c {
|
local pvc = k.core.v1.persistentVolumeClaim;
|
||||||
// volumeMounts+: [
|
local deployment = k.apps.v1beta2.deployment;
|
||||||
// containerVolumeMount.new("grafana-storage", "/var/lib/grafana"),
|
pvc.new() + pvc.mixin.metadata.withNamespace($._config.namespace) +
|
||||||
// ],
|
pvc.mixin.metadata.withName("grafana-storage") +
|
||||||
// }
|
pvc.mixin.spec.withAccessModes('ReadWriteMany') +
|
||||||
// else
|
pvc.mixin.spec.resources.withRequests({ storage: '2Gi' }),
|
||||||
// c,
|
},
|
||||||
// super.containers,
|
|
||||||
// ),
|
|
||||||
// volumes+: [
|
|
||||||
// volume.fromPersistentVolumeClaim(grafanaStorage, "grafana-storage"),
|
|
||||||
// ],
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
|
|
||||||
// Add custom dashboards
|
// Add custom dashboards
|
||||||
grafanaDashboards+:: {
|
grafanaDashboards+:: {
|
||||||
|
Loading…
Reference in New Issue
Block a user