apiVersion: apps/v1
kind: Deployment
metadata:
  name: oscar-worker
  namespace: oscar
  labels:
    app: oscar-worker
spec:
  replicas: 1
  selector:
    matchLabels:
      app: oscar-worker
  template:
    metadata:
      labels:
        app: oscar-worker
    spec:
      serviceAccountName: oscar-worker-controller
      containers:
      - name:  oscar-queue-worker
        image: grycap/oscar-worker:latest
        imagePullPolicy: Always
        env:
        # Token to access the k8s API server (if not set reads the content of '/var/run/secrets/kubernetes.io/serviceaccount/token')  
        # - name: KUBE_TOKEN
        #   value: "xxx"
        - name: KUBERNETES_SERVICE_HOST
          value: "kubernetes.default"
        - name: KUBERNETES_SERVICE_PORT
          value: "443"
        - name: NATS_ADDRESS
          value: "nats.openfaas"
        - name: NATS_PORT
          value: "4222"
        - name: JOB_TTL_SECONDS_AFTER_FINISHED
          value: "60"
        - name: JOB_BACKOFF_LIMIT
          value: "3"
        # Adjust resources to suit needs of deployment
        resources:
          requests:
            memory: 250Mi
          limits:
            memory: 250Mi