From 4c0965e8b05e533957b8421f27353840640656ae Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Sat, 7 Oct 2023 11:48:10 -0400 Subject: [PATCH] fix(odoo) fix odoo db host (#13225) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** Fix host value and remove the excess quotes. ``` psycopg2.OperationalError: could not translate host name ""odoo-cnpg-main-rw"" to address: Name or service not known ``` ⚒️ 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:** @stavros-k does this chart need a initContainer to init the db at all? ```shell /usr/bin/odoo --config=/etc/odoo/odoo.conf --stop-after-init --without-demo=all --init=base ``` **✔️ 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._ --------- Signed-off-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> Co-authored-by: Stavros Kois <47820033+stavros-k@users.noreply.github.com> --- charts/incubator/odoo/Chart.yaml | 6 +- charts/incubator/odoo/questions.yaml | 4 +- .../incubator/odoo/templates/_configmap.tpl | 6 +- charts/incubator/odoo/values.yaml | 62 ++++++++++++++----- 4 files changed, 54 insertions(+), 24 deletions(-) diff --git a/charts/incubator/odoo/Chart.yaml b/charts/incubator/odoo/Chart.yaml index 76ae5ac989c..000ea673e40 100644 --- a/charts/incubator/odoo/Chart.yaml +++ b/charts/incubator/odoo/Chart.yaml @@ -3,7 +3,7 @@ appVersion: "16.0.0" dependencies: - name: common repository: https://library-charts.truecharts.org - version: 14.0.1 + version: 14.0.3 deprecated: false description: All-in-one business software. Beautiful. Easy-to-use. CRM, Accounting, PM, HR, Procurement, Point of Sale, MRP, Marketing, etc. home: https://truecharts.org/charts/incubator/odoo @@ -26,8 +26,8 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/odoo - https://github.com/odoo/docker type: application -version: 14.0.2 +version: 14.0.3 annotations: truecharts.org/catagories: | - - media + - productivity truecharts.org/SCALE-support: "true" diff --git a/charts/incubator/odoo/questions.yaml b/charts/incubator/odoo/questions.yaml index f2aeb460eb0..bc4f1464289 100644 --- a/charts/incubator/odoo/questions.yaml +++ b/charts/incubator/odoo/questions.yaml @@ -106,13 +106,13 @@ questions: description: "The UserID of the user running the application" schema: type: int - default: 568 + default: 101 - variable: runAsGroup label: "runAsGroup" description: "The groupID this App of the user running the application" schema: type: int - default: 568 + default: 101 # Include{securityContextContainer} # Include{securityContextAdvanced} # Include{securityContextPod} diff --git a/charts/incubator/odoo/templates/_configmap.tpl b/charts/incubator/odoo/templates/_configmap.tpl index 70998fc6f66..c024223fec4 100644 --- a/charts/incubator/odoo/templates/_configmap.tpl +++ b/charts/incubator/odoo/templates/_configmap.tpl @@ -6,13 +6,13 @@ {{- $smtp := .Values.odoo.smtp -}} {{- $mainPort := .Values.service.main.ports.main.port -}} -{{- $odooPath := .Values.persistence.odoo.mountPath -}} -{{- $addonsPath := .Values.persistence.addons.mountPath -}} +{{- $odooPath := .Values.persistence.odoo.targetSelector.main.main.mountPath -}} +{{- $addonsPath := .Values.persistence.addons.targetSelector.main.main.mountPath -}} {{- $pgdb := .Values.cnpg.main.database -}} {{- $pguser := .Values.cnpg.main.user -}} {{- $pgpassword := .Values.cnpg.main.creds.password | trimAll "\"" -}} -{{- $pghost := .Values.cnpg.main.creds.host -}} +{{- $pghost := .Values.cnpg.main.creds.host | trimAll "\"" -}} {{/* xmlrpc* keys are deprecated and http* keys are used in their place */}} {{- $reservedKeys := (list "data_dir" "addons_path" "http_enable" "http_interface" diff --git a/charts/incubator/odoo/values.yaml b/charts/incubator/odoo/values.yaml index 77ae1b530ae..aafe73df9d7 100644 --- a/charts/incubator/odoo/values.yaml +++ b/charts/incubator/odoo/values.yaml @@ -3,6 +3,12 @@ image: pullPolicy: IfNotPresent tag: v16.0.0@sha256:9a0e0d913dc6c4ed5904ae233dc2de7fa1a00f10eb5a66f21e1f695c62933a1d +securityContext: + container: + readOnlyRootFilesystem: false + runAsUser: 101 + runAsGroup: 101 + service: main: ports: @@ -15,6 +21,22 @@ odoo: workload: main: podSpec: + initContainers: + init-db: + type: install + enabled: true + imageSelector: "image" + env: + ODOO_RC: /etc/odoo/odoo.conf + command: + - /bin/bash + args: + - -c + - | + /usr/bin/odoo --config=/etc/odoo/odoo.conf \ + --stop-after-init \ + --without-demo=all \ + --init=base containers: main: probes: @@ -31,38 +53,46 @@ workload: type: http path: /web/health env: - USER: "{{ .Values.cnpg.main.user }}" - PORT: 5432 - PASSWORD: - secretKeyRef: - name: cnpg-main-user - key: password - HOST: - secretKeyRef: - name: cnpg-main-urls - key: host + ODOO_RC: /etc/odoo/odoo.conf persistence: odoo: enabled: true - mountPath: "/var/lib/odoo" + targetSelector: + main: + main: + mountPath: "/var/lib/odoo" + init-db: + mountPath: "/var/lib/odoo" addons: enabled: true - mountPath: "/mnt/extra-addons" + targetSelector: + main: + main: + mountPath: "/mnt/extra-addons" + init-db: + mountPath: "/mnt/extra-addons" odoo-config: enabled: true type: configmap objectName: odoo-config - mountPath: /etc/odoo/odoo.conf - subPath: odoo.conf - readOnly: true + targetSelector: + main: + main: + mountPath: /etc/odoo/odoo.conf + subPath: odoo.conf + readOnly: true + init-db: + mountPath: /etc/odoo/odoo.conf + subPath: odoo.conf + readOnly: true # Enabled postgres cnpg: main: enabled: true user: odoo - database: postgres + database: odoo portal: open: