apiVersion: apps/v1
kind: Deployment
metadata:
  name: flow-repository
  namespace: oih-dev-ns
spec:
  replicas: 1
  selector:
    matchLabels:
      app: flow-repository
  template:
    metadata:
      labels:
        app: flow-repository
    spec:
      containers:
      - name: flow-repository
        image: node:12-alpine
        command: ["/bin/sh"]
        args: ["-c", "yarn install --non-interactive && yarn start:container"]
        workingDir: /usr/src/app/
        ports:
        - containerPort: 3001
        env:
        - name: MONGODB_URL
          valueFrom:
            secretKeyRef:
              name: shared-secret
              key: "flowRepoMongourl"
        - name: IAM_TOKEN
          valueFrom:
            secretKeyRef:
              name: shared-secret
              key: "iamtoken"
        - name: QUEUE_URL
          value: "amqp://guest:guest@rabbitmq-service.oih-dev-ns.svc.cluster.local:5672"
        - name: "INTROSPECT_TYPE"
          value: "basic"
        - name: "INTROSPECT_ENDPOINT_BASIC"
          value: "http://iam.oih-dev-ns.svc.cluster.local:3099/api/v1/tokens/introspect"
        - name: ORIGINWHITELIST
          value: "localoih.com,http://web-ui.localoih.com,http://localhost:3000"
        - name: NODE_ENV
          value: development
        - name: LOG_LEVEL
          value: info
        resources:
          limits:
            cpu: "0.1"
            memory: 1000Mi
        volumeMounts:
        - name: code
          mountPath: /usr/src/app
          subPath: services/flow-repository
        livenessProbe:
          httpGet:
            port: 3001
            path: /healthcheck
          initialDelaySeconds: 300
          timeoutSeconds: 1
        readinessProbe:
          httpGet:
            port: 3001
            path: /healthcheck
          initialDelaySeconds: 120
          timeoutSeconds: 1
        imagePullPolicy: IfNotPresent
      volumes:
      - name: code
        persistentVolumeClaim:
          claimName: source-volume-claim
