From cfc8028669a25610ca283c0af403ce820ed63a7f Mon Sep 17 00:00:00 2001 From: Fabio Rauber Date: Thu, 19 Nov 2020 10:33:47 -0300 Subject: [PATCH] Added rancher chart questions and worked around its limitation for dealing with arrays --- .../v0.1.0/app-readme.md | 3 + .../v0.1.0/questions.yaml | 70 +++++++++++++++++++ .../v0.1.0/templates/configmap.yaml | 15 +++- .../local-path-provisioner/v0.1.0/values.yaml | 19 +++-- 4 files changed, 100 insertions(+), 7 deletions(-) create mode 100644 charts/local-path-provisioner/v0.1.0/app-readme.md create mode 100644 charts/local-path-provisioner/v0.1.0/questions.yaml diff --git a/charts/local-path-provisioner/v0.1.0/app-readme.md b/charts/local-path-provisioner/v0.1.0/app-readme.md new file mode 100644 index 0000000..5d14739 --- /dev/null +++ b/charts/local-path-provisioner/v0.1.0/app-readme.md @@ -0,0 +1,3 @@ +# Portal Modelo para Casas Legislativas + +Utilize o formulário abaixo para configurar seu Portal Modelo. diff --git a/charts/local-path-provisioner/v0.1.0/questions.yaml b/charts/local-path-provisioner/v0.1.0/questions.yaml new file mode 100644 index 0000000..0ef8e0b --- /dev/null +++ b/charts/local-path-provisioner/v0.1.0/questions.yaml @@ -0,0 +1,70 @@ +labels: + io.cattle.role: project +categories: +- Storage +questions: + +# nodePathMap is the place user can customize where to store the data on each node. +# 1. If one node is not listed on the nodePathMap, and Kubernetes wants to create volume on it, the paths specified in +# DEFAULT_PATH_FOR_NON_LISTED_NODES will be used for provisioning. +# 2. If one node is listed on the nodePathMap, the specified paths will be used for provisioning. +# 1. If one node is listed but with paths set to [], the provisioner will refuse to provision on this node. +# 2. If more than one path was specified, the path would be chosen randomly when provisioning. +# +# The configuration must obey following rules: +# 1. A path must start with /, a.k.a an absolute path. +# 2. Root directory (/) is prohibited. +# 3. No duplicate paths allowed for one node. +# 4. No duplicate node allowed. +nodePathMap: + - node: DEFAULT_PATH_FOR_NON_LISTED_NODES + paths: + + +- variable: storageClass.create + default: true + type: boolean + description: "Create storageClass automatically?" + label: "Create storageClass?" + required: true + group: StorageClass + show_subquestion_if: true + subquestions: + - variable: storageClass.defaultClass + default: false + type: boolean + description: "StorageClass as the default StorageClass." + label: "Is this StorageClass the default class?" + required: false + - variable: storageClass.name + default: local-path + type: string + description: "Set a StorageClass name" + label: "StorageClass Name" + required: false + - variable: storageClass.reclaimPolicy + default: "Delete" + type: enum + description: "ReclaimPolicy field of the class, which can be either Delete or Retain" + label: "Reclaim Policy" + required: false + options: + - "Delete" + - "Reclaim" + +- variable: storageClass.hostDir + default: "/opt/local-path-provisioner" + type: string + description: "Path for creating volumes in every node of the cluster. If you need custom paths, please edit the YAML directly and use customNodePathMap." + label: "Local host directory for volumes." + required: true + group: StorageClass + +- variable: storageClass.provisionerName + default: "rancher.io/local-path" + description: "Set a provisioner name. If unset, a name will be generated." + label: "Provisioner Name" + type: string + group: Provisioner + required: false + diff --git a/charts/local-path-provisioner/v0.1.0/templates/configmap.yaml b/charts/local-path-provisioner/v0.1.0/templates/configmap.yaml index b025053..1bc73a5 100644 --- a/charts/local-path-provisioner/v0.1.0/templates/configmap.yaml +++ b/charts/local-path-provisioner/v0.1.0/templates/configmap.yaml @@ -5,10 +5,23 @@ metadata: labels: {{ include "local-path-provisioner.labels" . | indent 4 }} data: +{{- if .Values.customNodePathMap }} config.json: |- { - "nodePathMap": {{ .Values.nodePathMap | toPrettyJson | nindent 8 }} + "nodePathMap": {{ .Values.customNodePathMap | toPrettyJson | nindent 8 }} } + +{{- else }} + config.json: |- + { + "nodePathMap":[ + { + "node":"DEFAULT_PATH_FOR_NON_LISTED_NODES", + "paths":[{{ .Values.storageClass.hostDir | quote }}] + } + ] + } +{{- end }} setup: |- {{ .Values.configmap.setup | nindent 4 }} teardown: |- diff --git a/charts/local-path-provisioner/v0.1.0/values.yaml b/charts/local-path-provisioner/v0.1.0/values.yaml index b0a3a90..557658a 100644 --- a/charts/local-path-provisioner/v0.1.0/values.yaml +++ b/charts/local-path-provisioner/v0.1.0/values.yaml @@ -42,10 +42,14 @@ storageClass: ## ReclaimPolicy field of the class, which can be either Delete or Retain reclaimPolicy: Delete -# nodePathMap is the place user can customize where to store the data on each node. + ## Default host path for creating volumes. If you need custom paths for nodes, + ## please use customNodePathMap, in which case this setting is ignored. + hostDir: /opt/local-path-provisioner + +# customNodePathMap is the place user can customize where to store the data on each node. # 1. If one node is not listed on the nodePathMap, and Kubernetes wants to create volume on it, the paths specified in # DEFAULT_PATH_FOR_NON_LISTED_NODES will be used for provisioning. -# 2. If one node is listed on the nodePathMap, the specified paths will be used for provisioning. +# 2. If one node is listed on the customNodePathMap, the specified paths will be used for provisioning. # 1. If one node is listed but with paths set to [], the provisioner will refuse to provision on this node. # 2. If more than one path was specified, the path would be chosen randomly when provisioning. # @@ -54,10 +58,13 @@ storageClass: # 2. Root directory (/) is prohibited. # 3. No duplicate paths allowed for one node. # 4. No duplicate node allowed. -nodePathMap: - - node: DEFAULT_PATH_FOR_NON_LISTED_NODES - paths: - - /opt/local-path-provisioner +customNodePathMap: [] +# - node: DEFAULT_PATH_FOR_NON_LISTED_NODES +# paths: +# - /opt/local-path-provisioner +# - node: node1 +# paths: +# - /mnt/otherfolder rbac: # Specifies whether RBAC resources should be created