From ad1d165158447faf8354eb5cba4433c3963fe995 Mon Sep 17 00:00:00 2001 From: Carlos de Paula Date: Mon, 22 Jun 2020 19:38:27 -0300 Subject: [PATCH] Add option to configure the StorageClass --- base_operator_stack.jsonnet | 9 +++++---- vars.jsonnet | 10 +++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/base_operator_stack.jsonnet b/base_operator_stack.jsonnet index 39931a4..7a0d109 100644 --- a/base_operator_stack.jsonnet +++ b/base_operator_stack.jsonnet @@ -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, diff --git a/vars.jsonnet b/vars.jsonnet index 4c3bdfb..11495cd 100644 --- a/vars.jsonnet +++ b/vars.jsonnet @@ -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', },