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