apiVersion: apps/v1
kind: Deployment
metadata:
  name: imicros-users-deployment
spec:
  selector:
    matchLabels:
      app: imicros-users
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: imicros-users
        version: '0.1'
    spec:
      containers:
      - name: imicros-users
        image: al66/imicros-backend:latest
        imagePullPolicy: Always
        env:
        # Services of this node
        - name: SERVICES
          value: "master, user, groups, agents, acl"
        # Broker settings - transporter
        - name: TRANSPORTER_NATS
          value: "nats://nats:4222" 
        # Service settings - token -> master,keys
        - name: MASTER_TOKEN
          valueFrom:
            secretKeyRef:
              name: master-token
              key: token
        - name: SERVICE_TOKEN
          valueFrom:
            secretKeyRef:
              name: service-token
              key: token
        # Service settings - db -> master,keys
        - name: CASSANDRA_CONTACTPOINTS
          value: "cassandra"
        - name: CASSANDRA_DATACENTER
          value: "datacenter1"
        - name: CASSANDRA_KEYSPACE_KEYS
          value: "imicros_keys"
        - name: CASSANDRA_PORT
          value: "9042"
        - name: CASSANDRA_USER
          valueFrom:
            secretKeyRef:
              name: cassandra-root
              key: user
        - name: CASSANDRA_PASSWORD
          valueFrom:
            secretKeyRef:
              name: cassandra-root
              key: password
        # Services settings - db -> user, groups, agents, acl
        - name: NEO4J_URI
          value: "bolt://neo4j:7687"
        - name: NEO4J_USER
          valueFrom:
            secretKeyRef:
              name: neo4j-root
              key: user
        - name: NEO4J_PASSWORD
          valueFrom:
            secretKeyRef:
              name: neo4j-root
              key: password
        # Service settings - jwt secret -> acl, agents
        - name: JWT_SECRET
          valueFrom:
            secretKeyRef:
              name: jwt-secret
              key: secret
        # Service settings - initial group -> groups
        - name: ADMIN_GROUP_ID
          valueFrom:
            secretKeyRef:
              name: admin-group
              key: id
        - name: ADMIN_GROUP_NAME
          valueFrom:
            secretKeyRef:
              name: admin-group
              key: name
        - name: ADMIN_GROUP_MEMBER
          valueFrom:
            secretKeyRef:
              name: admin-group
              key: member
        # Service settings - default event owner -> user
        - name: EVENT_OWNER_ID
          valueFrom:
            secretKeyRef:
              name: admin-group
              key: id
          