142 lines
4.5 KiB
YAML
142 lines
4.5 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: workspaces-api
|
|
labels:
|
|
app: workspaces-api
|
|
service: backend
|
|
namespace: workspaces
|
|
spec:
|
|
replicas: 1
|
|
revisionHistoryLimit: 10
|
|
selector:
|
|
matchLabels:
|
|
app: workspaces-api
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: workspaces-api
|
|
service: backend
|
|
annotations:
|
|
proxy.istio.io/config: |
|
|
tracing:
|
|
sampling: 100
|
|
zipkin:
|
|
address: signoz-otel-collector-external.signoz.svc.cluster.local:9411
|
|
custom_tags:
|
|
k8s.pod.name:
|
|
environment:
|
|
name: POD_NAME
|
|
k8s.namespace.name:
|
|
environment:
|
|
name: POD_NAMESPACE
|
|
k8s.pod.ip:
|
|
environment:
|
|
name: INSTANCE_IP
|
|
traffic.sidecar.istio.io/excludeOutboundPorts: '8200'
|
|
vault.hashicorp.com/agent-init-first: 'true'
|
|
vault.hashicorp.com/agent-inject: 'true'
|
|
vault.hashicorp.com/agent-inject-secret-workspaces-db: secrets/data/apps/workspaces/postgres
|
|
vault.hashicorp.com/agent-inject-secret-workspaces-django-auth: secrets/data/vault/common/django_auth
|
|
vault.hashicorp.com/agent-inject-template-workspaces-db: |-
|
|
{{- with secret "secrets/data/apps/workspaces/postgres" -}}
|
|
POSTGRES_ADDRESS={{ index .Data.data "host" }}
|
|
POSTGRES_PORT={{ index .Data.data "port" }}
|
|
POSTGRES_DB={{ index .Data.data "database" }}
|
|
POSTGRES_USER={{ index .Data.data "username" }}
|
|
POSTGRES_PASSWORD={{ index .Data.data "password" }}
|
|
{{- end -}}
|
|
vault.hashicorp.com/agent-inject-template-workspaces-django-auth: |-
|
|
{{- with secret "secrets/data/vault/common/django_auth" -}}
|
|
DJANGO_BASIC_AUTH={{ index .Data.data "key" }}
|
|
{{- end -}}
|
|
vault.hashicorp.com/agent-pre-populate-only: 'true'
|
|
vault.hashicorp.com/auth-path: auth/kubernetes
|
|
vault.hashicorp.com/role: workspaces
|
|
spec:
|
|
serviceAccountName: workspaces-vault
|
|
imagePullSecrets:
|
|
- name: regcred
|
|
containers:
|
|
- name: backend
|
|
image: cr.yandex/crp3ccidau046kdj8g9q/workspaces:latest
|
|
imagePullPolicy: IfNotPresent
|
|
command:
|
|
- /bin/sh
|
|
- -ec
|
|
args:
|
|
- |
|
|
set -a
|
|
[ -f /vault/secrets/workspaces-db ] && . /vault/secrets/workspaces-db
|
|
[ -f /vault/secrets/workspaces-django-auth ] && . /vault/secrets/workspaces-django-auth
|
|
set +a
|
|
/migrations migrate
|
|
exec /api
|
|
ports:
|
|
- name: http
|
|
containerPort: 8000
|
|
protocol: TCP
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: 8000
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 60
|
|
timeoutSeconds: 1
|
|
successThreshold: 1
|
|
failureThreshold: 10
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /ping
|
|
port: 8000
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 5
|
|
timeoutSeconds: 1
|
|
successThreshold: 1
|
|
failureThreshold: 20
|
|
env:
|
|
- name: K8S_POD_UID
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.uid
|
|
- name: K8S_POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: K8S_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
- name: OTEL_RESOURCE_ATTRIBUTES
|
|
value: k8s.pod.uid=$(K8S_POD_UID),k8s.pod.name=$(K8S_POD_NAME),k8s.namespace.name=$(K8S_NAMESPACE)
|
|
- name: POSTGRES_POOL_SIZE
|
|
value: '3'
|
|
- name: BUNDLES_RETRY_COUNT
|
|
value: '5'
|
|
- name: BUNDLES_NJOBS
|
|
value: '5'
|
|
- name: API_ADDRESS
|
|
value: 0.0.0.0:8000
|
|
- name: NAMESPACE
|
|
value: workspaces
|
|
- name: ENABLE_SQL_QUERY
|
|
value: '0'
|
|
- name: ENABLE_SSL
|
|
value: '0'
|
|
- name: DOCUMENTATION_HOST
|
|
value: http://backend-api-svc.documentations.svc.cluster.local:80
|
|
- name: DOCUMENTATION_LOGGER_FEATURE
|
|
value: '0'
|
|
- name: DOCUMENTATION_ORIGINATOR
|
|
value: prod_ws
|
|
- name: ENVIRONMENT
|
|
value: prod
|
|
- name: DJANGO_HOST
|
|
value: http://backend-svc.django.svc.cluster.local:80
|
|
- name: DJANGO_ORIGINATOR
|
|
value: docs_prod
|
|
resources:
|
|
requests:
|
|
memory: 100Mi
|
|
cpu: 25m
|