---

apiVersion: apps/v1
kind: Deployment
metadata:
  name: aqua-db
  labels:
    app: aqua-db
spec:
  replicas: 1
  selector:
    matchLabels:
      app: aqua-db
  template:
    metadata:
      labels:
        app: aqua-db
      name: aqua-db
    spec:
      serviceAccount: aqua-sa
      restartPolicy: Always
      containers:
      - name: aqua-db
        image: registry.aquasec.com/database:5.0
        imagePullPolicy: IfNotPresent
        env:
        - name: POSTGRES_PASSWORD
          valueFrom:
            secretKeyRef:
              key: password
              name: aqua-db
        volumeMounts:
        - mountPath: /var/lib/postgresql/data
          name: postgres-db
        ports:
        - containerPort: 5432
          protocol: TCP
      volumes:
      - name: postgres-db
        persistentVolumeClaim:
          claimName: aqua-db-pvc