apiVersion: apps/v1
kind: Deployment
metadata:
  name: pgpool-deployment
  namespace: pentaho-postgres
  labels:
    app: pgpool
spec:
  replicas: 1
  selector:
    matchLabels:
      app: pgpool
  template:
    metadata:
      labels:
        app: pgpool
    spec:
      containers:
      - name: pgpool
        image: bitnami/pgpool:4
        ports:
        - containerPort: 5432
        env:
        - name: PGPOOL_BACKEND_NODES
          value: "0:pg-0:5432,1:pg-1:5432"
        - name: PGPOOL_SR_CHECK_USER
          value: "customuser"
        - name: PGPOOL_SR_CHECK_PASSWORD
          value: "custompassword"
        - name: PGPOOL_ENABLE_LDAP
          value: "no"
        - name: PGPOOL_POSTGRES_USERNAME
          value: "postgres"
        - name: PGPOOL_POSTGRES_PASSWORD
          value: "adminpassword"
        - name: PGPOOL_ADMIN_USERNAME
          value: "admin"
        - name: PGPOOL_ADMIN_PASSWORD
          value: "adminpassword"
        volumeMounts:
        - name: pgpool-config-volume
          mountPath: /opt/bitnami/pgpool/conf/pgpool.conf
          subPath: pgpool.conf
      volumes:
      - name: pgpool-config-volume
        configMap:
          name: pgpool-config

