# cnpg-operator

CloudNativePG operator: runs PostgreSQL clusters declared as postgresql.cnpg.io resources

This page is generated from [`kix/packages/stable/cnpg-operator`](https://github.com/kix-run/kix/tree/main/kix/packages/stable/cnpg-operator).

| | |
| --- | --- |
| Stability | Stable |
| `package` value | `packages.cnpg-operator` |
| Default software version | `1.30.2` |
| Default aliases | `cnpgOperator` |

## Dependencies

Kix matches each dependency below to another package instance by instance name, alias, or role. To bind a specific instance, set [`deps.<name>`](/docs/reference/instances-and-composition/#deps) in your cluster definition. See [Declaring dependencies](/docs/reference/package-anatomy/#declaring-dependencies) for how required and optional dependencies work.

| Dependency | Requirement |
| --- | --- |
| `prometheus` | Optional |

## Options

### `env`

Extra operator environment variables from CloudNativePG's operator configuration, such as INSTANCES_ROLLOUT_DELAY or DRAIN_TAINTS. A value is a string, a `fieldRef`, or `kix.untrackedRef`. The variables the package sets or refuses fail with the reason.

- **Type:** ``attribute set of (null or string or env var source with `valueFrom`)``
- **Default:** `{ }`

### `image`

Operator image. Its major.minor must be the package's release. The operator also runs it as the init container of every PostgreSQL pod (OPERATOR_IMAGE_NAME).

- **Type:** `submodule`
- **Default:**

  ```nix
  {
    digest = "sha256:f96f6be3d81ec93819b443c665c575c609342fca840df90d4d87dae314a5b913";
    pullPolicy = "IfNotPresent";
    repository = "ghcr.io/cloudnative-pg/cloudnative-pg";
    tag = "1.30.2";
  }
  ```

### `image.digest`

Resolved manifest digest, `sha256:` followed by 64 hex characters. What will actually run. Null means not resolved.

- **Type:** `null or string`
- **Default:** the package's digest while `tag` is the package's tag, otherwise null

### `image.note`

Whatever a person wanted to say about this pin. Kix never reads it and a promotion never discards it. Declared here for the same reason as the three fields above: a pin carries its own record-keeping, and the option accepts the whole pin rather than a subset of it.

- **Type:** `null or string`
- **Default:** `null`

### `image.promotedBy`

Who resolved this pin, for the record. Null when unknown.

- **Type:** `null or string`
- **Default:** `null`

### `image.pullPolicy`

imagePullPolicy for containers using this image. Null leaves it to Kubernetes.

- **Type:** `null or string`
- **Default:** `"IfNotPresent"`

### `image.repository`

Image repository, registry host included.

- **Type:** `string`
- **Default:** `"ghcr.io/cloudnative-pg/cloudnative-pg"`

### `image.resolvedAt`

When this pin was resolved, RFC 3339. Null when unknown.

- **Type:** `null or string`
- **Default:** `null`

### `image.sourceRev`

Revision of the source the image was built from, when Kix built it. Null for upstream images.

- **Type:** `null or string`
- **Default:** `null`

### `image.tag`

Image tag. What was asked for.

- **Type:** `string`
- **Default:** `"1.30.2"`

### `metrics.enabled`

Enable metrics endpoint and monitoring resources (ServiceMonitor, PrometheusRules) when prometheus is available.

- **Type:** `boolean`
- **Default:** `true`

### `metrics.interval`

Scrape interval (e.g. "30s"). Null = use Prometheus default.

- **Type:** `null or string`
- **Default:** `null`

### `resources`

Container resource requests and limits. Each field keeps its default until set, and null removes a default.

- **Type:** `submodule`
- **Default:**

  ```nix
  {
    limits = {
      cpu = "1";
      memory = "200Mi";
    };
    requests = {
      cpu = "100m";
      memory = "100Mi";
    };
  }
  ```

### `resources.claims`

Dynamic resource claims the container uses. Null leaves it unset.

- **Type:** `null or (list of (submodule))`
- **Default:** `null`

### `resources.claims.*.name`

Name of an entry in the pod's `resourceClaims`.

- **Type:** `string`

### `resources.claims.*.request`

Request within the claim to use. Null uses the whole claim.

- **Type:** `null or string`
- **Default:** `null`

### `resources.limits`

Resource quantities by name.

- **Type:** `open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `{ }`

### `resources.limits.cpu`

The cpu quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `"1"`

### `resources.limits.ephemeral-storage`

The ephemeral-storage quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `null`

### `resources.limits.memory`

The memory quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `"200Mi"`

### `resources.requests`

Resource quantities by name.

- **Type:** `open submodule of attribute set of Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `{ }`

### `resources.requests.cpu`

The cpu quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `"100m"`

### `resources.requests.ephemeral-storage`

The ephemeral-storage quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `null`

### `resources.requests.memory`

The memory quantity. Null leaves it unset.

- **Type:** `null or Kubernetes quantity, such as "500m" or "1Gi" (a non-negative decimal or integer with an optional suffix m, k, M, G, T, P, E, Ki, Mi, Gi, Ti, Pi or Ei)`
- **Default:** `"100Mi"`

### `webhookCheck.image`

Image of the webhook-check Job. Its entrypoint must be kubectl.

- **Type:** `submodule`
- **Default:**

  ```nix
  {
    digest = "sha256:b7cab618e281b1ee7484e7b706a96e2135fbb6e072c2a573a7dab4e87d7f2385";
    pullPolicy = "IfNotPresent";
    repository = "registry.k8s.io/kubectl";
    tag = "v1.37.1";
  }
  ```

### `webhookCheck.image.digest`

Resolved manifest digest, `sha256:` followed by 64 hex characters. What will actually run. Null means not resolved.

- **Type:** `null or string`
- **Default:** the package's digest while `tag` is the package's tag, otherwise null

### `webhookCheck.image.note`

Whatever a person wanted to say about this pin. Kix never reads it and a promotion never discards it. Declared here for the same reason as the three fields above: a pin carries its own record-keeping, and the option accepts the whole pin rather than a subset of it.

- **Type:** `null or string`
- **Default:** `null`

### `webhookCheck.image.promotedBy`

Who resolved this pin, for the record. Null when unknown.

- **Type:** `null or string`
- **Default:** `null`

### `webhookCheck.image.pullPolicy`

imagePullPolicy for containers using this image. Null leaves it to Kubernetes.

- **Type:** `null or string`
- **Default:** `"IfNotPresent"`

### `webhookCheck.image.repository`

Image repository, registry host included.

- **Type:** `string`
- **Default:** `"registry.k8s.io/kubectl"`

### `webhookCheck.image.resolvedAt`

When this pin was resolved, RFC 3339. Null when unknown.

- **Type:** `null or string`
- **Default:** `null`

### `webhookCheck.image.sourceRev`

Revision of the source the image was built from, when Kix built it. Null for upstream images.

- **Type:** `null or string`
- **Default:** `null`

### `webhookCheck.image.tag`

Image tag. What was asked for.

- **Type:** `string`
- **Default:** `"v1.37.1"`