Add option to configure the StorageClass

This commit is contained in:
Carlos de Paula 2020-06-22 19:38:27 -03:00
parent c2e91b0ea9
commit ad1d165158
2 changed files with 12 additions and 7 deletions

View File

@ -82,9 +82,8 @@ local vars = import 'vars.jsonnet';
pvc.new() +
pvc.mixin.spec.withAccessModes('ReadWriteOnce') +
pvc.mixin.spec.resources.withRequests({ storage: vars.enablePersistence.prometheusSizePV }) +
(if vars.enablePersistence.prometheusPV != null then pvc.mixin.spec.withVolumeName(vars.enablePersistence.prometheusPV)),
// Uncomment below to define a StorageClass name
//+ pvc.mixin.spec.withStorageClassName('nfs-master-ssd'),
(if vars.enablePersistence.prometheusPV != null then pvc.mixin.spec.withVolumeName(vars.enablePersistence.prometheusPV)) +
(if vars.enablePersistence.storageClass != null then pvc.mixin.spec.withStorageClassName(vars.enablePersistence.storageClass)),
},
} else {}),
},
@ -125,7 +124,9 @@ local vars = import 'vars.jsonnet';
pvc.mixin.metadata.withName('grafana-storage') +
pvc.mixin.spec.withAccessModes('ReadWriteOnce') +
pvc.mixin.spec.resources.withRequests({ storage: vars.enablePersistence.grafanaSizePV }) +
(if vars.enablePersistence.grafanaPV != null then pvc.mixin.spec.withVolumeName(vars.enablePersistence.grafanaPV)),
(if vars.enablePersistence.grafanaPV != null then pvc.mixin.spec.withVolumeName(vars.enablePersistence.grafanaPV)) +
(if vars.enablePersistence.storageClass != null then pvc.mixin.spec.withStorageClassName(vars.enablePersistence.storageClass)),
} else {},
grafanaDashboards+:: $._config.grafanaDashboards,

View File

@ -52,14 +52,18 @@
TLSCertificate: importstr 'server.crt',
TLSKey: importstr 'server.key',
// Setting these to false, defaults to emptyDirs.
// If using a pre-created PV, fill in the names. If blank, they will use the default StorageClass
// Persistent volume configuration
enablePersistence: {
// Setting these to false, defaults to emptyDirs.
prometheus: false,
grafana: false,
// If using a pre-created PV, fill in the names below. If blank, they will use the default StorageClass
prometheusPV: '',
prometheusSizePV: '2Gi',
grafanaPV: '',
// If required to use a specific storageClass, keep the PV names above blank and fill the storageClass name below.
storageClass: '',
// Define the PV sizes below
prometheusSizePV: '2Gi',
grafanaSizePV: '20Gi',
},