apiVersion: apps/v1
kind: Deployment
metadata:
  name: image-scanner
  labels:
    app: image-scanner
    module: image-scanner
    version: '0.3.4'
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 1
  minReadySeconds: 5
  selector:
    matchLabels:
      app: image-scanner
  template:
    metadata:
      labels:
        app: image-scanner
        module: image-scanner
        version: '0.3.4'
    spec:
      containers:
      - name: image-scanner
        image: deepnetwork/image-scanner-web:0.3.4
        imagePullPolicy: Always
        resources:
          requests:
            memory: "200M"
            cpu: "500m"
          limits:
            memory: "500M"
            cpu: "1000m"
        readinessProbe:
          httpGet:
            path: /health/readiness
            port: 8080
          initialDelaySeconds: 20
          periodSeconds: 10
          timeoutSeconds: 1
          successThreshold: 1
          failureThreshold: 5
        livenessProbe:
          httpGet:
            path: /health/liveness
            port: 8080
          initialDelaySeconds: 60
          periodSeconds: 10
          timeoutSeconds: 1
          successThreshold: 1
          failureThreshold: 3
        ports:
          - containerPort: 8080
            name: main-http
        securityContext:
          runAsUser: 10001
          runAsGroup: 10001
          allowPrivilegeEscalation: false
          runAsNonRoot: true
          readOnlyRootFilesystem: false
        volumeMounts:
          - name: image-scanner-parameters-volume
            mountPath: /image-scanner
          - name: storage-volume
            mountPath: "/app/.cache"
        env:
          - name: IMAGE_SCANNER_CONFIG_FILE_PATH
            value: "/image-scanner/image-scanner-parameters.yaml"
      securityContext:
        fsGroup: 10001
      volumes:
        - name: image-scanner-parameters-volume
          configMap:
            name: image-scanner-parameters-configmap
            defaultMode: 0777
        - name: storage-volume
          persistentVolumeClaim:
            claimName: image-scanner-storage