Skip to content
Snippets Groups Projects
Commit 636034d4 authored by Vincent DU's avatar Vincent DU
Browse files

Init Helm resources step 2

parents
Branches
No related tags found
No related merge requests found
apiVersion: v2
name: cdb
description: All applications in the cdb ecosystem
# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application
# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0
# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
appVersion: snapshot
maintainers:
- name: takiformation
email: takiformation@takima.school
{{- if .Values.pg.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.api.name }}-config
data:
db-endpoint: "{{ .Values.pg.service.name }}.{{ .Values.namespace }}:{{ .Values.pg.service.port }}"
{{- end }}
{{- if .Values.api.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.api.name }}-deployment
labels:
app: api
spec:
replicas: {{ .Values.api.replicaCount }}
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
securityContext:
runAsUser: 1001
runAsGroup: 1001
containers:
- name: api
image: {{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}
ports:
- containerPort: 8080
# readinessProbe:
# httpGet:
# port: 8080
# path: /actuator/health/readiness
# initialDelaySeconds: 5
# periodSeconds: 5
# livenessProbe:
# httpGet:
# port: 8080
# path: /actuator/health/liveness
# initialDelaySeconds: 300
# periodSeconds: 300
# startupProbe:
# httpGet:
# path: /actuator/health/startup
# port: 8080
# failureThreshold: 30
# periodSeconds: 10
env:
- name: DB_ENDPOINT
valueFrom:
configMapKeyRef:
name: {{ .Values.api.name }}-config
key: db-endpoint
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: {{ .Values.pg.name }}-config
key: db-name
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.pg.name }}-credentials
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.pg.name }}-credentials
key: password
imagePullSecrets:
- name: takima-school-registry
{{- end }}
\ No newline at end of file
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: {{ .Values.api.name }}-ingress
spec:
rules:
- host: {{ .Values.api.ingress.host }}
http:
paths:
- backend:
service:
name: {{ .Values.api.name }}-service
port:
number: 80
path: /
pathType: Prefix
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.api.name }}-service
spec:
selector:
app: api
ports:
- protocol: TCP
port: 80
targetPort: 8080
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.pg.name }}-config
data:
db-name: "{{ .Values.pg.name }}-db"
db_path: "{{ .Values.pg.path }}/pgdata"
apiVersion: v1
kind: Secret
metadata:
name: {{ .Values.pg.name }}-credentials
type: Opaque
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.pg.name }}-deployment
labels:
app: {{ .Values.pg.name }}
spec:
replicas: 3
selector:
matchLabels:
app: {{ .Values.pg.name }}
template:
metadata:
labels:
app: {{ .Values.pg.name }}
spec:
containers:
- name: {{ .Values.pg.name }}
image: {{ .Values.pg.image.repository }}:{{ .Values.pg.image.tag }}
ports:
- containerPort: {{ .Values.pg.service.port }}
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "128Mi"
cpu: "500m"
env:
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: {{ .Values.pg.name }}-config
key: db-name
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ .Values.pg.name }}-credentials
key: username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ .Values.pg.name }}-credentials
key: password
- name: PGDATA
valueFrom:
configMapKeyRef:
name: {{ .Values.pg.name }}-config # Nom du configmap
key: {{ .Values.pg.name }}_path # nom de la clef dans le configMap contenant path ou installer la db dans le volume persistant
volumeMounts:
- mountPath: {{ .Values.pg.path }}
name: {{ .Values.pg.name }}-data
imagePullSecrets:
- name: takima-school-registry
volumes:
- name: {{ .Values.pg.name }}-data
persistentVolumeClaim:
claimName: {{ .Values.pg.name }}-db
\ No newline at end of file
apiVersion: v1
kind: Service
metadata:
name: pg-service
spec:
type: ClusterIP
selector:
app: pg
ports:
- protocol: TCP
port: {{ .Values.pg.service.port }}
targetPort: {{ .Values.pg.service.targetPort }}
{{- if .Values.front.enabled }}
{{- $apiUrl := "" }}
{{- if .Values.api.ingress.tlsEnabled }}
{{- $apiUrl = printf "https://%s" .Values.api.ingress.host | quote }}
{{- else }}
{{- $apiUrl = printf "http://%s" .Values.api.ingress.host | quote }}
{{- end }}
apiVersion: v1
kind: ConfigMap
metadata:
name: {{ .Values.name }}-front
data:
API_URL: {{ $apiUrl }}
{{- end }}
\ No newline at end of file
{{- if .Values.front.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ .Values.name }}-front
labels:
app: front
spec:
replicas: {{ .Values.front.replicaCount }}
selector:
matchLabels:
app: front
template:
metadata:
labels:
app: front
spec:
imagePullSecrets:
- name: takima-school-registry
securityContext:
runAsUser: 101
runAsGroup: 101
containers:
- name: front
image: {{ .Values.front.image.repository }}:{{ .Values.front.image.tag }}
imagePullPolicy: Always
ports:
- containerPort: 8080
resources:
requests:
memory: "32M"
cpu: "0.1"
limits:
memory: "128M"
cpu: "1"
startupProbe:
httpGet:
path: /health
port: 8080
initialDelaySeconds: 3
periodSeconds: 1
successThreshold: 1
failureThreshold: 5
livenessProbe:
httpGet:
path: /health
port: 8080
periodSeconds: 3
successThreshold: 1
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 8080
periodSeconds: 1
successThreshold: 1
failureThreshold: 3
securityContext:
allowPrivilegeEscalation: false
env:
- name: API_URL
valueFrom:
configMapKeyRef:
name: {{ .Values.name }}-front
key: API_URL
{{- end }}
\ No newline at end of file
{{- if .Values.front.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
name: {{ .Values.name }}-front
spec:
rules:
- host: {{ .Values.front.ingress.host }}
http:
paths:
- backend:
service:
name: {{ .Values.name }}-front
port:
number: 80
path: /
pathType: Prefix
{{- if .Values.front.ingress.tlsEnabled }}
tls:
- hosts:
- {{ .Values.front.ingress.host }}
secretName: app-wildcard
{{- end }}
{{- end }}
\ No newline at end of file
{{- if .Values.front.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.name }}-front
spec:
selector:
app: front
ports:
- protocol: TCP
port: 80
targetPort: 8080
{{- end }}
\ No newline at end of file
# Default values for CDB app.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
# We have only done front for now
name: cdb
namespace: vdu
api:
name: api
enabled: true
image:
repository: registry.gitlab.com/takima-school/images/cdb/api
tag: latest
replicaCount: 3
ingress:
tlsEnabled: false
host: api.vdu.takima.school
front:
enabled: true
image:
repository: registry.gitlab.com/takima-school/images/cdb/www
tag: latest
replicaCount: 1
ingress:
tlsEnabled: false
host: www.vdu.takima.school
pg:
name: pg
path: /var/lib/postgresql/data
service:
name: pg-service
port: 5432
targetPort: 5432
enabled: true
image:
repository: registry.gitlab.com/takima-school/proxy/postgres
tag: latest
replicaCount: 1
ingress:
tlsEnabled: false
host: pg.vdu.takima.school
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment