From 6f0b37102dc4e5c52efa02ed15d26674ae92a188 Mon Sep 17 00:00:00 2001 From: Cole Arendt Date: Tue, 18 Jan 2022 22:25:13 -0500 Subject: [PATCH] add storage values to generic chart this should allow creating a PVC with a generic app deployment --- charts/generic/Chart.yaml | 2 +- charts/generic/NEWS.md | 5 +++ charts/generic/README.md | 54 +++++++++++++++++++++++++++ charts/generic/ci/storage-values.yaml | 5 +++ charts/generic/templates/pvc.yaml | 22 +++++++++++ charts/generic/values.yaml | 9 +++++ 6 files changed, 96 insertions(+), 1 deletion(-) create mode 100644 charts/generic/README.md create mode 100644 charts/generic/ci/storage-values.yaml create mode 100644 charts/generic/templates/pvc.yaml diff --git a/charts/generic/Chart.yaml b/charts/generic/Chart.yaml index 04df406..0122449 100644 --- a/charts/generic/Chart.yaml +++ b/charts/generic/Chart.yaml @@ -3,7 +3,7 @@ name: generic description: A generic Helm chart for Kubernetes type: application -version: 0.1.2 +version: 0.1.3 appVersion: latest maintainers: - name: colearendt diff --git a/charts/generic/NEWS.md b/charts/generic/NEWS.md index 8680762..ab6a0ad 100644 --- a/charts/generic/NEWS.md +++ b/charts/generic/NEWS.md @@ -1,3 +1,8 @@ +# 0.1.3 + +- Add `storage` values for setting a PersistentVolumeClaim + - It is best when we do not need to use this, but alas, it is often necessary + # 0.1.2 - Add `pod.env` values for setting pod environment variables diff --git a/charts/generic/README.md b/charts/generic/README.md new file mode 100644 index 0000000..8116c13 --- /dev/null +++ b/charts/generic/README.md @@ -0,0 +1,54 @@ +# generic + +![Version: 0.1.3](https://img.shields.io/badge/Version-0.1.3-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: latest](https://img.shields.io/badge/AppVersion-latest-informational?style=flat-square) + +A generic Helm chart for Kubernetes + +## Maintainers + +| Name | Email | Url | +| ---- | ------ | --- | +| colearendt | helm@arendt.life | https://github.com/colearendt | + +## Values + +| Key | Type | Default | Description | +|-----|------|---------|-------------| +| affinity | object | `{}` | | +| autoscaling.enabled | bool | `false` | | +| autoscaling.maxReplicas | int | `100` | | +| autoscaling.minReplicas | int | `1` | | +| autoscaling.targetCPUUtilizationPercentage | int | `80` | | +| fullnameOverride | string | `""` | | +| image.pullPolicy | string | `"IfNotPresent"` | | +| image.repository | string | `"nginx"` | | +| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. | +| imagePullSecrets | list | `[]` | | +| ingress.annotations | object | `{}` | | +| ingress.enabled | bool | `false` | | +| ingress.hosts[0].host | string | `"chart-example.local"` | | +| ingress.hosts[0].paths | list | `[]` | | +| ingress.tls | list | `[]` | | +| nameOverride | string | `""` | | +| nodeSelector | object | `{}` | | +| pod.env | list | `[]` | | +| pod.port | int | `80` | | +| podAnnotations | object | `{}` | | +| podSecurityContext | object | `{}` | | +| replicaCount | int | `1` | | +| resources | object | `{}` | | +| securityContext | object | `{}` | | +| service.port | int | `80` | | +| service.type | string | `"ClusterIP"` | | +| serviceAccount.annotations | object | `{}` | Annotations to add to the service account | +| serviceAccount.create | bool | `true` | Specifies whether a service account should be created | +| serviceAccount.name | string | `""` | The name of the service account to use. -- If not set and create is true, a name is generated using the fullname template | +| storage.accessModes[0] | string | `"ReadWriteOnce"` | | +| storage.create | bool | `false` | | +| storage.name | string | `""` | | +| storage.requests.storage | string | `"6Gi"` | | +| storage.storageClassName | string | `""` | | +| tolerations | list | `[]` | | + +---------------------------------------------- +Autogenerated from chart metadata using [helm-docs v1.5.0](https://github.com/norwoodj/helm-docs/releases/v1.5.0) diff --git a/charts/generic/ci/storage-values.yaml b/charts/generic/ci/storage-values.yaml new file mode 100644 index 0000000..b1ab7ca --- /dev/null +++ b/charts/generic/ci/storage-values.yaml @@ -0,0 +1,5 @@ +storage: + name: my-storage + create: true + requests: + storage: 2Gi diff --git a/charts/generic/templates/pvc.yaml b/charts/generic/templates/pvc.yaml new file mode 100644 index 0000000..921579b --- /dev/null +++ b/charts/generic/templates/pvc.yaml @@ -0,0 +1,22 @@ +{{- if .Values.storage.create }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{default (print (include "generic.fullname" .) "-storage" ) .Values.storage.name }} + namespace: {{ $.Release.Namespace }} + annotations: + "helm.sh/resource-policy": keep +spec: + accessModes: + {{- .Values.storage.accessModes | toYaml | nindent 4 }} + volumeMode: Filesystem + {{- if .Values.storage.storageClassName }} + storageClassName: {{ .Values.storage.storageClassName }} + {{- end }} + resources: + {{- with .Values.storage.requests }} + requests: + {{- . | toYaml | nindent 6 }} + {{- end }} +--- +{{- end }} diff --git a/charts/generic/values.yaml b/charts/generic/values.yaml index 6420993..21f896c 100644 --- a/charts/generic/values.yaml +++ b/charts/generic/values.yaml @@ -14,6 +14,15 @@ pod: port: 80 env: [] +storage: + name: '' + create: false + accessModes: + - ReadWriteOnce + storageClassName: '' + requests: + storage: 6Gi + serviceAccount: # -- Specifies whether a service account should be created create: true