Skip to content

Commit

Permalink
fixed comunication between backend and database
Browse files Browse the repository at this point in the history
  • Loading branch information
onedeveloper committed Nov 1, 2023
1 parent 211bd20 commit 32a0afe
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 8 deletions.
2 changes: 1 addition & 1 deletion charts/ormuco-backend/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v2
name: ormuco-backend
description: A custom helm chart
version: 0.1.0
appVersion: "1.0"
appVersion: "1.2"
62 changes: 62 additions & 0 deletions charts/ormuco-backend/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ormuco-backend.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "ormuco-backend.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride }}
{{- if contains $name .Release.Name }}
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "ormuco-backend.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "ormuco-backend.labels" -}}
helm.sh/chart: {{ include "ormuco-backend.chart" . }}
{{ include "ormuco-backend.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "ormuco-backend.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ormuco-backend.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "ormuco-backend.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "ormuco-backend.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}
13 changes: 10 additions & 3 deletions charts/ormuco-backend/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ormuco-backend-deployment
name: {{ include "ormuco-backend.fullname" . }}
labels:
{{- include "ormuco-backend.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
app: ormuco-backend
{{- include "ormuco-backend.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
app: ormuco-backend
{{- include "ormuco-backend.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: ormuco-backend
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
ports:
- containerPort: {{ .Values.service.port }}
env:
- name: MYSQL_HOST
value: ormuco-database
- name: MYSQL_PORT
value: "3306"
6 changes: 3 additions & 3 deletions charts/ormuco-backend/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: ormuco-backend-service
name: {{ include "ormuco-backend.fullname" . }}
labels:
app: ormuco-backend
{{- include "ormuco-backend.labels" . | nindent 4 }}
spec:
selector:
app: ormuco-backend
{{- include "ormuco-backend.selectorLabels" . | nindent 4 }}
ports:
- protocol: TCP
port: {{ .Values.service.port }}
Expand Down
2 changes: 1 addition & 1 deletion charts/ormuco-backend/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ replicaCount: 1

image:
repository: ormuco-backend
tag: "1.0"
tag: "1.2"
pullPolicy: IfNotPresent

service:
Expand Down

0 comments on commit 32a0afe

Please sign in to comment.