apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
  name: business-management
spec:
  replicas: 1
  selector:
    matchLabels:
      app: business-management
  template:
    metadata:
      labels:
        app: business-management
    spec:      
      containers:
      - image: nebulaetpiprod/business-management.backend.business-management:0.0.20
        name: business-management
        volumeMounts:
        - name: google-application-credentials
          mountPath: "/etc/GOOGLE_APPLICATION_CREDENTIALS"
          readOnly: true
        env:     
        # EVENT STORE CONFIG 
        - name: GOOGLE_APPLICATION_CREDENTIALS
          value: /etc/GOOGLE_APPLICATION_CREDENTIALS/gcloud-service-key.json  
        - name: EVENT_STORE_BROKER_TYPE
          value: PUBSUB
        - name: EVENT_STORE_BROKER_EVENTS_TOPIC
          value: events
        - name: EVENT_STORE_STORE_TYPE
          value: MONGO
        - name: EVENT_STORE_STORE_URL
          value: mongodb://dbevents-0.dbevents:27017,dbevents-1.dbevents:27017,dbevents-2.dbevents:27017/test?replicaSet=rs0
        - name: EVENT_STORE_STORE_AGGREGATES_DB_NAME
          value: Aggregates
        - name: EVENT_STORE_STORE_EVENTSTORE_DB_NAME
          value: EventStore
        # INTERNAL MONGO DB CONFIG
        - name: MONGODB_URL
          value: mongodb://bus-mgmt-mongo:27017
        - name: MONGODB_DB_NAME
          value: business-management
        # JWT CONGIF        
        - name: JWT_PUBLIC_KEY
          valueFrom:
            configMapKeyRef:
              name: keycloak-jwt-public-key
              key: jwt_public_key 
          #value: -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyGMYfhPX7A5kAaBh9smoyDhj7Ilv0YfsPygnkEUDu44teqPzZhNjoLnAyDED3J7AhGJpOHlSzfC+7jrXXbUVczTP7vhH1pa1RXX4TIhzqo5R9NNKhREK39s6gezsP6SbCfu1XvaT1TVPEPBHho8q3qyICWFtoWTtx1tkk99jFz6zFFeIU2sTVAuf9+q1bawuHY42yU66/iaBP3zEtqLjtl7OO9z8wnIlaHW8zo20taFPeQy5xbmUaVUfEwQ6zoJCcSU2W79r2gFPWSfsXCJ07nfZIl0aWnOV7tRJLkJWsOL6EgFIh3P2v9d/SmLEVpje7kiibVUFqMg7ipRrruMzdwIDAQAB\n-----END PUBLIC KEY-----
        # API - gateway CONFIG
        - name: gateway_REPLIES_TOPIC_SUBSCRIPTION
          value: emi-gateway-replies-topic-mbe-business-management
        - name: REPLY_TIMEOUT
          value: '2000'
        - name: BROKER_TYPE
          value: PUBSUB
        # RESET LOCK INITIALIZE BACKED
        - name: LOCKVERSION
          value: "initial_lock"
        resources:
          requests:
            cpu: "50m"
        
      volumes:
      - name: google-application-credentials
        secret:
          secretName: google-application-credentials
      
