apiVersion: apps/v1
kind: Deployment
metadata:
  name: routines 
spec:
  replicas: 1
  selector:
    matchLabels:
      app: routines
  template:
    metadata:
      labels:
        app: routines 
    spec:
      containers:
      - name: routines-controller 
        image: apollodorus/routines-controller:v1 
        volumeMounts:
           - name: routines-run
             mountPath: /mnt/routines/run
           - name: routines-data
             mountPath: /mnt/routines/data
        ports:
           - containerPort: 50051 
        env:
           - name: ROUTINES_APP_DIR 
             value: "/mnt/routines"
      - name: local-cluster
        image: apollodorus/routines-local-cluster:v1
        volumeMounts:
           - name: routines-run
             mountPath: /mnt/routines/run
           - name: routines-data
             mountPath: /mnt/routines/data
           - name: docker-sock
             mountPath: /var/run/docker.sock
        env:
           - name: CELERY_BROKER_URL
             value: "amqp://guest:guest@rabbitmq-service:5672"
           - name: CELERY_RESULT_BACKEND
             value: "rpc://"
      volumes:
      - name: docker-sock
        hostPath:
          path: /var/run/docker.sock
      - name: routines-run 
        hostPath:
          path: /mnt/routines/run
      - name: routines-data 
        hostPath:
          path: /mnt/routines/data

