#---
#apiVersion: v1
#kind: PersistentVolumeClaim
#metadata:
#  name: aqua-scanner-pvc
#  namespace: aqua
#spec:
#  accessModes:
#    - ReadWriteOnce
#  resources:
#    requests:
#      storage: 20Gi
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: aqua-scanner
  namespace: aqua
  labels:
    app: aqua-scanner
spec:
  replicas: 1
  template:
    metadata:
      labels:
        app: aqua-scanner
    spec:
      serviceAccountName: aqua-sa
      securityContext:
        runAsUser: 11431
        runAsGroup: 11433
        fsGroup: 11433
      containers:
        - name: kube-scanner
          image: registry.aquasec.com/scanner:6.5
          imagePullPolicy: Always
          command: ["/bin/sh"]
          args: ["-c", "/opt/aquasec/scannercli daemon --host https://${AQUA_SERVER} --user ${AQUA_SCANNER_USERNAME} --password ${AQUA_SCANNER_PASSWORD} --no-verify"]
          env:
            - name: AQUA_SCANNER_LOGICAL_NAME
              valueFrom:
                fieldRef:
                  fieldPath: metadata.name
          envFrom:
          - secretRef:
              name: aqua-scanner
          - configMapRef:
              name: aqua-scanner-config
          volumeMounts:
            #- name: "docker-socket-mount"
            #  mountPath: "/var/run/docker.sock"
            - name: "ssl-certs"
              mountPath: "/etc/ssl/certs"
              readOnly: true
#            - mountPath: /opt/aquascans
#              name: aquascans
#            - mountPath: /opt/aquasec/ssl
#              name: aqua-grpc-scanner
#              readOnly: true
      volumes:
        #- name: "docker-socket-mount"
        #  hostPath:
        #    path: "/var/run/docker.sock"
        - name: "ssl-certs"
          secret:
            secretName: "aqua-scanner"
            items:
            - key: aqua-web-root-cert
              path: aqua-ssl.crt
#        - name: aquascans
#          persistentVolumeClaim:
#            claimName: aqua-scanner-pvc
#        - name: aqua-grpc-scanner
#          secret:
#            secretName: aqua-grpc-scanner
#            items:
#            - key: aqua_scanner.crt
#              path: cert.pem
#            - key: aqua_scanner.key
#              path: key.pem
#            - key: rootCA.crt
#              path: ca.pem
      imagePullSecrets:
        - name: aqua-registry
  selector:
    matchLabels:
      app: aqua-scanner
