From 990ab3c831d7b4796a152b85b2a0f0088562eae6 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Fri, 14 Jul 2023 04:50:24 -0400 Subject: [PATCH] fix(kopia) fix kopia basic auth. (#10407) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** fix backend for kopia basic auth. ⚒️ Fixes #10406 **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [X] 🪛 Bugfix - [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to not work as expected) - [X] 🔃 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/incubator/kopia/Chart.yaml | 2 +- charts/incubator/kopia/questions.yaml | 69 ++++++++++--------- charts/incubator/kopia/templates/_secret.tpl | 10 --- charts/incubator/kopia/templates/_secrets.tpl | 11 +++ charts/incubator/kopia/templates/common.yaml | 4 +- charts/incubator/kopia/values.yaml | 2 +- 6 files changed, 50 insertions(+), 48 deletions(-) delete mode 100644 charts/incubator/kopia/templates/_secret.tpl create mode 100644 charts/incubator/kopia/templates/_secrets.tpl diff --git a/charts/incubator/kopia/Chart.yaml b/charts/incubator/kopia/Chart.yaml index dcfa8416de2..d20dbe98510 100644 --- a/charts/incubator/kopia/Chart.yaml +++ b/charts/incubator/kopia/Chart.yaml @@ -19,7 +19,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/kopia - https://kopia.io/docs/installation/#docker-images - https://github.com/kopia/kopia -version: 6.0.5 +version: 6.0.6 annotations: truecharts.org/catagories: | - utility diff --git a/charts/incubator/kopia/questions.yaml b/charts/incubator/kopia/questions.yaml index c8031adc461..f33b0cf80a2 100644 --- a/charts/incubator/kopia/questions.yaml +++ b/charts/incubator/kopia/questions.yaml @@ -11,42 +11,43 @@ questions: # Include{podSpec} # Include{containerMain} - - variable: kopia - group: App Configuration - label: Kopia Configuration - schema: - additional_attrs: true - type: dict - attrs: - - variable: user - label: Repo User - schema: - type: string - default: "" - required: true - - variable: password - label: Repo Password - schema: - type: string - default: "" - private: true - required: true - - variable: server_username - label: Server UserName - schema: - type: string - default: "" - required: true - - variable: server_password - label: Server Password - schema: - type: string - default: "" - private: true - required: true - # Include{containerBasic} # Include{containerAdvanced} + + - variable: kopia + group: App Configuration + label: Kopia Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: user + label: Repo User + schema: + type: string + required: true + default: "" + - variable: password + label: Repo Password + schema: + type: string + private: true + required: true + default: "" + - variable: server_username + label: Server User + schema: + type: string + required: true + default: "" + - variable: server_password + label: Server Password + schema: + type: string + private: true + required: true + default: "" + # Include{containerConfig} # Include{podOptions} # Include{serviceRoot} diff --git a/charts/incubator/kopia/templates/_secret.tpl b/charts/incubator/kopia/templates/_secret.tpl deleted file mode 100644 index 2e6a40a02bb..00000000000 --- a/charts/incubator/kopia/templates/_secret.tpl +++ /dev/null @@ -1,10 +0,0 @@ -{{/* Define the secret */}} -{{- define "kopia.secret" -}} - -enabled: true -data: - USER: {{ .Values.kopia.user | default "user" }} - KOPIA_PASSWORD: {{ .Values.kopia.password | default "secret" }} - KOPIA_SERVER_USERNAME: {{ .Values.kopia.server_username | default "server_user" }} - KOPIA_SERVER_PASSWORD: {{ .Values.kopia.server_password | default "server_password" }} -{{- end }} diff --git a/charts/incubator/kopia/templates/_secrets.tpl b/charts/incubator/kopia/templates/_secrets.tpl new file mode 100644 index 00000000000..222ee7dfcfa --- /dev/null +++ b/charts/incubator/kopia/templates/_secrets.tpl @@ -0,0 +1,11 @@ +{{/* Define the secret */}} +{{- define "kopia.secrets" -}} +{{- $secretName := (printf "%s-kopia-secrets" (include "tc.v1.common.lib.chart.names.fullname" $)) -}} + +{{- $kopia := .Values.kopia -}} + +enabled: true +data: + USER: {{ $kopia.user | default "user" | quote }} + KOPIA_PASSWORD: {{ $kopia.password | default "secret" | quote }} +{{- end }} diff --git a/charts/incubator/kopia/templates/common.yaml b/charts/incubator/kopia/templates/common.yaml index 8a2de2a0ad8..17dd4a5c77a 100644 --- a/charts/incubator/kopia/templates/common.yaml +++ b/charts/incubator/kopia/templates/common.yaml @@ -2,9 +2,9 @@ {{- include "tc.v1.common.loader.init" . }} {{/* Render secrets for kopia */}} -{{- $secrets := include "kopia.secret" . | fromYaml -}} +{{- $secrets := include "kopia.secrets" . | fromYaml -}} {{- if $secrets -}} -{{- $_ := set .Values.secret "kopia-secret" $secrets -}} + {{- $_ := set .Values.secret "kopia-secrets" $secrets -}} {{- end -}} {{/* Render the templates */}} diff --git a/charts/incubator/kopia/values.yaml b/charts/incubator/kopia/values.yaml index 389f33aa907..dc55d697980 100644 --- a/charts/incubator/kopia/values.yaml +++ b/charts/incubator/kopia/values.yaml @@ -23,7 +23,7 @@ workload: main: envFrom: - secretRef: - name: "kopia-secret" + name: "kopia-secrets" args: - server - start