Skip to content

Commit

Permalink
Fixed orders helm chart
Browse files Browse the repository at this point in the history
  • Loading branch information
niallthomson committed Jan 3, 2024
1 parent 9e3f6db commit 17f2bcf
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 21 deletions.
14 changes: 7 additions & 7 deletions deploy/kubernetes/charts/orders/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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" . }}
Expand All @@ -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" }}
Expand All @@ -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 -}}

Expand Down
2 changes: 1 addition & 1 deletion deploy/kubernetes/charts/orders/templates/configmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 17f2bcf

Please sign in to comment.