From d623fea946199b35fd3bcc170699b2eee6192da9 Mon Sep 17 00:00:00 2001 From: Mint Bot Date: Tue, 5 Aug 2025 09:21:07 +0200 Subject: [PATCH] fix(deployment): update postgres host and add support for custom namespace in odoo deployment --- odoo/templates/odoo-deploy.yaml | 4 ++-- task | 21 ++++++++++++++------- values.loc.yaml.template | 7 +++++++ values.yaml.template | 3 --- 4 files changed, 23 insertions(+), 12 deletions(-) create mode 100644 values.loc.yaml.template delete mode 100644 values.yaml.template diff --git a/odoo/templates/odoo-deploy.yaml b/odoo/templates/odoo-deploy.yaml index c4ed21f..9875bc6 100644 --- a/odoo/templates/odoo-deploy.yaml +++ b/odoo/templates/odoo-deploy.yaml @@ -37,7 +37,7 @@ spec: name: {{ .Values.postgresql.auth.existingSecret }} key: {{ .Values.postgresql.auth.secretKeys.userPasswordKey }} - name: PGHOST - value: postgresql.{{ .Release.Namespace }}.svc.cluster.local + value: {{ .Release.Namespace }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local - name: PGUSER value: {{ .Values.postgresql.auth.username }} {{- end }} @@ -103,7 +103,7 @@ spec: name: {{ .Values.postgresql.auth.existingSecret }} key: {{ .Values.postgresql.auth.secretKeys.userPasswordKey }} - name: PGHOST - value: postgresql.{{ .Release.Namespace }}.svc.cluster.local + value: {{ .Release.Namespace }}-postgresql.{{ .Release.Namespace }}.svc.cluster.local - name: PGUSER value: {{ .Values.postgresql.auth.username }} {{- end }} diff --git a/task b/task index 2b2f064..dee8299 100755 --- a/task +++ b/task @@ -88,7 +88,9 @@ CONTAINER_CONFIG="$HOME/.docker/$CONTAINER_REGISTRY" # Dynamic vars PASS_ENTRY=$(echo "env/${PWD##*/}" | tr '[:upper:]' '[:lower:]') -CURRENT_CONTEXT=$(kubectl config current-context || "") +if command -v kubectl &> /dev/null; then + CURRENT_CONTEXT=$(kubectl config current-context || "") +fi # Import commands @@ -546,20 +548,25 @@ function uninstall-cluster-issuer() { function get-secrets() { if [ "$1" = "odoo" ]; then - echo "Get the postgres user:" + echo "odoo-postgres/user:" kubectl get secret odoo-postgres -o jsonpath="{.data.user}" | base64 --decode && echo - - echo "Get the postgres user password:" + echo "odoo-postgres/password:" kubectl get secret odoo-postgres -o jsonpath="{.data.password}" | base64 --decode && echo fi if [ "$1" = "postgres" ]; then - echo "Get the postgres user:" + echo "postgres/user:" kubectl get secret postgres -o jsonpath="{.data.user}" | base64 --decode && echo - - echo "Get the postgres password:" + echo "postgres/password:" kubectl get secret postgres -o jsonpath="{.data.password}" | base64 --decode && echo fi + + if [ "$1" = "postgresql" ]; then + echo "odoo-postgresql/password:" + kubectl get secret odoo-postgresql -o jsonpath="{.data.password}" | base64 --decode && echo + echo "odoo-postgresql/postgres-password:" + kubectl get secret odoo-postgresql -o jsonpath="{.data.postgres-password}" | base64 --decode && echo + fi } function exec-bash() { diff --git a/values.loc.yaml.template b/values.loc.yaml.template new file mode 100644 index 0000000..e41743a --- /dev/null +++ b/values.loc.yaml.template @@ -0,0 +1,7 @@ +imagePullPolicy: Never +# db: odoo +# user: odoo +postgres: + enabled: false +postgresql: + enabled: true diff --git a/values.yaml.template b/values.yaml.template deleted file mode 100644 index 01b58b7..0000000 --- a/values.yaml.template +++ /dev/null @@ -1,3 +0,0 @@ -imagePullPolicy: Never -# db: odoo -# user: odoo