From 152f0f9e2b195d030e81d67cb8e2988d09125237 Mon Sep 17 00:00:00 2001 From: Yonah Dissen Date: Tue, 19 Oct 2021 13:00:54 +0300 Subject: [PATCH 1/4] add option for pv --- awx/README.md | 4 ++++ awx/templates/pv.yaml | 19 +++++++++++++++++++ awx/values.yaml | 8 ++++++++ 3 files changed, 31 insertions(+) create mode 100644 awx/templates/pv.yaml diff --git a/awx/README.md b/awx/README.md index d73e737..5fe59d1 100644 --- a/awx/README.md +++ b/awx/README.md @@ -82,6 +82,10 @@ Per the AWX documentation, if you choose to turn off Job Isolation you can do so | postgresql.enabled | bool | `true` | Set to false if using external postgresql | | postgresql.postgresqlHost | string | `nil` | Set this only if using an external postgresql database. Alternatively, you can provide this value through postgresqlExistingSecret. | | postgresql.postgresqlPassword | string | `nil` | You must set this value or provide postgresqlExistingSecret | +| postgresql.pv.enabled | bool | `false` | Set to true if you want to create local pv | +| postgresql.pv.size | string | `8Gi` | Size of the local pv to create postgres default is 8Gi | +| postgresql.pv.path | string | `"/mnt/data"` | path of where to mount the pv | +| postgresql.volumePermissions.enabled | bool | `false` | Set to true if you want to create local pv with non root permissions | | postgresqlExistingSecret | string | `nil` | The name of an existing secret in the same namespace containing DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_HOST, DATABASE_PORT, DATABASE_PASSWORD, DATABASE_ADMIN_PASSWORD keys and values | | redis | object | `{"architecture":"standalone","auth":{"enabled":false},"enabled":true,"host":null,"image":{"tag":"6.2.4"},"port":6379}` | See bitnami/redis chart values for all options | | redis.enabled | bool | `true` | Set to false if using external redis | diff --git a/awx/templates/pv.yaml b/awx/templates/pv.yaml new file mode 100644 index 0000000..c366174 --- /dev/null +++ b/awx/templates/pv.yaml @@ -0,0 +1,19 @@ +{{- if and ( .Values.postgresql.persistence.enabled ) ( .Values.postgresql.persistence.pv.enabled ) }} +apiVersion: v1 +kind: PersistentVolume +metadata: + name: {{ include "awx.fullname" . }}-volume + labels: + type: local + app.kubernetes.io/name: {{ include "awx.name" . }} + helm.sh/chart: {{ include "awx.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + capacity: + storage: {{ .Values.postgresql.persistence.pv.size }} + accessModes: + - ReadWriteOnce + hostPath: + path: {{ .Values.postgresql.persistence.pv.path }} +{{- end }} \ No newline at end of file diff --git a/awx/values.yaml b/awx/values.yaml index f2c8c99..a7be870 100644 --- a/awx/values.yaml +++ b/awx/values.yaml @@ -114,9 +114,17 @@ postgresql: persistence: enabled: true # size: 50Gi + # if pv enabled you should enable volumePermissions as well + pv: + enabled: false + size: 8Gi + path: "/mnt/data" # resources: {} metrics: enabled: false + volumePermissions: + enabled: false + # -- The name of an existing secret in the same namespace containing DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_HOST, DATABASE_PORT, DATABASE_PASSWORD, DATABASE_ADMIN_PASSWORD keys and values postgresqlExistingSecret: From 2f5f2ae9ddde0ac801ecf181c4a30e1653ac7efb Mon Sep 17 00:00:00 2001 From: yonahd <47282577+yonahd@users.noreply.github.com> Date: Tue, 19 Oct 2021 13:10:43 +0300 Subject: [PATCH 2/4] Update pv.yaml --- awx/templates/pv.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/templates/pv.yaml b/awx/templates/pv.yaml index c366174..df4dd33 100644 --- a/awx/templates/pv.yaml +++ b/awx/templates/pv.yaml @@ -16,4 +16,4 @@ spec: - ReadWriteOnce hostPath: path: {{ .Values.postgresql.persistence.pv.path }} -{{- end }} \ No newline at end of file +{{- end }} From e46ce8c44f487a762fc161f8e9fdbdb2794dcf00 Mon Sep 17 00:00:00 2001 From: Yonah Dissen Date: Wed, 20 Oct 2021 13:36:54 +0300 Subject: [PATCH 3/4] force bind between pv and pvc --- awx/templates/pv.yaml | 2 +- awx/values.yaml | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/awx/templates/pv.yaml b/awx/templates/pv.yaml index c366174..7afbbcd 100644 --- a/awx/templates/pv.yaml +++ b/awx/templates/pv.yaml @@ -4,7 +4,7 @@ kind: PersistentVolume metadata: name: {{ include "awx.fullname" . }}-volume labels: - type: local + type: awx-local app.kubernetes.io/name: {{ include "awx.name" . }} helm.sh/chart: {{ include "awx.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/awx/values.yaml b/awx/values.yaml index a7be870..495c862 100644 --- a/awx/values.yaml +++ b/awx/values.yaml @@ -119,6 +119,9 @@ postgresql: enabled: false size: 8Gi path: "/mnt/data" + selector: + matchLabels: + type: awx-local # resources: {} metrics: enabled: false From 9dcec1ea83078993ef23aee46eb8d816bd78ab6a Mon Sep 17 00:00:00 2001 From: Yonah Dissen Date: Wed, 20 Oct 2021 13:49:43 +0300 Subject: [PATCH 4/4] force bind between pv and pvc fix values and readme --- awx/README.md | 1 + awx/templates/pv.yaml | 2 +- awx/values.yaml | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/awx/README.md b/awx/README.md index 5fe59d1..21c84b6 100644 --- a/awx/README.md +++ b/awx/README.md @@ -85,6 +85,7 @@ Per the AWX documentation, if you choose to turn off Job Isolation you can do so | postgresql.pv.enabled | bool | `false` | Set to true if you want to create local pv | | postgresql.pv.size | string | `8Gi` | Size of the local pv to create postgres default is 8Gi | | postgresql.pv.path | string | `"/mnt/data"` | path of where to mount the pv | +| postgresql.persistence.selector | {} | `{"matchLabels": {"type": "awx-local"}` | Selector to match an existing Persistent Volume | | postgresql.volumePermissions.enabled | bool | `false` | Set to true if you want to create local pv with non root permissions | | postgresqlExistingSecret | string | `nil` | The name of an existing secret in the same namespace containing DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_HOST, DATABASE_PORT, DATABASE_PASSWORD, DATABASE_ADMIN_PASSWORD keys and values | | redis | object | `{"architecture":"standalone","auth":{"enabled":false},"enabled":true,"host":null,"image":{"tag":"6.2.4"},"port":6379}` | See bitnami/redis chart values for all options | diff --git a/awx/templates/pv.yaml b/awx/templates/pv.yaml index cbb8a7a..f9fbdd1 100644 --- a/awx/templates/pv.yaml +++ b/awx/templates/pv.yaml @@ -4,7 +4,7 @@ kind: PersistentVolume metadata: name: {{ include "awx.fullname" . }}-volume labels: - type: awx-local + type: {{ .Values.postgresql.persistence.pv.selector.matchLabels.type }} app.kubernetes.io/name: {{ include "awx.name" . }} helm.sh/chart: {{ include "awx.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/awx/values.yaml b/awx/values.yaml index 495c862..e4452da 100644 --- a/awx/values.yaml +++ b/awx/values.yaml @@ -119,9 +119,9 @@ postgresql: enabled: false size: 8Gi path: "/mnt/data" - selector: - matchLabels: - type: awx-local + selector: + matchLabels: + type: awx-local # resources: {} metrics: enabled: false