apiVersion: batch/v1
kind: Job
metadata:
   namespace: vulnscan
   generateName: vulnscan-podreader-
   labels:
      app: vulnscan-podreader
spec:
  ttlSecondsAfterFinished: 180
  template:
     metadata:
        labels:
           app: vulnscan-podreader
     spec:
       restartPolicy: OnFailure
       serviceAccountName: vulnscan-serviceaccount
       containers:
       - name: podreader
         image: davideshay/vulnscan-podreader:latest
         env:
         - name: DB_HOST
           value: 'postgres.postgres'
         - name: DB_NAME
           value: 'vulnscan'
         - name: DB_USER
           valueFrom:
             secretKeyRef:
               name: vulnscan-db-auth
               key: DB_USER
         - name: DB_PASSWORD
           valueFrom:
             secretKeyRef:
               name: vulnscan-db-auth
               key: DB_PASSWORD
         - name: EXPIRE_CONTAINERS
           value: 'true'
         - name: EXPIRE_DAYS
           value: "5"
         tty: true
         imagePullPolicy: Always
