apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: daemon
  name: daemon
spec:
  replicas: 1
  selector:
    matchLabels:
      app: daemon
  template:
    metadata:
      labels:
        app: daemon
    spec:
      containers:
      - name: daemon
        image: grouper0822.azurecr.io/grouper-daemon:latest
        imagePullPolicy: "Always"
        # image: grouper-daemon
        # imagePullPolicy: "IfNotPresent"
        args:
        - bash
        - -c
        - while ! curl -s data:3306 > /dev/null; do echo waiting for mysql to start;
          sleep 3; done; while ! curl -s ldap://data:389 > /dev/null; do echo waiting
          for ldap to start; sleep 3; done; exec daemon
        env:
        - name: ENV
          value: dev
        - name: GROUPER_CLIENT_WEBSERVICE_PASSWORD_FILE
          value: password
        - name: GROUPER_DATABASE_PASSWORD_FILE
          value: /run/secrets/database_password.txt
        - name: RABBITMQ_PASSWORD_FILE
          value: /run/secrets/rabbitmq_password.txt
        - name: SUBJECT_SOURCE_LDAP_PASSWORD
          value: password
        - name: USERTOKEN
          value: build-2
        resources: {}
          # requests:
          #   memory: "128Mi"
          #   cpu: "512m"
          # limits:
          #   memory: "4068Mi"
          #   cpu: "10000m"
        volumeMounts:
        - name: database-password-txt
          mountPath: /run/secrets/database_password.txt
          subPath: database_password.txt
        - name: rabbitmq-password-txt
          mountPath: /run/secrets/rabbitmq_password.txt
          subPath: rabbitmq_password.txt
        # grouper.hibernate.properties
        - name: grouper-hibernate-properties
          mountPath: /opt/grouper/grouper.apiBinary/conf/grouper.hibernate.properties
          subPath: grouper.hibernate.properties
        - name: grouper-hibernate-properties
          mountPath: /opt/grouper/grouper.ui/WEB-INF/classes/grouper.hibernate.properties
          subPath: grouper.hibernate.properties
        - name: grouper-hibernate-properties
          mountPath: /opt/grouper/grouper.ws/WEB-INF/classes/grouper.hibernate.properties
          subPath: grouper.hibernate.properties
        # grouper-loader.properties
        - name: grouper-loader-properties
          mountPath: /opt/grouper/grouper.apiBinary/conf/grouper-loader.properties
          subPath: grouper-loader.properties
        - name: grouper-loader-properties
          mountPath: /opt/grouper/grouper.ui/WEB-INF/classes/grouper-loader.properties
          subPath: grouper-loader.properties
        - name: grouper-loader-properties
          mountPath: /opt/grouper/grouper.ws/WEB-INF/classes/grouper-loader.properties
          subPath: grouper-loader.properties
        # subject.properties
        - name: subject-properties
          mountPath: /opt/grouper/grouper.apiBinary/conf/subject.properties
          subPath: subject.properties
        - name: subject-properties
          mountPath: /opt/grouper/grouper.ui/WEB-INF/classes/subject.properties
          subPath: subject.properties
        - name: subject-properties
          mountPath: /opt/grouper/grouper.ws/WEB-INF/classes/subject.properties
          subPath: subject.properties
        # grouper.properties
        - name: grouper-properties
          mountPath: /opt/grouper/conf/grouper.properties
          subPath: grouper.properties
        - name: grouper-properties
          mountPath: /opt/grouper/grouper.apiBinary/conf/grouper.properties
          subPath: grouper.properties
        - name: grouper-properties
          mountPath: /opt/grouper/grouper.ui/WEB-INF/classes/grouper.properties
          subPath: grouper.properties
        - name: grouper-properties
          mountPath: /opt/grouper/grouper.ws/WEB-INF/classes/grouper.properties
          subPath: grouper.properties
        # grouper.client.properties
        - name: grouper-client-properties
          mountPath: /opt/grouper/conf/grouper.client.properties
          subPath: grouper.client.properties
        - name: grouper-client-properties
          mountPath: /opt/grouper/grouper.apiBinary/conf/grouper.client.properties
          subPath: grouper.client.properties
        - name: grouper-client-properties
          mountPath: /opt/grouper/grouper.ui/WEB-INF/classes/grouper.client.properties
          subPath: grouper.client.properties
        - name: grouper-client-properties
          mountPath: /opt/grouper/grouper.ws/WEB-INF/classes/grouper.client.properties
          subPath: grouper.client.properties
      restartPolicy: Always
      serviceAccountName: ""
      volumes:      
      - name: database-password-txt
        configMap:
          name: database-password
          items:
          - key: database_password.txt
            path: database_password.txt
      - name: rabbitmq-password-txt
        configMap:
          name: rabbitmq-password
          items:
          - key: rabbitmq_password.txt
            path: rabbitmq_password.txt
      - name: grouper-hibernate-properties
        configMap:
          name: grouper-hibernate-properties
          items:
          - key: grouper.hibernate.properties
            # path: grouper_grouper.hibernate.properties
            path: grouper.hibernate.properties
      - name: grouper-loader-properties
        configMap:
          name: grouper-loader-properties
          items:
          - key: grouper-loader.properties
            # path: grouper_grouper-loader.properties
            path: grouper-loader.properties
      - name: subject-properties
        configMap:
          name: subject-properties
          items:
          - key: subject.properties
            # path: grouper_subject.properties
            path: subject.properties
      - name: grouper-properties
        configMap:
          name: grouper-properties
          items:
          - key: grouper.properties
            path: grouper.properties
      - name: grouper-client-properties
        configMap:
          name: grouper-client-properties
          items:
          - key: grouper.client.properties
            path: grouper.client.properties