Skip to content
Snippets Groups Projects
Commit 5ad43ba5 authored by Etienne LANGLOIS's avatar Etienne LANGLOIS
Browse files

feat: front, back, db operationels

parent fe348897
No related branches found
No related tags found
No related merge requests found
Showing
with 218 additions and 4 deletions
{{- if .Values.api.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.name}}-api
data:
dbEndpoint: {{ .Values.name}}-db:5432
{{- end }}
\ No newline at end of file
{{- if .Values.api.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.name }}-api
labels:
app: api
spec:
replicas: {{ .Values.api.replicaCount }}
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
containers:
- name: api
image: {{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}
resources:
limits:
memory: "256Mi"
cpu: "2"
requests:
memory: "192Mi"
cpu: "100m"
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /actuator/health/liveness
port: 8080
initialDelaySeconds: 10
periodSeconds: 15
readinessProbe:
httpGet:
path: /actuator/health/readiness
port: 8080
initialDelaySeconds: 10
periodSeconds: 15
env:
- name: DB_ENDPOINT
valueFrom:
configMapKeyRef:
key: dbEndpoint
name: {{ .Values.name }}-api
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: pg-credentials
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
key: username
name: pg-credentials
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
key: dataBaseName
name: {{ .Values.name }}-db
imagePullSecrets:
- name: takima-school-registry
{{- end }}
\ No newline at end of file
{{- if .Values.api.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ .Values.name }}-api
labels:
name: api
spec:
rules:
- host: {{ .Values.api.ingress.host }}
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: {{ .Values.name }}-api
port:
number: 80
{{- if .Values.api.ingress.tlsEnabled }}
tls:
- hosts:
- {{ .Values.api.ingress.host }}
secretName: app-wildcard
{{- end }}
{{- end }}
\ No newline at end of file
{{- if .Values.api.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.name }}-api
spec:
selector:
app: api
ports:
- protocol: TCP
port: 80
targetPort: 8080
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.name }}-db
data:
dataBaseName: "cdb-db"
db_path: "/var/lib/postgresql/data/pgdata"
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.name }}-db
type: Opaque
data:
username: 'dXNlcg=='
password: 'cGFzc3dvcmQ='
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.name }}-db
labels:
app: db
spec:
replicas: {{ .Values.api.replicaCount}}
selector:
matchLabels:
app: db
template:
metadata:
labels:
app: db
spec:
volumes:
- name: pg-data
persistentVolumeClaim:
claimName: pg-db
containers:
- name: cdb-db
image: {{ .Values.db.image.repository }}:{{ .Values.db.image.tag }}
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: pg-data
resources:
limits:
memory: "256Mi"
cpu: "1"
requests:
memory: "192Mi"
cpu: "100m"
ports:
- containerPort: 5432
env:
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
key: password
name: {{ .Values.name}}-db
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
key: username
name: {{ .Values.name}}-db
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
key: dataBaseName
name: {{ .Values.name}}-db
- name: PGDATA
valueFrom:
configMapKeyRef:
name: {{ .Values.name}}-db # Nom du configmap
key: db_path # nom de la clef dans le configMap contenant path ou installer la db dans le volume persistant
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.name}}-db
spec:
selector:
app: db
ports:
- protocol: TCP
port: 5432
targetPort: 5432
{{- end }}
\ No newline at end of file
......@@ -5,9 +5,14 @@
name: cdb
api:
enabled: true
ingress:
tlsEnabled: false
host: api.to-replace.takima.school
tlsEnabled: true
host: api.elanglois.takima.school
replicaCount: 1
image:
repository: registry.gitlab.com/takima-school/images/cdb/api
tag: latest
front:
enabled: true
......@@ -16,5 +21,12 @@ front:
tag: latest
replicaCount: 1
ingress:
tlsEnabled: false
host: www.to-replace.takima.school
\ No newline at end of file
tlsEnabled: true
host: www.elanglois.takima.school
db:
enabled: true
replicaCount: 1
image:
tag: latest
repository: registry.takima.io/school/proxy/postgres
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment