apiVersion: apps/v1
kind: Deployment
metadata:
  name: celery-worker
  labels:
    deployment: celery-worker
spec:
  replicas: 1
  selector:
    matchLabels:
      pod: celery-worker
  template:
    metadata:
      labels:
        pod: celery-worker
    spec:
      containers:
        - name: celery-worker
          image: willwcchan/visual-option-chain-graph
          command:
            [
              "celery",
              "-A",
              "visual-option-chain",
              "worker",
              "-l",
              "info",
              "-E",
            ]
          env:
            - name: POSTGRES_USER
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: user

            - name: POSTGRES_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: postgres-credentials
                  key: password

            - name: POSTGRES_HOST
              value: postgres-service

            - name: SECRET_KEY
              valueFrom:
                secretKeyRef:
                  name: app-secret
                  key: SECRET_KEY

            - name: TRADIER_API_KEY
              valueFrom:
                secretKeyRef:
                  name: app-secret
                  key: TRADIER_API_KEY

            - name: EMAIL_HOST_PASSWORD
              valueFrom:
                secretKeyRef:
                  name: app-secret
                  key: EMAIL_HOST_PASSWORD
