Skip to content
Snippets Groups Projects
Commit e6c67180 authored by Maxime's avatar Maxime
Browse files

templating

parent 35cda1ef
No related branches found
No related tags found
No related merge requests found
{{- if .Values.api.enabled }}
apiVersion: v1
kind: ConfigMap
metadata:
name: api-config
data:
db-name: {{ .Values.db.name }}
db-endpoint: {{ .Values.db.serviceName }}.mbibos
{{- end }}
{{- if .Values.api.enabled }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-deployment
labels:
app: cdb
spec:
replicas: {{ .Values.api.replicaCount }}
selector:
matchLabels:
app: cdb
template:
metadata:
labels:
app: cdb
spec:
imagePullSecrets:
- name: auth-master3-registry
containers:
- name: cdb
env:
- name: POSTGRES_DB
valueFrom:
configMapKeyRef:
name: api-config
key: db-name
- name: DB_ENDPOINT
valueFrom:
configMapKeyRef:
name: api-config
key: db-endpoint
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: pg-credentials
key: pg_username
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: pg-credentials
key: pg_password
image: {{ .Values.api.image.repository }}:{{ .Values.api.image.tag }}
ports:
- containerPort: 8080
{{- end }}
{{- if .Values.api.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: cdb-server
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.front.ingress.tls.enabled }}
tls:
- hosts:
- {{ .Values.api.ingress.host }}
secretName: front-tls
{{- end }}
{{- end }}
{{- if .Values.api.enabled }}
apiVersion: v1
kind: Service
metadata:
name: {{ .Values.api.serviceName }}
spec:
selector:
app: cdb
ports:
- protocol: TCP
port: {{ .Values.api.servicePort }}
targetPort: 8080
{{- end }}
{{- if .Values.front.enabled }}
{{- $apiUrl := "" }}
{{- if .Values.api.ingress.tls.enabled }}
{{- $apiUrl = printf "https://%s" .Values.api.ingress.host | quote }}
{{- $apiUrl = printf "https://%s/api" .Values.api.ingress.host | quote }}
{{- else }}
{{- $apiUrl = printf "http://%s" .Values.api.ingress.host | quote }}
{{- $apiUrl = printf "http://%s/api" .Values.api.ingress.host | quote }}
{{- end }}
apiVersion: v1
kind: ConfigMap
......
# Default values for Linkcy app.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
## The global properties are used to configure multiple charts at once.
## Extended documentation at doc/charts/globals.md
env: staging
api:
enabled: true
image:
repository: master3.takima.io:4567/master3/kubernetes-resources/api
tag: latest
replicaCount: 1
serviceName: cdb-service
servicePort: 80
ingress:
tls:
enable: false
host: api.staging.mbibos.takima.cloud
front:
enabled: true
image:
repository: master3.takima.io:4567/master3/kubernetes-resources/front
tag: latest
serviceName: front
servicePort: 80
replicaCount: 3
ingress:
enabled: true
host: front.staging.mbibos.takima.cloud
tls:
enabled: false
db:
enabled: true
image:
repository: master3.takima.io:4567/master3/kubernetes-resources/db
tag: latest
name: "cdb-db"
path: "/var/lib/postgresql/data/pgdata"
serviceName: db
servicePort: 5432
pvc:
storageClass: gp2
size: 512Mi
credentials:
user: cdb
pwd: cdb123
......@@ -4,13 +4,19 @@
## The global properties are used to configure multiple charts at once.
## Extended documentation at doc/charts/globals.md
env: default
api:
enabled: true
image:
repository: master3.takima.io:4567/master3/kubernetes-resources/api
tag: latest
replicaCount: 1
serviceName: cdb-service
servicePort: 80
ingress:
tls:
enable: false
host: api.to-replace.takima.cloud
host: api.mbibos.takima.cloud
front:
enabled: true
......@@ -22,7 +28,7 @@ front:
replicaCount: 3
ingress:
enabled: true
host: www.to-replace.takima.cloud
host: front.mbibos.takima.cloud
tls:
enabled: false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment