From faee9687c26081f0ce0580f4f452285edcb6f755 Mon Sep 17 00:00:00 2001 From: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Date: Mon, 26 Dec 2022 13:30:48 +0200 Subject: [PATCH] fix(prepare): rename auto-perm container and allow to run as root - fix manifest-updater (#307) 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:** - [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 - [ ] ⚠️ My changes generate no new warnings - [ ] 🧪 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._ --- charts/common/Chart.yaml | 2 +- charts/common/templates/lib/controller/_prepare.tpl | 5 ++--- .../common/templates/lib/util/_manifest-updater.tpl | 11 +++++------ 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/charts/common/Chart.yaml b/charts/common/Chart.yaml index 7e46c0e8..c81593e1 100644 --- a/charts/common/Chart.yaml +++ b/charts/common/Chart.yaml @@ -15,4 +15,4 @@ maintainers: name: common sources: null type: library -version: 11.1.0 +version: 11.1.1 diff --git a/charts/common/templates/lib/controller/_prepare.tpl b/charts/common/templates/lib/controller/_prepare.tpl index cbe18d6e..c78b0744 100644 --- a/charts/common/templates/lib/controller/_prepare.tpl +++ b/charts/common/templates/lib/controller/_prepare.tpl @@ -14,10 +14,11 @@ before chart installation. {{- end -}} {{- end }} {{- if or $autoperms ( and ( .Values.addons.vpn.configFile.enabled ) ( ne .Values.addons.vpn.type "disabled" ) ( ne .Values.addons.vpn.type "tailscale" ) ) }} -- name: db-wait +- name: auto-permissions image: {{ .Values.alpineImage.repository }}:{{ .Values.alpineImage.tag }} securityContext: runAsUser: 0 + runAsNonRoot: false resources: {{- with .Values.resources }} {{- tpl ( toYaml . ) $ | nindent 4 }} @@ -37,7 +38,6 @@ before chart installation. /usr/bin/nfs4xdr_winacl -a chown -G {{ $group }} -r -c {{ tpl $hpm.mountPath $ | squote }} -p {{ tpl $hpm.mountPath $ | squote }} || echo "Failed setting permissions..." {{- end }} EOF - volumeMounts: {{- range $name, $hpm := $hostPathMounts }} - name: {{ $name }} @@ -208,7 +208,6 @@ before chart installation. done fi; {{- end }} - EOF {{- end }} {{- end -}} diff --git a/charts/common/templates/lib/util/_manifest-updater.tpl b/charts/common/templates/lib/util/_manifest-updater.tpl index d1b2d943..d5fc9d70 100644 --- a/charts/common/templates/lib/util/_manifest-updater.tpl +++ b/charts/common/templates/lib/util/_manifest-updater.tpl @@ -1,6 +1,6 @@ {{- define "tc.common.lib.util.manifest.update" -}} {{- if .Values.manifests.enabled }} -{{- $fullName := include "tc.common.names.fullname" . -}} +{{- $fullName := include "tc.common.names.fullname" . }} --- apiVersion: batch/v1 kind: Job @@ -29,16 +29,15 @@ spec: - | /bin/sh <<'EOF' echo "installing manifests..." - kubectl apply --server-side --force-conflicts -k https://github.com/truecharts/manifests/{{ if .Values.manifests.staging }}staging{{ else }}manifests{{ end }} {{ if .Values.manifests.nonBlocking }} || echo "Manifest application failed..."{{ end }} + kubectl apply --server-side --force-conflicts -k https://github.com/truecharts/manifests/{{ if .Values.manifests.staging }}staging{{ else }}manifests{{ end }} {{ if .Values.manifests.nonBlocking }} || echo "Manifest application failed..."{{ end }} EOF volumeMounts: - - name: temp + - name: {{ $fullName }}-manifests-temp mountPath: /tmp restartPolicy: Never - {{- with (include "tc.common.controller.volumes" . | trim) }} volumes: - {{- nindent 8 . }} - {{- end }} + - name: {{ $fullName }}-manifests-temp + emptyDir: {} --- apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole