> [!WARNING]
>
> **Preview**
>
>
> This feature is
>
> subject to the "Pre-GA Offerings Terms" in the General Service Terms section of the
> [Service Specific
> Terms](https://docs.cloud.google.com/terms/service-terms#1).
>
> Pre-GA features are available "as is" and might have limited support.
>
> For more information, see the
> [launch stage descriptions](https://cloud.google.com/products/#product-launch-stages).
>
>
> For information about access to this release, see the [access
> request page](https://forms.gle/zxuHekMtV67Bw9Av9).

## Spec schema

PgBouncer Spec defines the selected state of PgBouncer.

```yaml
PgBouncer:
  metadata:
    name: string
  spec:
    accessMode: string
    allowSuperUserAccess: boolean
    dbclusterRef: string
    port: integer
    serverTLS:
      certSecret:
        name: string
```

| Field Type Required or optional | Description |
|---|---|
| `name` ||
| `string` *Required* | Name of the PgBouncer resource. |
| `accessMode` ||
| `string` *Optional* | Defines `rw` (read-write) or `ro` (read-only) access modes for PgBouncer connections. The default value is `rw`. |
| `allowSuperUserAccess` ||
| `boolean` *Optional* | AllowSuperUserAccess can be set to true or false. |
| `dbclusterRef` ||
| `string` *Required* | DBClusterRef is the DBCluster name that PgBouncer pools the connections for. You must create the PgBouncer object in the same namespace as the DBCluster that it references. This field is required for PgBouncer connection pooling. |
| `port` ||
| `integer` *Optional* | Specifies the port on which PgBouncer listens for incoming connections. The default value is `6432`. |
| `serverTLS` ||
| `object` *Optional* | ServerTLSSpec defines the certificate secret for encrypted communication used by PgBouncer to connect to the database cluster to fetch authentication credentials. |
| `serverTLS.certSecret` ||
| `object` *Optional* | CertSecret references the certificate secret within the same namespace. The secret must contain entries `ca.crt` (CA certificate), `tls.key` (private key), and `tls.crt` (leaf certificate). The values within this secret are used to populate the `server_tls_ca_file`, `server_tls_cert_file`, and `server_tls_key_file` configs in `pgbouncer.ini` file. The CA certificate must match the CA that signed the database cluster's leaf certificate. The leaf certificate must contain the CommonName `"alloydbpgbouncer"`. |
| `serverTLS.certSecret.name` ||
| `string` *Optional* | Name of the referent. |

## Status schema

PgBouncer Status defines the observed state of PgBouncer.

```yaml
endpoints: string
phase: string
```

| Field Type Required or optional | Description |
|---|---|
| `endpoints` ||
| `object` *Optional* | `endpoints` contains all the endpoints through which you can access this instance. |
| `endpoints.name` ||
| `string` *Required* | Name is the name of the endpoint---for example, `Read-Write`. |
| `endpoints.value` ||
| `string` *Required* | Value contains the endpoint information to connect and access the instance. |
| `phase` ||
| `string` *Required* | `phase` describes the state of PgBouncer Deployment. Values like `WaitingForDeploymentReady`, `Acquiring IP`, and `Ready` appear here. |