apiVersion: apps/v1
kind: Deployment
metadata:
  name: component-repository
  namespace: oih-dev-ns
  labels:
    app: component-repository
spec:
  replicas: 1
  selector:
    matchLabels:
      app: component-repository
  template:
    metadata:
      name: component-repository
      labels:
        app: component-repository
    spec:
      restartPolicy: Always
      terminationGracePeriodSeconds: 30
      containers:
      - name: component-repository
        image: node:12-alpine
        command: ["/bin/sh"]
        args: ["-c", "yarn install --non-interactive && yarn start:container"]
        workingDir: /usr/src/app/
        env:
        - name: MONGODB_URI
          valueFrom:
            secretKeyRef:
              name: shared-secret
              key: componentRepoMongourl
        - name: PORT
          value: "1234"
        - name: RABBITMQ_URI
          value: >-
            amqp://guest:guest@rabbitmq-service.oih-dev-ns.svc.cluster.local
        - name: NODE_ENV
          value: development
        - name: IAM_TOKEN
          valueFrom:
            secretKeyRef:
              name: shared-secret
              key: iamtoken
        - name: LOG_LEVEL
          value: info
        - name: "INTROSPECT_ENDPOINT_BASIC"
          value: "http://iam.oih-dev-ns.svc.cluster.local:3099/api/v1/tokens/introspect"
        - name: CORS_ORIGIN_WHITELIST
          value: "localoih.com,http://web-ui.localoih.com,http://localhost:3000"
        volumeMounts:
        - name: code
          mountPath: /usr/src/app
          subPath: services/component-repository
        livenessProbe:
          httpGet:
            port: 1234
            path: /healthcheck
        readinessProbe:
          httpGet:
            port: 1234
            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
