From b1fe0654deffd594be08510208c2dd34593270a2 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Thu, 28 Dec 2023 21:41:48 +0200 Subject: [PATCH] fix(ingress): explicitly set iCN to null (#669) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [x] 🪛 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:** - [ ] ⚖️ My code follows the style guidelines of this project - [ ] 👀 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 - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 I have added tests to this description that prove my fix is effective or that my feature works - [ ] ⬆️ 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 | 50 +++++++++---------- .../common-test/tests/ingress/stop_test.yaml | 6 ++- library/common/Chart.yaml | 2 +- library/common/templates/class/_ingress.tpl | 4 +- .../common/templates/lib/util/_autoperms.tpl | 4 +- 5 files changed, 33 insertions(+), 33 deletions(-) diff --git a/library/common-test/tests/addons/autoperms_test.yaml b/library/common-test/tests/addons/autoperms_test.yaml index 8e2162d6..9fb7fcfb 100644 --- a/library/common-test/tests/addons/autoperms_test.yaml +++ b/library/common-test/tests/addons/autoperms_test.yaml @@ -249,13 +249,13 @@ tests: echo "Automatically correcting ownership and permissions..." echo "Automatically correcting permissions for /mounts/test1..." before=$(stat -c "%a" /mounts/test1) - chmod -$ 770 /mounts/test1 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + chmod -R 770 /mounts/test1 || echo "Failed setting permissions using chmod..." + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test1)]" echo "" echo "Automatically correcting ownership for /mounts/test1..." before=$(stat -c "%u:%g" /mounts/test1) - chown -$ -f :568 /mounts/test1 || echo "Failed setting ownership using chown..." + chown -R -f :568 /mounts/test1 || echo "Failed setting ownership using chown..." echo "Ownership before: [$before]" echo "Ownership after: [$(stat -c "%u:%g" /mounts/test1)]" @@ -263,7 +263,7 @@ tests: echo "Automatically correcting permissions for /mounts/test2..." before=$(stat -c "%a" /mounts/test2) chmod 770 /mounts/test2 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test2)]" echo "" echo "Automatically correcting ownership for /mounts/test2..." @@ -276,7 +276,7 @@ tests: echo "Automatically correcting permissions for /mounts/test3..." before=$(stat -c "%a" /mounts/test3) chmod 770 /mounts/test3 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test3)]" echo "" echo "Automatically correcting ownership for /mounts/test4..." @@ -288,26 +288,26 @@ tests: echo "" echo "Automatically correcting permissions for /mounts/test6..." before=$(stat -c "%a" /mounts/test6) - chmod -$ 770 /mounts/test6 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + chmod -R 770 /mounts/test6 || echo "Failed setting permissions using chmod..." + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test6)]" echo "" echo "Automatically correcting ownership for /mounts/test6..." before=$(stat -c "%u:%g" /mounts/test6) - chown -$ -f 1000:1000 /mounts/test6 || echo "Failed setting ownership using chown..." + chown -R -f 1000:1000 /mounts/test6 || echo "Failed setting ownership using chown..." echo "Ownership before: [$before]" echo "Ownership after: [$(stat -c "%u:%g" /mounts/test6)]" echo "" echo "Automatically correcting permissions for /mounts/test7..." before=$(stat -c "%a" /mounts/test7) - chmod -$ 770 /mounts/test7 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + chmod -R 770 /mounts/test7 || echo "Failed setting permissions using chmod..." + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test7)]" echo "" echo "Automatically correcting ownership for /mounts/test7..." before=$(stat -c "%u:%g" /mounts/test7) - chown -$ -f :568 /mounts/test7 || echo "Failed setting ownership using chown..." + chown -R -f :568 /mounts/test7 || echo "Failed setting ownership using chown..." echo "Ownership before: [$before]" echo "Ownership after: [$(stat -c "%u:%g" /mounts/test7)]" @@ -593,13 +593,13 @@ tests: echo "Automatically correcting ownership and permissions..." echo "Automatically correcting permissions for /mounts/test1..." before=$(stat -c "%a" /mounts/test1) - chmod -$ 770 /mounts/test1 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + chmod -R 770 /mounts/test1 || echo "Failed setting permissions using chmod..." + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test1)]" echo "" echo "Automatically correcting ownership for /mounts/test1..." before=$(stat -c "%u:%g" /mounts/test1) - /usr/sbin/nfs4xdr_winacl -a chown -G 568 -$ -c "/mounts/test1" -p "/mounts/test1" || echo "Failed setting ownership using winacl..." + /usr/sbin/nfs4xdr_winacl -a chown -G 568 -r -c "/mounts/test1" -p "/mounts/test1" || echo "Failed setting ownership using winacl..." echo "Ownership before: [$before]" echo "Ownership after: [$(stat -c "%u:%g" /mounts/test1)]" @@ -607,7 +607,7 @@ tests: echo "Automatically correcting permissions for /mounts/test2..." before=$(stat -c "%a" /mounts/test2) chmod 770 /mounts/test2 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test2)]" echo "" echo "Automatically correcting ownership for /mounts/test2..." @@ -620,7 +620,7 @@ tests: echo "Automatically correcting permissions for /mounts/test3..." before=$(stat -c "%a" /mounts/test3) chmod 770 /mounts/test3 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test3)]" echo "" echo "Automatically correcting ownership for /mounts/test4..." @@ -632,39 +632,39 @@ tests: echo "" echo "Automatically correcting permissions for /mounts/test6..." before=$(stat -c "%a" /mounts/test6) - chmod -$ 770 /mounts/test6 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + chmod -R 770 /mounts/test6 || echo "Failed setting permissions using chmod..." + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test6)]" echo "" echo "Automatically correcting ownership for /mounts/test6..." before=$(stat -c "%u:%g" /mounts/test6) - /usr/sbin/nfs4xdr_winacl -a chown -G 1000 -$ -c "/mounts/test6" -p "/mounts/test6" || echo "Failed setting ownership using winacl..." + /usr/sbin/nfs4xdr_winacl -a chown -G 1000 -r -c "/mounts/test6" -p "/mounts/test6" || echo "Failed setting ownership using winacl..." echo "Ownership before: [$before]" echo "Ownership after: [$(stat -c "%u:%g" /mounts/test6)]" echo "" echo "Automatically correcting permissions for /mounts/test7..." before=$(stat -c "%a" /mounts/test7) - chmod -$ 770 /mounts/test7 || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + chmod -R 770 /mounts/test7 || echo "Failed setting permissions using chmod..." + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test7)]" echo "" echo "Automatically correcting ownership for /mounts/test7..." before=$(stat -c "%u:%g" /mounts/test7) - /usr/sbin/nfs4xdr_winacl -a chown -G 568 -$ -c "/mounts/test7" -p "/mounts/test7" || echo "Failed setting ownership using winacl..." + /usr/sbin/nfs4xdr_winacl -a chown -G 568 -r -c "/mounts/test7" -p "/mounts/test7" || echo "Failed setting ownership using winacl..." 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]" + chmod -R 770 /mounts/test8 || echo "Failed setting permissions using chmod..." + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" /mounts/test8)]" echo "" echo "Automatically correcting ownership for /mounts/test8..." before=$(stat -c "%u:%g" /mounts/test8) - /usr/sbin/nfs4xdr_winacl -a chown -G 568 -$ -c "/mounts/test8" -p "/mounts/test8" || echo "Failed setting ownership using winacl..." + /usr/sbin/nfs4xdr_winacl -a chown -G 568 -r -c "/mounts/test8" -p "/mounts/test8" || echo "Failed setting ownership using winacl..." echo "Ownership before: [$before]" echo "Ownership after: [$(stat -c "%u:%g" /mounts/test8)]" diff --git a/library/common-test/tests/ingress/stop_test.yaml b/library/common-test/tests/ingress/stop_test.yaml index 23e9266f..642b26ea 100644 --- a/library/common-test/tests/ingress/stop_test.yaml +++ b/library/common-test/tests/ingress/stop_test.yaml @@ -97,8 +97,9 @@ tests: path: metadata.name value: test-release-name-common-test - documentIndex: *ingressDoc - isNull: + equal: path: spec.ingressClassName + value: null - documentIndex: *ingressDoc isSubset: path: metadata.annotations @@ -125,8 +126,9 @@ tests: path: metadata.name value: test-release-name-common-test - documentIndex: *ingressDoc - isNull: + equal: path: spec.ingressClassName + value: null - documentIndex: *ingressDoc isSubset: path: metadata.annotations diff --git a/library/common/Chart.yaml b/library/common/Chart.yaml index b3480ac8..b674476b 100644 --- a/library/common/Chart.yaml +++ b/library/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 17.2.1 +version: 17.2.2 diff --git a/library/common/templates/class/_ingress.tpl b/library/common/templates/class/_ingress.tpl index fca2f1e9..0e0841a3 100644 --- a/library/common/templates/class/_ingress.tpl +++ b/library/common/templates/class/_ingress.tpl @@ -54,9 +54,7 @@ metadata: {{- . | nindent 4 }} {{- end }} spec: - {{- if $ingressClassName }} - ingressClassName: {{ $ingressClassName }} - {{- end }} + ingressClassName: {{ $ingressClassName | default nil }} rules: {{- range $h := $objectData.hosts }} - host: {{ (tpl $h.host $rootCtx) | quote }} diff --git a/library/common/templates/lib/util/_autoperms.tpl b/library/common/templates/lib/util/_autoperms.tpl index 773b45c3..c77a7765 100644 --- a/library/common/templates/lib/util/_autoperms.tpl +++ b/library/common/templates/lib/util/_autoperms.tpl @@ -103,7 +103,7 @@ podSpec: {{- $r := "" -}} {{- if $vol.recursive -}} - {{- $r = "-$" -}} + {{- $r = "-R" -}} {{- end -}} {{/* Permissions */}} @@ -111,7 +111,7 @@ podSpec: echo "Automatically correcting permissions for {{ $mountPath }}..." before=$(stat -c "%a" {{ $mountPath }}) chmod {{ $r }} {{ $vol.chmod }} {{ $mountPath }} || echo "Failed setting permissions using chmod..." - echo "Permissions after: [$before]" + echo "Permissions before: [$before]" echo "Permissions after: [$(stat -c "%a" {{ $mountPath }})]" echo "" {{- end -}}