From 2d2b2b05e81cf79c9906ca244cef7202af200d49 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Fri, 25 Aug 2023 04:27:47 -0400 Subject: [PATCH] fix(odoo) fix odoo and migrate to latest common. (#11730) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** update chart to v16 migrate to latest common fix DB integration. ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 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/odoo/Chart.yaml | 25 +++--- charts/incubator/odoo/questions.yaml | 88 +++++++++++++++++-- .../incubator/odoo/templates/_configmap.tpl | 58 ++++++++++++ charts/incubator/odoo/templates/common.yaml | 12 ++- charts/incubator/odoo/values.yaml | 57 +++++++----- 5 files changed, 198 insertions(+), 42 deletions(-) create mode 100644 charts/incubator/odoo/templates/_configmap.tpl diff --git a/charts/incubator/odoo/Chart.yaml b/charts/incubator/odoo/Chart.yaml index e7c3ae0e213..30e839bf1dc 100644 --- a/charts/incubator/odoo/Chart.yaml +++ b/charts/incubator/odoo/Chart.yaml @@ -1,10 +1,11 @@ apiVersion: v2 -appVersion: "15.0" -version: 13.0.1 -kubeVersion: ">=1.16.0-0" -name: odoo +appVersion: "16.0.0" +dependencies: + - name: common + repository: https://library-charts.truecharts.org + version: 14.0.1 +deprecated: false description: All-in-one business software. Beautiful. Easy-to-use. CRM, Accounting, PM, HR, Procurement, Point of Sale, MRP, Marketing, etc. -type: application home: https://truecharts.org/charts/incubator/odoo icon: https://truecharts.org/img/hotlink-ok/chart-icons/odoo.png keywords: @@ -15,17 +16,17 @@ keywords: - accounting - mrp - marketing -sources: - - https://github.com/truecharts/charts/tree/master/charts/incubator/odoo - - https://www.odoo.com/ -dependencies: - - name: common - repository: https://library-charts.truecharts.org - version: 14.0.1 +kubeVersion: ">=1.16.0-0" maintainers: - email: info@truecharts.org name: TrueCharts url: https://truecharts.org +name: odoo +sources: + - https://github.com/truecharts/charts/tree/master/charts/incubator/odoo + - https://github.com/odoo/docker +type: application +version: 14.0.0 annotations: truecharts.org/catagories: | - media diff --git a/charts/incubator/odoo/questions.yaml b/charts/incubator/odoo/questions.yaml index 6e93ab46016..575e4927fb3 100644 --- a/charts/incubator/odoo/questions.yaml +++ b/charts/incubator/odoo/questions.yaml @@ -11,10 +11,84 @@ questions: # Include{podSpec} # Include{containerMain} - # Include{containerBasic} # Include{containerAdvanced} + - variable: odoo + group: App Configuration + label: Odoo + schema: + additional_attrs: true + type: dict + attrs: + - variable: admin + label: Admin Credentials + schema: + additional_attrs: true + type: dict + attrs: + - variable: passwd + label: Admin Password + schema: + type: string + required: true + private: true + default: "" + - variable: db + label: DB Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: filter + label: DB Filter + schema: + type: string + required: true + default: "^mycompany.*$" + - variable: smtp + label: SMTP Configuration + schema: + additional_attrs: true + type: dict + attrs: + - variable: server + label: Server + schema: + type: string + default: "" + - variable: port + label: Port + schema: + type: int + default: 587 + - variable: user + label: User + schema: + type: string + default: "" + - variable: password + label: Password + schema: + type: string + private: true + default: "" + - variable: from + label: Email From + schema: + type: string + default: "" + - variable: ssl + label: SSL + schema: + type: string + default: "False" + enum: + - value: "False" + description: "False" + - value: "True" + description: "True" + # Include{containerConfig} # Include{podOptions} # Include{serviceRoot} @@ -44,7 +118,7 @@ questions: # Include{serviceSelectorLoadBalancer} # Include{serviceSelectorExtras} - variable: xmlrpcs - label: "xmlrpcs Service Port Configuration" + label: "XMLR PCS Service Port Configuration" schema: additional_attrs: true type: dict @@ -57,7 +131,7 @@ questions: default: 8071 required: true - variable: longpolling - label: "longpolling Service Port Configuration" + label: "Long Polling Service Port Configuration" schema: additional_attrs: true type: dict @@ -74,8 +148,8 @@ questions: # Include{serviceList} # Include{persistenceRoot} - variable: odoo - label: "App Storage" - description: "Stores the Application." + label: "App Config Storage" + description: "Stores the Application Configuration." schema: additional_attrs: true type: dict @@ -109,13 +183,13 @@ questions: description: "The UserID of the user running the application" schema: type: int - default: 568 + default: 0 - variable: runAsGroup label: "runAsGroup" description: "The groupID this App of the user running the application" schema: type: int - default: 568 + default: 0 # Include{securityContextContainer} # Include{securityContextAdvanced} # Include{securityContextPod} diff --git a/charts/incubator/odoo/templates/_configmap.tpl b/charts/incubator/odoo/templates/_configmap.tpl new file mode 100644 index 00000000000..19a05c659bd --- /dev/null +++ b/charts/incubator/odoo/templates/_configmap.tpl @@ -0,0 +1,58 @@ +{{/* Define the configmap */}} +{{- define "odoo.configmaps" -}} +{{- $fullname := (include "tc.v1.common.lib.chart.names.fullname" $) -}} + +{{- $admin := .Values.odoo.admin -}} +{{- $db := .Values.odoo.db -}} +{{- $smtp := .Values.odoo.smtp -}} + +{{- $pgdb := .Values.cnpg.main.database -}} +{{- $pguser := .Values.cnpg.main.user -}} +{{- $pgpassword := .Values.cnpg.main.creds.password | trimAll "\"" -}} +{{- $pghost := .Values.cnpg.main.creds.host | trimAll "\"" -}} + +odoo-config: + enabled: true + data: + odoo.conf: | + [options] + addons_path = {{ .Values.persistence.addons.mountPath }} + data_dir = {{ .Values.persistence.odoo.mountPath }} + admin_passwd = {{ $admin.passwd }} + longpolling_port = {{ .Values.service.odoo.ports.longpolling.port }} + xmlrpc = True + xmlrpc_interface = + xmlrpc_port = {{ .Values.service.main.ports.main.port }} + xmlrpcs = True + xmlrpcs_interface = + xmlrpcs_port = {{ .Values.service.odoo.ports.xmlrpcs.port }} + db_host = {{ $pghost }} + db_port = 5432 + db_user = {{ $pguser }} + db_password = {{ $pgpassword }} + dbfilter = {{ $db.dbfilter }} + csv_internal_sep = , + db_maxconn = 64 + debug_mode = False + limit_memory_hard = 2684354560 + limit_memory_soft = 2147483648 + limit_request = 8192 + limit_time_cpu = 60 + limit_time_real = 120 + list_db = True + log_db = False + log_handler = [':INFO'] + log_level = info + logfile = None + max_cron_threads = 2 + osv_memory_age_limit = 1.0 + osv_memory_count_limit = False + smtp_server = {{ $smtp.server }} + smtp_port = {{ $smtp.port }} + smtp_user = {{ $smtp.user }} + smtp_password = {{ $smtp.password }} + smtp_ssl = {{ $smtp.ssl }} + email_from = {{ $smtp.from }} + workers = 0 + +{{- end -}} diff --git a/charts/incubator/odoo/templates/common.yaml b/charts/incubator/odoo/templates/common.yaml index b51394e00a4..1fb1186233a 100644 --- a/charts/incubator/odoo/templates/common.yaml +++ b/charts/incubator/odoo/templates/common.yaml @@ -1 +1,11 @@ -{{ include "tc.v1.common.loader.all" . }} +{{/* Make sure all variables are set properly */}} +{{- include "tc.v1.common.loader.init" . -}} + +{{/* Render configmaps for all pods */}} +{{- $configmaps := include "odoo.configmaps" . | fromYaml -}} +{{- if $configmaps -}} + {{- $_ := mustMergeOverwrite .Values.configmap $configmaps -}} +{{- end -}} + +{{/* Render the templates */}} +{{- include "tc.v1.common.loader.apply" . -}} diff --git a/charts/incubator/odoo/values.yaml b/charts/incubator/odoo/values.yaml index 827e1504013..7afcc7b0cca 100644 --- a/charts/incubator/odoo/values.yaml +++ b/charts/incubator/odoo/values.yaml @@ -1,24 +1,43 @@ image: repository: tccr.io/truecharts/odoo pullPolicy: IfNotPresent - tag: v15.0@sha256:f7d2ab13cf5214ddfbc09d5322bd61ad064a877edbec1620579392838a0a44d7 + tag: v16.0.0@sha256:c1936984eeb8f504f5ebe74cf972319d6cd619ecbdf09249179ecdee2feeecf3 + +# test for root +securityContext: + container: + runAsNonRoot: false + readOnlyRootFilesystem: false + runAsUser: 0 + runAsGroup: 0 + service: main: ports: main: port: 8069 - targetPort: 8069 odoo: enabled: true ports: xmlrpcs: enabled: true port: 8071 - targetPort: 8071 longpolling: enabled: true port: 8072 - targetPort: 8072 +odoo: + admin: + passwd: admin + db: + filter: ^mycompany.*$ + smtp: + server: "" + port: 587 + user: "" + password: "" + ssl: "False" + from: "" + persistence: odoo: enabled: true @@ -26,30 +45,24 @@ persistence: addons: enabled: true mountPath: "/mnt/extra-addons" + odoo-config: + enabled: true + type: configmap + objectName: odoo-config + targetSelector: + main: + main: + mountPath: /etc/odoo/odoo.conf + subPath: odoo.conf + readOnly: true + # Enabled postgres cnpg: main: enabled: true - user: odoo database: postgres + portal: open: enabled: true - -workload: - main: - podSpec: - containers: - main: - env: - USER: "{{ .Values.cnpg.main.user }}" - PORT: 5432 - PASSWORD: - secretKeyRef: - name: cnpg-main-user - key: password - HOST: - secretKeyRef: - name: cnpg-main-urls - key: host