---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: aqua-gateway
  name: aqua-gateway
spec:
  replicas: 1
  selector:
    matchLabels:
      app: aqua-gateway
  template:
    metadata:
      labels:
        app: aqua-gateway
      name: aqua-gateway
    spec:
      # To run Aqua components as a non-privileged account, comment out
      # spec.template.spec.containers.securityContext field as applicable,
      # and uncomment spec.template.spec.securityConext field:
      #securityContext:
      #  runAsUser: 11431
      #  runAsGroup: 11433
      #  fsGroup: 11433
      serviceAccount: aqua-sa
      restartPolicy: Always
      containers:
      - name: aqua-gateway
        image: registry.aquasec.com/gateway:4.6
        imagePullPolicy: IfNotPresent
        # To run Aqua components as a privileged account, uncomment
        # spec.template.spec.containers.securityContext field as applicable,
        # and comment out spec.template.spec.securityContext field:
        securityContext:
          privileged: true
        env:
        - name: AQUA_CONSOLE_SECURE_ADDRESS
          value: aqua-web:443
        - name: SCALOCK_GATEWAY_PUBLIC_IP
          value: aqua-gateway
        - name: SCALOCK_DBUSER
          value: postgres
        - name: SCALOCK_DBPASSWORD
          valueFrom:
            secretKeyRef:
              key: password
              name: aqua-db
        - name: SCALOCK_DBNAME
          value: scalock
        - name: SCALOCK_DBHOST
          value: aqua-db
        - name: SCALOCK_DBPORT
          value: "5432"
        - name: SCALOCK_AUDIT_DBUSER
          value: postgres
        - name: SCALOCK_AUDIT_DBPASSWORD
          valueFrom:
            secretKeyRef:
              key: password
              name: aqua-db
        - name: SCALOCK_AUDIT_DBNAME
          value: slk_audit
        - name: SCALOCK_AUDIT_DBHOST
          value: aqua-db
        - name: SCALOCK_AUDIT_DBPORT
          value: "5432"
        ports:
        - containerPort: 3622
          protocol: TCP
        - containerPort: 8443
          protocol: TCP
