From e1172d630d01bed8e2c00457ba10c19ff373ee06 Mon Sep 17 00:00:00 2001 From: Xstar97TheNoob <9399967+xstar97@users.noreply.github.com> Date: Fri, 22 Sep 2023 18:45:08 -0400 Subject: [PATCH] fix(odoo) fix odoo configmap (#12691) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **Description** ⚒️ Fixes # **⚙️ Type of change** - [ ] ⚙️ Feature/App addition - [ ] 🪛 Bugfix - [X] ⚠️ 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 | 2 +- charts/incubator/odoo/questions.yaml | 120 ++++-------------- .../incubator/odoo/templates/_configmap.tpl | 68 +++++----- charts/incubator/odoo/values.yaml | 43 +++---- 4 files changed, 75 insertions(+), 158 deletions(-) diff --git a/charts/incubator/odoo/Chart.yaml b/charts/incubator/odoo/Chart.yaml index b6a12188547..76ae5ac989c 100644 --- a/charts/incubator/odoo/Chart.yaml +++ b/charts/incubator/odoo/Chart.yaml @@ -26,7 +26,7 @@ sources: - https://github.com/truecharts/charts/tree/master/charts/incubator/odoo - https://github.com/odoo/docker type: application -version: 14.0.1 +version: 14.0.2 annotations: truecharts.org/catagories: | - media diff --git a/charts/incubator/odoo/questions.yaml b/charts/incubator/odoo/questions.yaml index 08635c01cda..f2aeb460eb0 100644 --- a/charts/incubator/odoo/questions.yaml +++ b/charts/incubator/odoo/questions.yaml @@ -21,61 +21,31 @@ questions: additional_attrs: true type: dict attrs: - - variable: admin - label: Admin Credentials + - variable: additionalConf + label: Additional File Configuration Options + description: | + Configure additional file configuration options for Odoo.
+ Options are appended to the end of the configuration file.
+ After the predefined configuration options.
schema: - additional_attrs: true - type: dict - attrs: - - variable: passwd - label: Admin Password + type: list + default: [] + items: + - variable: conf + label: Configuration Option schema: - type: string - required: true - private: true - default: "" - - 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" + type: dict + attrs: + - variable: key + label: Key + schema: + type: string + required: true + - variable: value + label: Value + schema: + type: string + required: true # Include{containerConfig} # Include{podOptions} @@ -96,50 +66,6 @@ questions: type: int default: 8069 required: true - - variable: xmlrpcs - label: "XMLR PCS Service" - description: "XMLR PCS Service" - schema: - additional_attrs: true - type: dict - attrs: -# Include{serviceSelectorLoadBalancer} -# Include{serviceSelectorExtras} - - variable: xmlrpcs - label: "XMLR PCS Service Port Configuration" - schema: - additional_attrs: true - type: dict - attrs: - - variable: port - label: "Port" - description: "This port exposes the container port on the service" - schema: - type: int - default: 8071 - required: true - - variable: longpolling - label: "Long Polling Service" - description: "Long Polling Service" - schema: - additional_attrs: true - type: dict - attrs: -# Include{serviceSelectorLoadBalancer} -# Include{serviceSelectorExtras} - - variable: longpolling - label: "Long Polling Service Port Configuration" - schema: - additional_attrs: true - type: dict - attrs: - - variable: port - label: "Port" - description: "This port exposes the container port on the service" - schema: - type: int - default: 8072 - required: true # Include{serviceExpertRoot} # Include{serviceExpert} # Include{serviceList} diff --git a/charts/incubator/odoo/templates/_configmap.tpl b/charts/incubator/odoo/templates/_configmap.tpl index 2bbf1e1a252..70998fc6f66 100644 --- a/charts/incubator/odoo/templates/_configmap.tpl +++ b/charts/incubator/odoo/templates/_configmap.tpl @@ -5,48 +5,48 @@ {{- $admin := .Values.odoo.admin -}} {{- $smtp := .Values.odoo.smtp -}} +{{- $mainPort := .Values.service.main.ports.main.port -}} +{{- $odooPath := .Values.persistence.odoo.mountPath -}} +{{- $addonsPath := .Values.persistence.addons.mountPath -}} + {{- $pgdb := .Values.cnpg.main.database -}} {{- $pguser := .Values.cnpg.main.user -}} {{- $pgpassword := .Values.cnpg.main.creds.password | trimAll "\"" -}} {{- $pghost := .Values.cnpg.main.creds.host -}} +{{/* xmlrpc* keys are deprecated and http* keys are used in their place */}} + {{- $reservedKeys := (list "data_dir" "addons_path" "http_enable" "http_interface" + "http_port" "xmlrpc" "xmlrpc_port" "xmlrpc_interface" + "db_port" "db_host" "db_name" "db_user" "db_sslmode" + "db_password") -}} +{{- $userKeys := list -}} + 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.longpolling.ports.longpolling.port }} - xmlrpc = True - xmlrpc_interface = - xmlrpc_port = {{ .Values.service.main.ports.main.port }} - xmlrpcs = True - xmlrpcs_interface = - xmlrpcs_port = {{ .Values.service.xmlrpcs.ports.xmlrpcs.port }} - 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 - + ; Paths + data_dir = {{ $odooPath }} + addons_path = {{ $addonsPath }} + ; Network Details + http_enable = True + http_port = {{ $mainPort }} + ; Database Details + db_port = 5432 + db_host = {{ $pghost }} + db_name = {{ $pgdb }} + db_user = {{ $pguser }} + db_sslmode = disable + db_password = {{ $pgpassword }} + {{- range $opt := .Values.odoo.additionalConf -}} + {{- if (mustHas $opt.key $reservedKeys) -}} + {{- fail (printf "Odoo - Key [%v] is not allowed to be modified") -}} + {{- end -}} + {{- $userKeys = mustAppend $userKeys $opt.key -}} + {{- printf "%s = %s" $opt.key $opt.value | nindent 8 -}} + {{- end -}} +{{- if not (deepEqual $userKeys (uniq $userKeys)) -}} + {{- fail (printf "Odoo - Additional configuration keys must be unique, but got [%v]" (join ", " $userKeys)) -}} +{{- end -}} {{- end -}} diff --git a/charts/incubator/odoo/values.yaml b/charts/incubator/odoo/values.yaml index e6008c6c456..77ae1b530ae 100644 --- a/charts/incubator/odoo/values.yaml +++ b/charts/incubator/odoo/values.yaml @@ -8,35 +8,28 @@ service: ports: main: port: 8069 - xmlrpcs: - enabled: true - ports: - xmlrpcs: - enabled: true - port: 8071 - longpolling: - enabled: true - ports: - longpolling: - enabled: true - port: 8072 odoo: - admin: - passwd: admin - smtp: - server: "" - port: 587 - user: "" - password: "" - ssl: "False" - from: "" + additionalConf: [] workload: main: podSpec: containers: main: + probes: + liveness: + enabled: true + type: http + path: /web/health + readiness: + enabled: true + type: http + path: /web/health + startup: + enabled: true + type: http + path: /web/health env: USER: "{{ .Values.cnpg.main.user }}" PORT: 5432 @@ -60,11 +53,9 @@ persistence: enabled: true type: configmap objectName: odoo-config - targetSelector: - main: - main: - mountPath: /etc/odoo/odoo.conf - subPath: odoo.conf + mountPath: /etc/odoo/odoo.conf + subPath: odoo.conf + readOnly: true # Enabled postgres cnpg: