apiVersion: apps/v1
kind: Deployment
metadata:
  name: query-handler-deployment
  labels:
    app: query-handler 
spec:
  replicas: 3 
  selector:
    matchLabels:
      app: query-handler
  template:
    metadata:
      labels:
        app: query-handler 
    spec:
      containers:
      - name: query-handler
        image: datastropheregistry.azurecr.io/query-service:latest
        ports:
        - containerPort: 3000 
        env:
        - name: RABBIT_HOST
          value: rabbitmq
        - name: RABBIT_PORT
          value: "5672"
        - name: RABBIT_USER
          valueFrom:
            secretKeyRef: 
              name: rabbitmq-default-user
              key: username
        - name: RABBIT_PASSWORD
          valueFrom:
            secretKeyRef: 
              name: rabbitmq-default-user
              key: password
        - name: REDIS_ADDRESS
          value: redis.redis.svc.cluster.local:6379
        - name: LOG_MESSAGES
          value: "true"
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
      imagePullSecrets:
      - name: docker-regcred