From 76fbb3ed0f63e44d35437bb38447f5607700e56d Mon Sep 17 00:00:00 2001 From: Sergio Almendros Diaz <97443651+sergioalmendrosdiaz@users.noreply.github.com> Date: Wed, 2 Aug 2023 12:36:08 +0200 Subject: [PATCH] fix(helm): fix postgres fields (#36) new version of postgres doesn't have the same fields. --- helm/thingsboard/templates/initializedb-job.yaml | 2 +- helm/thingsboard/templates/js-executor.yaml | 2 +- helm/thingsboard/templates/node-db-configmap.yaml | 2 +- helm/thingsboard/templates/node.yaml | 4 ++-- helm/thingsboard/values.yaml | 4 +--- 5 files changed, 6 insertions(+), 8 deletions(-) diff --git a/helm/thingsboard/templates/initializedb-job.yaml b/helm/thingsboard/templates/initializedb-job.yaml index 75530352..b9002005 100644 --- a/helm/thingsboard/templates/initializedb-job.yaml +++ b/helm/thingsboard/templates/initializedb-job.yaml @@ -32,7 +32,7 @@ spec: - name: check-postgres-db-ready image: postgres:{{ index .Values "postgresql-ha" "postgresqlImage" "tag" }} command: ['sh', '-c', - 'until pg_isready -h {{ include "thingsboard.pgpoolservicename" . }} -p {{ index .Values "postgresql-ha" "pgpool" "containerPort" }} -t {{ .Values.postgresInitDB.job.check.timeout }}; + 'until pg_isready -h {{ include "thingsboard.pgpoolservicename" . }} -p {{ index .Values "postgresql-ha" "pgpool" "containerPorts" "postgresql" }} -t {{ .Values.postgresInitDB.job.check.timeout }}; do echo waiting for database; sleep 2; done;'] {{- end }} containers: diff --git a/helm/thingsboard/templates/js-executor.yaml b/helm/thingsboard/templates/js-executor.yaml index da791970..0e751701 100644 --- a/helm/thingsboard/templates/js-executor.yaml +++ b/helm/thingsboard/templates/js-executor.yaml @@ -52,7 +52,7 @@ spec: - name: check-db-ready image: postgres:{{ index .Values "postgresql-ha" "postgresqlImage" "tag" }} command: ['sh', '-c', - 'until pg_isready -h {{ include "thingsboard.pgpoolservicename" . }} -p {{ index .Values "postgresql-ha" "pgpool" "containerPort" }} -t {{ .Values.postgresInitDB.job.check.timeout }}; + 'until pg_isready -h {{ include "thingsboard.pgpoolservicename" . }} -p {{ index .Values "postgresql-ha" "pgpool" "containerPorts" "postgresql" }} -t {{ .Values.postgresInitDB.job.check.timeout }}; do echo waiting for database; sleep 2; done;'] {{- end }} containers: diff --git a/helm/thingsboard/templates/node-db-configmap.yaml b/helm/thingsboard/templates/node-db-configmap.yaml index fe7149c5..a85e6330 100644 --- a/helm/thingsboard/templates/node-db-configmap.yaml +++ b/helm/thingsboard/templates/node-db-configmap.yaml @@ -40,7 +40,7 @@ data: SPRING_JPA_DATABASE_PLATFORM: org.hibernate.dialect.PostgreSQLDialect SPRING_DRIVER_CLASS_NAME: org.postgresql.Driver {{ if index .Values "postgresql-ha" "enabled" }} - SPRING_DATASOURCE_URL: jdbc:postgresql://{{ include "thingsboard.pgpoolservicename" . }}:{{ index .Values "postgresql-ha" "pgpool" "containerPort" }}/{{ index .Values "postgresql-ha" "postgresql" "database" }} + SPRING_DATASOURCE_URL: jdbc:postgresql://{{ include "thingsboard.pgpoolservicename" . }}:{{ index .Values "postgresql-ha" "pgpool" "containerPorts" "postgresql" }}/{{ index .Values "postgresql-ha" "postgresql" "database" }} SPRING_DATASOURCE_USERNAME: {{ index .Values "postgresql-ha" "postgresql" "username" }} SPRING_DATASOURCE_PASSWORD: {{ index .Values "postgresql-ha" "postgresql" "password" }} {{ else }} diff --git a/helm/thingsboard/templates/node.yaml b/helm/thingsboard/templates/node.yaml index 24e1d225..a2d283ae 100644 --- a/helm/thingsboard/templates/node.yaml +++ b/helm/thingsboard/templates/node.yaml @@ -52,12 +52,12 @@ spec: - name: check-db-ready image: postgres:{{ index .Values "postgresql-ha" "postgresqlImage" "tag" }} command: ['sh', '-c', - 'until pg_isready -h {{ include "thingsboard.pgpoolservicename" . }} -p {{ index .Values "postgresql-ha" "pgpool" "containerPort" }} -t {{ .Values.postgresInitDB.job.check.timeout }}; + 'until pg_isready -h {{ include "thingsboard.pgpoolservicename" . }} -p {{ index .Values "postgresql-ha" "pgpool" "containerPorts" "postgresql" }} -t {{ .Values.postgresInitDB.job.check.timeout }}; do echo waiting for database; sleep 2; done;'] - name: check-db-queue-ready image: postgres:{{ index .Values "postgresql-ha" "postgresqlImage" "tag" }} command: ['sh', '-c', - 'export PGPASSWORD=''{{ index .Values "postgresql-ha" "postgresql" "password" }}'' && export row_count=0 && until [ $row_count -ge 3 ]; do sleep 1; row_count=$(psql -h {{ include "thingsboard.pgpoolservicename" . }} -p {{ index .Values "postgresql-ha" "pgpool" "containerPort" }} -U {{ index .Values "postgresql-ha" "postgresql" "username" }} -d {{ index .Values "postgresql-ha" "postgresql" "database" }} --set=on_error_stop=1 -t -c "SELECT count(*) FROM queue;"); done;'] + 'export PGPASSWORD=''{{ index .Values "postgresql-ha" "postgresql" "password" }}'' && export row_count=0 && until [ $row_count -ge 3 ]; do sleep 1; row_count=$(psql -h {{ include "thingsboard.pgpoolservicename" . }} -p {{ index .Values "postgresql-ha" "pgpool" "containerPorts" "postgresql" }} -U {{ index .Values "postgresql-ha" "postgresql" "username" }} -d {{ index .Values "postgresql-ha" "postgresql" "database" }} --set=on_error_stop=1 -t -c "SELECT count(*) FROM queue;"); done;'] {{- end }} containers: - name: {{ .Chart.Name }} diff --git a/helm/thingsboard/values.yaml b/helm/thingsboard/values.yaml index 86d059ed..8d45737c 100644 --- a/helm/thingsboard/values.yaml +++ b/helm/thingsboard/values.yaml @@ -347,13 +347,11 @@ postgresql-ha: password: setplease repmgrPassword: setplease postgresqlImage: - tag: 12 + tag: 15.3 pgpool: adminPassword: setplease replicaCount: 1 useLoadBalancing: false - pgpoolImage: - tag: 4.3.3 redis: # Set architecture to either standalone or replication