Skip to content
Snippets Groups Projects
Commit f486520c authored by Nicolas Favier's avatar Nicolas Favier
Browse files

init

parents
Branches
No related tags found
No related merge requests found
Showing
with 387 additions and 0 deletions
.DS_Store 0 → 100644
File added
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/ch3-gitops.iml" filepath="$PROJECT_DIR$/.idea/ch3-gitops.iml" />
</modules>
</component>
</project>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
</project>
\ No newline at end of file
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.cloud
{{- if .Values.api.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: api-config
data:
DB_ENDPOINT: "{{ .Values.db.serviceName }}:{{ .Values.db.servicePort }}"
DB_NAME: {{ .Values.db.name }}
{{- end }}
\ No newline at end of file
{{- if .Values.api.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
labels:
app: api
spec:
replicas: {{ .Values.api.replicaCount }}
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
imagePullSecrets:
- name: auth-master3-registry
containers:
- name: api
image: {{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}
ports:
- containerPort: 8080
resources:
requests:
memory: "100Mi"
cpu: "0.1"
limits:
memory: "300Mi"
cpu: "0.5"
env:
- name: DB_ENDPOINT
valueFrom:
configMapKeyRef:
name: api-config
key: DB_ENDPOINT
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: api-config
key: DB_NAME
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: pg-credentials # Nom du secret
key: pg_username # nom de la clef dans le config map
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: pg-credentials # Nom du secret
key: pg_password
{{- end }}
{{- if .Values.api.enabled }}
{{- if .Values.api.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
{{- if .Values.api.ingress.tls.enabled }}
cert-manager.io/cluster-issuer: letsencrypt-prod
{{- end }}
name: api
spec:
rules:
- host: {{ .Values.api.ingress.host }}
http:
paths:
- backend:
service:
name: {{ .Values.api.serviceName }}
port:
number: {{ .Values.api.servicePort }}
path: /
pathType: Prefix
{{- if .Values.api.ingress.tls.enabled }}
tls:
- hosts:
- {{ .Values.api.ingress.host }}
secretName: {{ .Values.api.ingress.tls.secretName }}
{{- end }}
{{- end }}
{{- end }}
\ No newline at end of file
{{- if .Values.api.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.api.serviceName }}
spec:
selector:
app: api
ports:
- protocol: TCP
port: {{ .Values.api.servicePort }}
targetPort: 8080
{{- end }}
\ No newline at end of file
{{- if .Values.front.enabled }}
{{- $apiUrl := "" }}
{{- if .Values.api.ingress.tls.enabled }}
{{- $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: front-config
data:
API_URL: {{ $apiUrl }}
{{- end }}
{{- if .Values.front.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: front
labels:
app: front
spec:
replicas: {{ .Values.front.replicaCount }}
selector:
matchLabels:
app: front
template:
metadata:
labels:
app: front
spec:
imagePullSecrets:
- name: auth-master3-registry
containers:
- name: front
image: {{ .Values.front.image.repository }}:{{ .Values.front.image.tag }}
ports:
- containerPort: 80
resources:
requests:
memory: "100Mi"
cpu: "0.1"
limits:
memory: "300Mi"
cpu: "0.5"
env:
- name: API_URL
valueFrom:
configMapKeyRef:
name: front-config
key: API_URL
{{- end }}
\ No newline at end of file
{{- if .Values.front.enabled }}
{{- if .Values.front.ingress.enabled }}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
kubernetes.io/ingress.class: nginx
{{- if .Values.front.ingress.tls.enabled }}
cert-manager.io/cluster-issuer: letsencrypt-prod
{{- end }}
name: front
spec:
rules:
- host: {{ .Values.front.ingress.host }}
http:
paths:
- backend:
service:
name: {{ .Values.front.serviceName }}
port:
number: {{ .Values.front.servicePort }}
path: /
pathType: Prefix
{{- if .Values.front.ingress.tls.enabled }}
tls:
- hosts:
- {{ .Values.front.ingress.host }}
secretName: front-tls
{{- end }}
{{- end }}
{{- end }}
\ No newline at end of file
{{- if .Values.front.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.front.serviceName }}
spec:
selector:
app: front
ports:
- protocol: TCP
port: {{ .Values.front.servicePort }}
targetPort: 80
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: pg-config
data:
db_name: {{ .Values.db.name }}
db_path: {{ .Values.db.path }}
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: v1
kind: Secret
metadata:
name: pg-credentials
type: Opaque
data:
pg_username: {{ .Values.db.credentials.user | b64enc }}
pg_password: {{ .Values.db.credentials.pwd | b64enc }}
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: pg-database
labels:
app: pg
spec:
replicas: 1
selector:
matchLabels:
app: pg
template:
metadata:
labels:
app: pg
spec:
containers:
- name: postgres
image: {{ .Values.db.image.repository }}:{{ .Values.db.image.tag }}
volumeMounts:
- mountPath: /var/lib/postgresql/data
name: pg-data
ports:
- containerPort: 80
resources:
requests:
memory: "400Mi"
cpu: "0.1"
limits:
memory: "1000Mi"
cpu: "0.8"
env:
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: pg-config # Nom du configmap
key: db_name # nom de la clef dans le config map
- name: PGDATA
valueFrom:
configMapKeyRef:
name: pg-config # Nom du configmap
key: db_path # path ou installer la db dans le volume persistant
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: pg-credentials # Nom du secret
key: pg_username # nom de la clef dans le config map
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: pg-credentials # Nom du secret
key: pg_password # nom de la clef dans le config map
volumes:
- name: pg-data
persistentVolumeClaim:
claimName: pg-db
imagePullSecrets:
- name: auth-master3-registry
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: pg-db
spec:
accessModes:
- ReadWriteOnce
volumeMode: Filesystem
resources:
requests:
storage: {{ .Values.db.pvc.size }}
storageClassName: {{ .Values.db.pvc.storageClass }}
{{- end }}
\ No newline at end of file
{{- if .Values.db.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.db.serviceName}}
labels:
app: pg
spec:
type: ClusterIP
ports:
- port: {{ .Values.db.servicePort }}
selector:
app: pg
{{- end }}
\ 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