Skip to content

Commit

Permalink
chore(autoperms): remove pvc from autoperms (#468)
Browse files Browse the repository at this point in the history
**Description**
<!--
Please include a summary of the change and which issue is fixed. Please
also include relevant motivation and context. List any dependencies that
are required for this change.
-->
⚒️ Fixes  # <!--(issue)-->

**⚙️ 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?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ 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._
  • Loading branch information
stavros-k committed Jun 13, 2023
1 parent de2bc81 commit a8f1af7
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 42 deletions.
49 changes: 9 additions & 40 deletions library/common-test/tests/addons/autoperms_test.yaml
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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..."
Expand All @@ -345,6 +310,8 @@ tests:
podSpec: {}
ixChartContext:
some: context
ixVolumes:
- hostPath: /mnt/pool/ix-applications/test
persistence:
test1:
enabled: true
Expand Down Expand Up @@ -406,7 +373,8 @@ tests:
mountPath: /test7
test8:
enabled: true
type: pvc
type: ixVolume
datasetName: test
autoPermissions:
chown: true
chmod: 770
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -700,7 +668,8 @@ tests:
persistence:
test:
enabled: true
type: pvc
type: hostPath
hostPath: /test
readOnly: true
autoPermissions:
chmod: 770
Expand Down
2 changes: 1 addition & 1 deletion library/common/Chart.yaml
Expand Up @@ -15,4 +15,4 @@ maintainers:
name: common
sources: null
type: library
version: 12.14.2
version: 12.14.3
2 changes: 1 addition & 1 deletion 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" -}}

Expand Down

0 comments on commit a8f1af7

Please sign in to comment.