---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: pdf-markings
  namespace: documentations
  labels:
    app: pdf-markings
spec:
  progressDeadlineSeconds: 600
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      app: pdf-markings
  strategy:
    rollingUpdate:
      maxSurge: 25%
      maxUnavailable: 25%
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: pdf-markings
    spec:
      containers:
      - env:
        - name: RABBITMQ_HOST
          value: rabbitmq-service.insert-db-documentation.svc.cluster.local:5672
        - name: RABBITMQ_USERNAME
          value: sarex
        - name: RABBITMQ_PASSWORD
          value: QvGBXtzHCjNVAmJq4v6tKBvk76mXy6RP
        - name: RABBITMQ_VHOST
          value: api
        - name: APP_NAME
          value: pdm_v2
        - name: VERIFY
          value: 'False'
        - name: APP_VERSION
          value: 0.0.1
        - name: LOG_LEVEL
          value: INFO
        - name: HTTP_PORT
          value: '8000'
        - name: DOC_POSTGRES_HOST
          value: postgres-service
        - name: DOC_POSTGRES_PORT
          value: '5432'
        - name: DOC_POSTGRES_DB
          value: documentations
        - name: DOC_POSTGRES_POOL_SIZE
          value: '10'
        - name: DOC_POSTGRES_SSL_MODE
          value: disable
        - name: API_ADDRESS
          value: 0.0.0.0:8000
        - name: DATABASE_SSL_MODE
          value: disable
        - name: YANDEX_S3_USE_SSL
          value: '0'
        - name: ENVIRONMENT
          value: production
        - name: YANDEX_S3_ACCOUNT_PATH
          value: /etc/sarex/yc-s3-storage/yc-s3-service-account.json
        - name: REDIRECT_URL_QR
          value: https://stamp-verification.sarex.dsinv.ru/
        - name: BASE_DOCUMENT_URL
          value: https://sarex.dsinv.ru
        - name: SENTRY_DSN
        - name: DOC_POSTGRES_USER
          valueFrom:
            secretKeyRef:
              key: username
              name: postgres-secret
        - name: DOC_POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              key: password
              name: postgres-secret
        - name: YANDEX_S3_ENDPOINT_URL
          valueFrom:
            secretKeyRef:
              key: endpoint_url
              name: yc-s3
        - name: YANDEX_S3_SECRET_ACCESS_KEY
          valueFrom:
            secretKeyRef:
              key: access_key
              name: yc-s3
        - name: YANDEX_S3_ACCESS_KEY_ID
          valueFrom:
            secretKeyRef:
              key: key_id
              name: yc-s3
        image: cr.yandex/crp3ccidau046kdj8g9q/pdf-markings:prod_67df7ec7
        imagePullPolicy: IfNotPresent
        name: pdf-markings
        ports:
        - containerPort: 8000
          name: http
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
        volumeMounts:
        - mountPath: /etc/sarex/yc-s3-storage
          name: yc-s3
          readOnly: true
      dnsPolicy: ClusterFirst
      imagePullSecrets:
      - name: dockerhub
      nodeSelector:
        name: generic
      restartPolicy: Always
      schedulerName: default-scheduler
      securityContext: {}
      terminationGracePeriodSeconds: 30
      volumes:
      - name: yc-s3
        secret:
          defaultMode: 420
          secretName: documentations-yc-s3
---
apiVersion: v1
kind: Service
metadata:
  name: marks-service
  namespace: documentations
spec:
  ports:
  - port: 8000
    protocol: TCP
    targetPort: 8000
  selector:
    app: pdf-markings
  sessionAffinity: None
  type: ClusterIP
