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

View File

@ -52,14 +52,18 @@
TLSCertificate: importstr 'server.crt', TLSCertificate: importstr 'server.crt',
TLSKey: importstr 'server.key', TLSKey: importstr 'server.key',
// Setting these to false, defaults to emptyDirs. // Persistent volume configuration
// If using a pre-created PV, fill in the names. If blank, they will use the default StorageClass
enablePersistence: { enablePersistence: {
// Setting these to false, defaults to emptyDirs.
prometheus: false, prometheus: false,
grafana: false, grafana: false,
// If using a pre-created PV, fill in the names below. If blank, they will use the default StorageClass
prometheusPV: '', prometheusPV: '',
prometheusSizePV: '2Gi',
grafanaPV: '', 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', grafanaSizePV: '20Gi',
}, },