apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    kubernetes.io/change-cause: "<to be filled in deploy_to_kubernetes script>"
  name: laa-legal-adviser-api
spec:
  replicas: 2
  selector:
    matchLabels:
      app: laa-legal-adviser-api
      tier: api
      env: production
  template:
    metadata:
      labels:
        app: laa-legal-adviser-api
        tier: api
        env: production
        service_area: laa-get-access
        service_team: cla-fala
    spec:
      terminationGracePeriodSeconds: 30
      containers:
      - image: "<to be set by deploy_to_kubernetes>"
        name: app
        readinessProbe:
          httpGet:
            path: /ping.json
            port: 8000
          initialDelaySeconds: 5
          timeoutSeconds: 1
          periodSeconds: 10
        livenessProbe:
          httpGet:
            path: /ping.json
            port: 8000
          initialDelaySeconds: 10
          timeoutSeconds: 1
          periodSeconds: 10
        lifecycle:
          preStop:
            exec:
              command: ["/bin/sleep","10"]
        env:
        - name: ENV
          value: prod
        - name: LOG_LEVEL
          value: INFO
        - name: SECRET_KEY
          valueFrom:
            secretKeyRef:
              name: secret-key
              key: SECRET_KEY
        - name: SENTRY_DSN
          valueFrom:
            secretKeyRef:
              name: sentry
              key: dsn
        - name: DATABASE_URL
          valueFrom:
            secretKeyRef:
              name: database
              key: url
        - name: STATIC_FILES_BACKEND
          value: s3
        - name: AWS_STORAGE_BUCKET_NAME
          valueFrom:
            secretKeyRef:
              name: s3
              key: bucket_name
        - name: AWS_ACCESS_KEY_ID
          valueFrom:
            secretKeyRef:
              name: s3
              key: access_key_id
        - name: AWS_SECRET_ACCESS_KEY
          valueFrom:
            secretKeyRef:
              name: s3
              key: secret_access_key
        - name: AWS_S3_REGION_NAME
          valueFrom:
            secretKeyRef:
              name: s3
              key: region
        - name: CELERY_BROKER_URL
          valueFrom:
            secretKeyRef:
              name: celery-broker
              key: url
        - name: CELERY_BROKER_USE_SSL
          value: "true"
