From a8f1af737a108f77847a7e31124e8c751f288884 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Tue, 13 Jun 2023 10:36:43 +0300 Subject: [PATCH] chore(autoperms): remove pvc from autoperms (#468) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] 🔃 Refactor of current code **🧪 How Has This Been Tested?** **📃 Notes:** **✔️ Checklist:** - [x] ⚖️ My code follows the style guidelines of this project - [x] 👀 I have performed a self-review of my own code - [ ] #️⃣ I have commented my code, particularly in hard-to-understand areas - [ ] 📄 I have made corresponding changes to the documentation - [x] ⚠️ My changes generate no new warnings - [x] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [x] ⬆️ I increased versions for any altered app according to semantic versioning **➕ App addition** If this PR is an app addition please make sure you have done the following. - [ ] 🪞 I have opened a PR on [truecharts/containers](https://github.com/truecharts/containers) adding the container to TrueCharts mirror repo. - [ ] 🖼️ I have added an icon in the Chart's root directory called `icon.png` --- _Please don't blindly check all the boxes. Read them and only check those that apply. Those checkboxes are there for the reviewer to see what is this all about and the status of this PR with a quick glance._ --- .../tests/addons/autoperms_test.yaml | 49 ++++--------------- library/common/Chart.yaml | 2 +- .../common/templates/lib/util/_autoperms.tpl | 2 +- 3 files changed, 11 insertions(+), 42 deletions(-) diff --git a/library/common-test/tests/addons/autoperms_test.yaml b/library/common-test/tests/addons/autoperms_test.yaml index fcd0597ef..5fc3474f3 100644 --- a/library/common-test/tests/addons/autoperms_test.yaml +++ b/library/common-test/tests/addons/autoperms_test.yaml @@ -69,14 +69,6 @@ tests: chmod: 770 recursive: true mountPath: /test7 - test8: - enabled: true - type: pvc - autoPermissions: - chown: true - chmod: 770 - recursive: true - mountPath: /test8 test9: enabled: true type: nfs @@ -149,13 +141,6 @@ tests: content: name: test7 emptyDir: {} - - documentIndex: *jobDoc - contains: - path: spec.template.spec.volumes - content: - name: test8 - persistentVolumeClaim: - claimName: release-name-common-test-test8 - documentIndex: *jobDoc contains: path: spec.template.spec.volumes @@ -212,13 +197,6 @@ tests: name: test7 mountPath: /mounts/test7 readOnly: false - - documentIndex: *jobDoc - contains: - path: spec.template.spec.containers[0].volumeMounts - content: - name: test8 - mountPath: /mounts/test8 - readOnly: false - documentIndex: *jobDoc contains: path: spec.template.spec.containers[0].volumeMounts @@ -313,19 +291,6 @@ tests: echo "Ownership before: [$before]" echo "Ownership after: [$(stat -c "%u:%g" /mounts/test7)]" echo "" - echo "Automatically correcting permissions for /mounts/test8..." - before=$(stat -c "%a" /mounts/test8) - chmod -$ 770 /mounts/test8 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" - echo "Permissions after: [$(stat -c "%a" /mounts/test8)]" - echo "" - echo "Automatically correcting ownership for /mounts/test8..." - before=$(stat -c "%u:%g" /mounts/test8) - chown -$ -f :568 /mounts/test8 || echo "Failed setting ownership using chown..." - - echo "Ownership before: [$before]" - echo "Ownership after: [$(stat -c "%u:%g" /mounts/test8)]" - echo "" echo "Automatically correcting ownership for /mounts/test9..." before=$(stat -c "%u:%g" /mounts/test9) chown -f :568 /mounts/test9 || echo "Failed setting ownership using chown..." @@ -345,6 +310,8 @@ tests: podSpec: {} ixChartContext: some: context + ixVolumes: + - hostPath: /mnt/pool/ix-applications/test persistence: test1: enabled: true @@ -406,7 +373,8 @@ tests: mountPath: /test7 test8: enabled: true - type: pvc + type: ixVolume + datasetName: test autoPermissions: chown: true chmod: 770 @@ -489,8 +457,8 @@ tests: path: spec.template.spec.volumes content: name: test8 - persistentVolumeClaim: - claimName: release-name-common-test-test8 + hostPath: + path: /mnt/pool/ix-applications/test - documentIndex: *jobDoc contains: path: spec.template.spec.volumes @@ -687,7 +655,7 @@ tests: chown: true asserts: - failedTemplate: - errorMessage: Auto Permissions - Allowed persistent types for auto permissions are [hostPath, pvc, emptyDir, nfs, ixVolume], but got [device] on [test] + errorMessage: Auto Permissions - Allowed persistent types for auto permissions are [hostPath, emptyDir, nfs, ixVolume], but got [device] on [test] - it: should fail trying to set permissions on readOnly set: @@ -700,7 +668,8 @@ tests: persistence: test: enabled: true - type: pvc + type: hostPath + hostPath: /test readOnly: true autoPermissions: chmod: 770 diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index cca8bf4d7..182423a35 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 12.14.2 +version: 12.14.3 diff --git a/library/common/templates/lib/util/_autoperms.tpl b/library/common/templates/lib/util/_autoperms.tpl index 4ebbfc92e..69261db82 100644 --- a/library/common/templates/lib/util/_autoperms.tpl +++ b/library/common/templates/lib/util/_autoperms.tpl @@ -1,7 +1,7 @@ {{/* Contains the auto-permissions job */}} {{- define "tc.v1.common.lib.util.autoperms" -}} -{{- $permAllowedTypes := (list "hostPath" "pvc" "emptyDir" "nfs" "ixVolume") -}} +{{- $permAllowedTypes := (list "hostPath" "emptyDir" "nfs" "ixVolume") -}} {{/* If you change this path, you must change it under _volumeMounts.tpl too*/}} {{- $basePath := "/mounts" -}}