diff --git a/deploy/kubernetes/charts/orders/templates/_helpers.tpl b/deploy/kubernetes/charts/orders/templates/_helpers.tpl index a2287bdb8..4089356f7 100644 --- a/deploy/kubernetes/charts/orders/templates/_helpers.tpl +++ b/deploy/kubernetes/charts/orders/templates/_helpers.tpl @@ -87,11 +87,11 @@ Create the name of the config map to use {{- end -}} {{- define "orders.postgresql.fullname" -}} -{{- include "orders.fullname" . }}-mysql +{{- include "orders.fullname" . }}-postgresql {{- end -}} {{/* -Common labels for mysql +Common labels for postgresql */}} {{- define "orders.postgresql.labels" -}} helm.sh/chart: {{ include "orders.chart" . }} @@ -103,12 +103,12 @@ app.kubernetes.io/managed-by: {{ .Release.Service }} {{- end }} {{/* -Selector labels for mysql +Selector labels for postgresql */}} {{- define "orders.postgresql.selectorLabels" -}} app.kubernetes.io/name: {{ include "orders.fullname" . }} app.kubernetes.io/instance: {{ .Release.Name }} -app.kubernetes.io/component: mysql +app.kubernetes.io/component: postgresql {{- end }} {{- define "getOrGeneratePass" }} @@ -132,10 +132,10 @@ app.kubernetes.io/component: mysql {{- end -}} {{- define "orders.postgresql.endpoint" -}} -{{- if not (empty .Values.postgresql.endpoint) -}} - {{- .Values.postgresql.endpoint -}} +{{- if not (empty .Values.postgresql.endpoint.host) -}} +jdbc:postgresql://{{- .Values.postgresql.endpoint.host -}}:{{- .Values.postgresql.port -}}/{{ .Values.postgresql.database }} {{- else -}} -jdbc:mariadb://{{ include "orders.postgresql.fullname" . }}:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.database }} +jdbc:postgresql://{{ include "orders.postgresql.fullname" . }}:{{ .Values.postgresql.service.port }}/{{ .Values.postgresql.database }} {{- end -}} {{- end -}} diff --git a/deploy/kubernetes/charts/orders/templates/configmap.yml b/deploy/kubernetes/charts/orders/templates/configmap.yml index 391badf22..ab3f8f0f6 100644 --- a/deploy/kubernetes/charts/orders/templates/configmap.yml +++ b/deploy/kubernetes/charts/orders/templates/configmap.yml @@ -5,6 +5,6 @@ metadata: name: {{ include "orders.configMapName" . }} data: SPRING_PROFILES_ACTIVE: rabbitmq - SPRING_DATASOURCE_URL: jdbc:postgresql://{{ .Values.postgresql.endpoint.host }}:{{ .Values.postgresql.endpoint.port }}/{{ .Values.postgresql.database }} + SPRING_DATASOURCE_URL: {{ include "orders.postgresql.endpoint" . }} SPRING_RABBITMQ_ADDRESSES: {{ include "orders.rabbitmq.addresses" . }} {{- end }} diff --git a/deploy/kubernetes/charts/orders/templates/postgresql-service.yaml b/deploy/kubernetes/charts/orders/templates/postgresql-service.yaml index 699339fb2..fd9c780b1 100644 --- a/deploy/kubernetes/charts/orders/templates/postgresql-service.yaml +++ b/deploy/kubernetes/charts/orders/templates/postgresql-service.yaml @@ -9,9 +9,9 @@ spec: type: {{ .Values.postgresql.service.type }} ports: - port: {{ .Values.postgresql.service.port }} - targetPort: mysql + targetPort: postgresql protocol: TCP - name: mysql + name: postgresql selector: {{- include "orders.postgresql.selectorLabels" . | nindent 4 }} {{- end }} \ No newline at end of file diff --git a/deploy/kubernetes/charts/orders/templates/postgresql-statefulset.yaml b/deploy/kubernetes/charts/orders/templates/postgresql-statefulset.yaml index 479a15949..9f93a2f02 100644 --- a/deploy/kubernetes/charts/orders/templates/postgresql-statefulset.yaml +++ b/deploy/kubernetes/charts/orders/templates/postgresql-statefulset.yaml @@ -25,32 +25,30 @@ spec: {{- toYaml . | nindent 8 }} {{- end }} containers: - - name: mysql + - name: postgresql image: "{{ .Values.postgresql.image.repository }}:{{ .Values.postgresql.image.tag }}" imagePullPolicy: {{ .Values.postgresql.image.pullPolicy }} env: - - name: MYSQL_ROOT_PASSWORD - value: my-secret-pw - - name: MYSQL_DATABASE + - name: POSTGRES_DB value: {{ .Values.postgresql.database }} - - name: MYSQL_USER + - name: POSTGRES_USER valueFrom: secretKeyRef: name: {{ .Values.postgresql.secret.name }} key: username - - name: MYSQL_PASSWORD + - name: POSTGRES_PASSWORD valueFrom: secretKeyRef: name: {{ .Values.postgresql.secret.name }} key: password - args: - - "--ignore-db-dir=lost+found" + - name: PGDATA + value: /data/pgdata volumeMounts: - name: data - mountPath: /var/lib/mysql + mountPath: /data ports: - - name: mysql - containerPort: 3306 + - name: postgresql + containerPort: 5432 protocol: TCP {{- with .Values.postgresql.nodeSelector }} nodeSelector: