kind: Deployment
apiVersion: apps/v1
metadata:
  name: data-hub
  namespace: oih-dev-ns
  labels:
    app: data-hub
spec:
  replicas: 1
  selector:
    matchLabels:
      app: data-hub
  template:
    metadata:
      name: data-hub
      labels:
        app: data-hub
    spec:
      containers:
        - name: data-hub
          imagePullPolicy: IfNotPresent
          image: node:12-alpine
          workingDir: /usr/src/app/
          command: ["/bin/sh"]
          args: ["-c","yarn install --non-interactive && yarn start:container"]
          env:
            - name: MONGODB_URI
              valueFrom:
                secretKeyRef:
                  name: shared-secret
                  key: dataHubMongourl
            - name: PORT
              value: '1234'
            - name: IAM_TOKEN
              valueFrom:
                secretKeyRef:
                  name: shared-secret
                  key: iamtoken
            - name: LOG_LEVEL
              value: trace
            - name: NODE_ENV
              value: development
          terminationMessagePath: /dev/termination-log
          terminationMessagePolicy: File
          volumeMounts:
            - name: code
              mountPath: /usr/src/app
              subPath: services/data-hub
          livenessProbe:
            httpGet:
              path: /healthcheck
              port: 1234
          readinessProbe:
            httpGet:
              path: /healthcheck
              port: 1234
          securityContext:
            privileged: false
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      volumes:
        - name: code
          persistentVolumeClaim:
            claimName: source-volume-claim
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxUnavailable: 1
      maxSurge: 1
