iac/apps/bim/base/backend-deployment.yaml

109 lines
3.6 KiB
YAML

---
apiVersion: apps/v1
kind: Deployment
metadata:
name: backend
namespace: bim
labels:
app: backend
spec:
replicas: 1
selector:
matchLabels:
app: backend
template:
metadata:
labels:
app: backend
annotations:
traffic.sidecar.istio.io/excludeOutboundPorts: "8200"
vault.hashicorp.com/agent-init-first: "true"
vault.hashicorp.com/agent-inject: "true"
vault.hashicorp.com/agent-pre-populate-only: "true"
vault.hashicorp.com/auth-path: auth/kubernetes
vault.hashicorp.com/role: bim
vault.hashicorp.com/agent-inject-secret-bim-postgresql: secrets/data/postgresql/apps/bim
vault.hashicorp.com/agent-inject-template-bim-postgresql: |-
{{- with secret "secrets/data/postgresql/apps/bim" -}}
POSTGRES_ADDRESS=postgresql.bim.svc.cluster.local
POSTGRES_ADDRESS_2=postgresql.bim.svc.cluster.local
POSTGRES_ADDRESS_3=postgresql.bim.svc.cluster.local
POSTGRES_ADDRESS_4=postgresql.bim.svc.cluster.local
POSTGRES_PORT=5432
POSTGRES_PORT_2=5432
POSTGRES_PORT_3=5432
POSTGRES_PORT_4=5432
POSTGRES_DB=bim_db
POSTGRES_DB_2=bim_db
POSTGRES_DB_3=bim_db
POSTGRES_DB_4=bim_db
POSTGRES_USER={{ index .Data.data "username" }}
POSTGRES_USER_2={{ index .Data.data "username" }}
POSTGRES_USER_3={{ index .Data.data "username" }}
POSTGRES_USER_4={{ index .Data.data "username" }}
POSTGRES_PASSWORD={{ index .Data.data "password" }}
POSTGRES_PASSWORD_2={{ index .Data.data "password" }}
POSTGRES_PASSWORD_3={{ index .Data.data "password" }}
POSTGRES_PASSWORD_4={{ index .Data.data "password" }}
{{- end -}}
spec:
serviceAccountName: bim-vault
containers:
- name: backend
image: cr.yandex/crp3ccidau046kdj8g9q/bim-api:contour_3d704fef
imagePullPolicy: IfNotPresent
command: ["/bin/sh", "-ec"]
args:
- |
set -a
[ -f /vault/secrets/bim-postgresql ] && . /vault/secrets/bim-postgresql
set +a
exec ./httpserver
ports:
- name: http
containerPort: 8000
protocol: TCP
env:
- name: LAST_MASTER_BIM
value: "100000"
- name: LAST_MASTER_BIM_V3
value: "100000"
- name: DB_CERT_PATH_4
value: /root/yandex_pg.pem
- name: DB_CERT_PATH_3
value: /root/yandex_pg.pem
- name: DB_CERT_PATH_2
value: /root/yandex_pg.pem
- name: LAST_SLAVE_1_BIM
value: "1000000"
- name: POSTGRES_POOL_SIZE
value: "30"
- name: API_ADDRESS
value: 0.0.0.0:8000
- name: DJANGO_HOST
value: http://backend.django.svc.cluster.local:8000
- name: ENABLE_SQL_QUERY
value: "0"
- name: ENABLE_SSL
value: "0"
resources:
requests:
cpu: 25m
memory: 100Mi
livenessProbe:
httpGet:
path: /ping
port: 8000
initialDelaySeconds: 10
periodSeconds: 60
failureThreshold: 10
readinessProbe:
httpGet:
path: /ping
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
failureThreshold: 20
imagePullSecrets:
- name: regcred