158 lines
6.6 KiB
YAML
158 lines
6.6 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: backend
|
|
labels:
|
|
app: backend
|
|
service: backend
|
|
namespace: notes
|
|
spec:
|
|
replicas: 1
|
|
revisionHistoryLimit: 10
|
|
selector:
|
|
matchLabels:
|
|
app: backend
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: backend
|
|
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-notes-db: secrets/data/apps/notes/postgres
|
|
vault.hashicorp.com/agent-inject-secret-notes-django-auth: secrets/data/vault/common/django_auth
|
|
vault.hashicorp.com/agent-inject-secret-notes-kafka: secrets/data/kafka/apps/notes
|
|
vault.hashicorp.com/agent-inject-secret-notes-rabbitmq: secrets/data/rabbitmq/apps/notes
|
|
vault.hashicorp.com/agent-inject-secret-notes-s3: secrets/data/minio/apps/notes
|
|
vault.hashicorp.com/agent-inject-template-notes-db: |-
|
|
{{- with secret "secrets/data/apps/notes/postgres" -}}
|
|
PG_HOST={{ index .Data.data "host" }}
|
|
PG_PORT={{ index .Data.data "port" }}
|
|
PG_DB={{ index .Data.data "database" }}
|
|
PG_LOGIN={{ index .Data.data "username" }}
|
|
PG_PASSWORD={{ index .Data.data "password" }}
|
|
{{- end -}}
|
|
vault.hashicorp.com/agent-inject-template-notes-django-auth: |-
|
|
{{- with secret "secrets/data/vault/common/django_auth" -}}
|
|
DJANGO_TOKEN={{ index .Data.data "key" }}
|
|
{{- end -}}
|
|
vault.hashicorp.com/agent-inject-template-notes-kafka: |-
|
|
{{- with secret "secrets/data/kafka/apps/notes" -}}
|
|
NOTES_KAFKA_BOOTSTRAP_SERVERS={{ with index .Data.data "auth" }}{{ index . "bootstrap_servers" }}{{ else }}{{ index .Data.data "bootstrap_servers" }}{{ end }}
|
|
NOTES_KAFKA_SECURITY_PROTOCOL={{ with index .Data.data "auth" }}{{ index . "security_protocol" }}{{ else }}{{ index .Data.data "security_protocol" }}{{ end }}
|
|
NOTES_KAFKA_SASL_MECHANISM={{ with index .Data.data "auth" }}{{ index . "sasl_mechanism" }}{{ else }}{{ index .Data.data "sasl_mechanism" }}{{ end }}
|
|
NOTES_KAFKA_USERNAME={{ index .Data.data "username" }}
|
|
NOTES_KAFKA_PASSWORD={{ index .Data.data "password" }}
|
|
{{- end -}}
|
|
vault.hashicorp.com/agent-inject-template-notes-rabbitmq: |-
|
|
{{- with secret "secrets/data/rabbitmq/apps/notes" -}}
|
|
NOTES_RABBITMQ_VHOST={{ index .Data.data "vhost" }}
|
|
NOTES_RABBITMQ_USERNAME={{ index .Data.data "username" }}
|
|
NOTES_RABBITMQ_PASSWORD={{ index .Data.data "password" }}
|
|
NOTES_RABBITMQ_HOST=rabbitmq.rabbitmq.svc.cluster.local
|
|
NOTES_RABBITMQ_PORT=5672
|
|
{{- end -}}
|
|
vault.hashicorp.com/agent-inject-template-notes-s3: |-
|
|
{{- with secret "secrets/data/minio/apps/notes" -}}
|
|
NOTES_S3_ENDPOINT={{ with index .Data.data "client" }}{{ index . "endpoint" }}{{ else }}{{ index .Data.data "endpoint" }}{{ end }}
|
|
NOTES_S3_REGION={{ with index .Data.data "client" }}{{ index . "region" }}{{ else }}{{ index .Data.data "region" }}{{ end }}
|
|
NOTES_S3_BUCKET=notes
|
|
NOTES_S3_ACCESS_KEY_ID={{ or (index .Data.data "access_key") (index .Data.data "access_key_id") }}
|
|
NOTES_S3_SECRET_ACCESS_KEY={{ or (index .Data.data "secret_key") (index .Data.data "secret_access_key") }}
|
|
{{- end -}}
|
|
vault.hashicorp.com/agent-pre-populate-only: 'true'
|
|
vault.hashicorp.com/auth-path: auth/kubernetes
|
|
vault.hashicorp.com/role: notes
|
|
spec:
|
|
serviceAccountName: notes-vault
|
|
imagePullSecrets:
|
|
- name: regcred
|
|
nodeSelector:
|
|
dedicated: backend
|
|
tolerations:
|
|
- key: dedicated
|
|
operator: Equal
|
|
value: backend
|
|
effect: NoSchedule
|
|
containers:
|
|
- name: backend
|
|
image: cr.yandex/crp3ccidau046kdj8g9q/notes-backend:latest
|
|
imagePullPolicy: IfNotPresent
|
|
command:
|
|
- /bin/bash
|
|
- -c
|
|
args:
|
|
- |
|
|
set -a
|
|
[ -f /vault/secrets/notes-db ] && source /vault/secrets/notes-db
|
|
[ -f /vault/secrets/notes-django-auth ] && source /vault/secrets/notes-django-auth
|
|
[ -f /vault/secrets/notes-rabbitmq ] && source /vault/secrets/notes-rabbitmq
|
|
[ -f /vault/secrets/notes-s3 ] && source /vault/secrets/notes-s3
|
|
[ -f /vault/secrets/notes-kafka ] && source /vault/secrets/notes-kafka
|
|
set +a
|
|
/bin/bash /opt/entrypoint.sh
|
|
ports:
|
|
- name: http
|
|
containerPort: 8000
|
|
protocol: TCP
|
|
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: PG_SSL_MODE
|
|
value: verify-full
|
|
- name: DJANGO_HOST
|
|
value: http://backend-svc.django.svc.cluster.local
|
|
- name: BASE_HOST
|
|
value: https://sarex.stand.sarex.tech/notes
|
|
- name: TIMEOUT
|
|
value: '120'
|
|
- name: FAAS_SERVICE
|
|
value: https://sarex.stand.sarex.tech/lambdas
|
|
- name: WORKSPACE_URL
|
|
value: http://backend-svc.workspaces.svc.cluster.local/api/v1
|
|
- name: WORKFLOW_HOST
|
|
value: http://backend-svc.processing.svc.cluster.local/api/v1
|
|
- name: WORKFLOW_TAG
|
|
value: stable
|
|
- name: RESOURCE_URL
|
|
value: https://sarex.stand.sarex.tech/resources/api/v1
|
|
- name: SYNC_RESOURCE_ID
|
|
value: '0'
|
|
- name: ENABLE_ND
|
|
value: '0'
|
|
- name: ATTACHMENT_HOST
|
|
value: http://attachments-service.attachments.svc.cluster.local:8000/api/v1
|
|
resources:
|
|
requests:
|
|
memory: 128Mi
|
|
cpu: 25m
|