2# Copyright © contributors to CloudNativePG, established as
3# CloudNativePG a Series of LF Projects, LLC.
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
9# http://www.apache.org/licenses/LICENSE-2.0
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
17# SPDX-License-Identifier: Apache-2.0
19# Default values for CloudNativePG.
20# This is a YAML-formatted file.
21# Please declare variables to be passed to your templates.
25 repository: cgr.dev/chainguard-private/cloudnative-pg
26 pullPolicy: IfNotPresent
27 # -- Overrides the image tag whose default is the chart appVersion.
28 tag: 1.30.2-r0@sha256:4a2fc14eba1f96f9f89bd2d924f1ecc306d0ffeb7845085212fccf84222cf6e8
35# -- Update strategy for the operator.
36# ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
45 # -- Specifies whether the CRDs should be created when installing the chart.
47# -- The webhook configuration.
57 initialDelaySeconds: 3
59 initialDelaySeconds: 3
63# Operator configuration.
65 # -- Specifies whether the secret should be created.
67 # -- The name of the configmap/secret to use.
68 name: cnpg-controller-manager-config
69 # -- Specifies whether it should be stored in a secret, instead of a configmap.
71 # -- This option determines if the operator is responsible for observing
72 # events across the entire Kubernetes cluster or if its focus should be
73 # narrowed down to the specific namespace within which it has been deployed.
74 # When `false`, webhook configurations and cluster-scoped RBAC objects are
75 # suffixed with the namespace, and webhooks only intercept the watched
76 # namespaces. Requires operator >= 1.30.0. See "Single namespace
77 # installation" in the README.
79 # -- The content of the configmap/secret, see
80 # https://cloudnative-pg.io/documentation/current/operator_conf/#available-options
81 # for all the available options.
83 # INHERITED_ANNOTATIONS: categories
84 # INHERITED_LABELS: environment, workload, app
85 # WATCH_NAMESPACE: namespace-a,namespace-b
87 # -- The maximum number of concurrent reconciles. Defaults to 10.
88 maxConcurrentReconciles: 10
89# -- Additional arguments to be added to the operator's args list.
91# -- Array containing extra environment variables which can be templated.
95# value: "{{ .Release.Name }}"
97# value: "mySpecialKey"
99# -- Array containing extra volumes to be added to the operator pod, which can be templated.
101# For example, to serve the metrics endpoint over TLS:
102# - name: metrics-certificates
104# secretName: "{{ .Release.Name }}-metrics-cert"
107# -- Array containing extra volume mounts to be added to the operator container, which can be templated.
108additionalVolumeMounts: []
109# For example, to serve the metrics endpoint over TLS, together with a
110# `METRICS_CERT_DIR` entry in `additionalEnv` pointing to the same path:
111# - name: metrics-certificates
112# mountPath: /run/secrets/cnpg.io/metrics
116 # -- Specifies whether the service account should be created.
118 # -- The name of the service account to use.
119 # If not set and create is true, a name is generated using the fullname template.
122 # -- Specifies whether ClusterRole and ClusterRoleBinding should be created.
124 # -- Aggregate ClusterRoles to Kubernetes default user-facing roles.
125 # Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles
126 aggregateClusterRoles: false
127# -- Annotations to be added to all other resources.
129# -- Annotations to be added to the pod.
131# -- Labels to be added to the pod.
133# -- Container Security Context.
134containerSecurityContext:
135 allowPrivilegeEscalation: false
136 readOnlyRootFilesystem: true
144# -- Security Context for the whole pod.
150# -- Priority indicates the importance of a Pod relative to other Pods.
154 # -- The name of the Webhook Service.
155 name: cnpg-webhook-service
156 # DO NOT CHANGE THE SERVICE NAME as it is currently used to generate the certificate
157 # and can not be configured
160 # -- Set the ip family policy to configure dual-stack see [Configure dual-stack](https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services)
162 # -- Sets the families that should be supported and the order in which they should be applied to ClusterIP as well. Can be IPv4 and/or IPv6.
165# If you want to specify resources, uncomment the following
166# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
176 # -- EmptyDir options for the scratch-data volume.
178# -- Nodeselector for the operator to be installed.
180# -- Topology Spread Constraints for the operator to be installed.
181topologySpreadConstraints: []
182# -- Tolerations for the operator to be installed.
184# -- Affinity for the operator to be installed.
187 # -- Specifies whether the monitoring should be enabled. Requires Prometheus Operator CRDs.
188 podMonitorEnabled: false
189 # -- Metrics relabel configurations to apply to samples before ingestion.
190 podMonitorMetricRelabelings: []
191 # -- Relabel configurations to apply to samples before scraping.
192 podMonitorRelabelings: []
193 # -- Additional labels for the podMonitor
194 podMonitorAdditionalLabels: {}
197 # enum: ["", http, https, HTTP, HTTPS]
199 # -- Scheme to use when scraping the metrics endpoint. Set it to `https` when
200 # TLS is enabled on the operator metrics server through `METRICS_CERT_DIR`.
202 # -- TLS configuration to use when scraping the metrics endpoint, which can be templated.
203 podMonitorTLSConfig: {}
207 # name: "{{ .Release.Name }}-metrics-cert"
212 # -- Allows overriding the namespace where the ConfigMap will be created, defaulting to the same one as the Release.
214 # -- The name of the ConfigMap containing the dashboard.
215 configMapName: "cnpg-grafana-dashboard"
216 # -- Label that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead.
217 sidecarLabel: "grafana_dashboard"
218 # -- Label value that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead.
219 sidecarLabelValue: "1"
220 # -- Labels that ConfigMaps should have to get configured in Grafana.
222 # -- Annotations that ConfigMaps can have to get configured in Grafana.
224# Default monitoring queries
225monitoringQueriesConfigMap:
226 # -- The name of the default monitoring configmap.
227 name: cnpg-default-monitoring
228 # -- A string representation of a YAML defining monitoring queries.
234 , sa.application_name
236 , COALESCE(sa.count, 0) AS total
237 , COALESCE(sa.max_tx_secs, 0) AS max_tx_duration_seconds
238 FROM ( VALUES ('active')
240 , ('idle in transaction')
241 , ('idle in transaction (aborted)')
242 , ('fastpath function call')
249 , COALESCE(application_name, '') AS application_name
250 , pg_catalog.count(*)
251 , COALESCE(EXTRACT (EPOCH FROM (pg_catalog.max(pg_catalog.now() OPERATOR(pg_catalog.-) xact_start))), 0) AS max_tx_secs
252 FROM pg_catalog.pg_stat_activity
253 GROUP BY datname, state, usename, application_name
254 ) sa ON states.state OPERATOR(pg_catalog.=) sa.state
255 WHERE sa.usename IS NOT NULL
259 description: "Name of the database"
262 description: "Name of the user"
265 description: "Name of the application"
268 description: "State of the backend"
271 description: "Number of backends"
272 - max_tx_duration_seconds:
274 description: "Maximum duration of a transaction in seconds"
278 SELECT pg_catalog.count(*) AS total
279 FROM pg_catalog.pg_locks blocked_locks
280 JOIN pg_catalog.pg_locks blocking_locks
281 ON blocking_locks.locktype OPERATOR(pg_catalog.=) blocked_locks.locktype
282 AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database
283 AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation
284 AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page
285 AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple
286 AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid
287 AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid
288 AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid
289 AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid
290 AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid
291 AND blocking_locks.pid OPERATOR(pg_catalog.<>) blocked_locks.pid
292 JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid OPERATOR(pg_catalog.=) blocking_locks.pid
293 WHERE NOT blocked_locks.granted
297 description: "Total number of backends that are currently waiting on other queries"
302 , pg_catalog.pg_database_size(datname) AS size_bytes
303 , pg_catalog.age(datfrozenxid) AS xid_age
304 , pg_catalog.mxid_age(datminmxid) AS mxid_age
305 FROM pg_catalog.pg_database
310 description: "Name of the database"
313 description: "Disk space used by the database"
316 description: "Number of transactions from the frozen XID to the current one"
319 description: "Number of multiple transactions (Multixact) from the frozen XID to the current one"
323 SELECT EXTRACT(EPOCH FROM pg_postmaster_start_time) AS start_time
324 FROM pg_catalog.pg_postmaster_start_time()
328 description: "Time at which postgres started (based on epoch)"
333 NOT pg_catalog.pg_is_in_recovery()
334 OR pg_catalog.pg_last_wal_receive_lsn() OPERATOR(pg_catalog.=) pg_catalog.pg_last_wal_replay_lsn())
337 EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) pg_catalog.pg_last_xact_replay_timestamp())))
339 pg_catalog.pg_is_in_recovery() AS in_recovery,
340 EXISTS (TABLE pg_catalog.pg_stat_wal_receiver) AS is_wal_receiver_up,
341 (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS streaming_replicas
345 description: "Replication lag behind primary in seconds"
348 description: "Whether the instance is in recovery"
349 - is_wal_receiver_up:
351 description: "Whether the instance wal_receiver is up"
352 - streaming_replicas:
354 description: "Number of streaming replicas connected to the instance"
356 pg_replication_slots:
362 (CASE pg_catalog.pg_is_in_recovery()
363 WHEN TRUE THEN pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_last_wal_receive_lsn(), restart_lsn)
364 ELSE pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), restart_lsn)
365 END) as pg_wal_lsn_diff
366 FROM pg_catalog.pg_replication_slots
371 description: "Name of the replication slot"
374 description: "Type of the replication slot"
377 description: "Name of the database"
380 description: "Flag indicating whether the slot is active"
383 description: "Replication lag in bytes"
387 SELECT archived_count
389 , COALESCE(EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) last_archived_time)), -1) AS seconds_since_last_archival
390 , COALESCE(EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) last_failed_time)), -1) AS seconds_since_last_failure
391 , COALESCE(EXTRACT(EPOCH FROM last_archived_time), -1) AS last_archived_time
392 , COALESCE(EXTRACT(EPOCH FROM last_failed_time), -1) AS last_failed_time
393 , COALESCE(CAST(CAST('x' OPERATOR(pg_catalog.||) pg_catalog.right(pg_catalog.split_part(last_archived_wal, '.', 1), 16) AS pg_catalog.bit(64)) AS pg_catalog.int8), -1) AS last_archived_wal_start_lsn
394 , COALESCE(CAST(CAST('x' OPERATOR(pg_catalog.||) pg_catalog.right(pg_catalog.split_part(last_failed_wal, '.', 1), 16) AS pg_catalog.bit(64)) AS pg_catalog.int8), -1) AS last_failed_wal_start_lsn
395 , EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time
396 FROM pg_catalog.pg_stat_archiver
398 SELECT NOT pg_catalog.pg_is_in_recovery()
399 OR pg_catalog.current_setting('archive_mode') OPERATOR(pg_catalog.=) 'always'
403 description: "Number of WAL files that have been successfully archived"
406 description: "Number of failed attempts for archiving WAL files"
407 - seconds_since_last_archival:
409 description: "Seconds since the last successful archival operation"
410 - seconds_since_last_failure:
412 description: "Seconds since the last failed archival operation"
413 - last_archived_time:
415 description: "Epoch of the last time WAL archiving succeeded"
418 description: "Epoch of the last time WAL archiving failed"
419 - last_archived_wal_start_lsn:
421 description: "Archived WAL start LSN"
422 - last_failed_wal_start_lsn:
424 description: "Last failed WAL LSN"
427 description: "Time at which these statistics were last reset"
430 runonserver: "<17.0.0"
432 SELECT checkpoints_timed
434 , checkpoint_write_time
435 , checkpoint_sync_time
440 , buffers_backend_fsync
442 FROM pg_catalog.pg_stat_bgwriter
446 description: "Number of scheduled checkpoints that have been performed"
449 description: "Number of requested checkpoints that have been performed"
450 - checkpoint_write_time:
452 description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
453 - checkpoint_sync_time:
455 description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
456 - buffers_checkpoint:
458 description: "Number of buffers written during checkpoints"
461 description: "Number of buffers written by the background writer"
464 description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
467 description: "Number of buffers written directly by a backend"
468 - buffers_backend_fsync:
470 description: "Number of times a backend had to execute its own fsync call (normally the background writer handles those even when the backend does its own write)"
473 description: "Number of buffers allocated"
476 runonserver: ">=17.0.0"
477 name: pg_stat_bgwriter
482 , EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time
483 FROM pg_catalog.pg_stat_bgwriter
487 description: "Number of buffers written by the background writer"
490 description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
493 description: "Number of buffers allocated"
496 description: "Time at which these statistics were last reset"
498 pg_stat_checkpointer:
499 runonserver: ">=17.0.0"
501 SELECT num_timed AS checkpoints_timed
502 , num_requested AS checkpoints_req
503 , restartpoints_timed
509 , EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time
510 FROM pg_catalog.pg_stat_checkpointer
514 description: "Number of scheduled checkpoints that have been performed"
517 description: "Number of requested checkpoints that have been performed"
518 - restartpoints_timed:
520 description: "Number of scheduled restartpoints due to timeout or after a failed attempt to perform it"
523 description: "Number of requested restartpoints that have been performed"
524 - restartpoints_done:
526 description: "Number of restartpoints that have been performed"
529 description: "Total amount of time that has been spent in the portion of processing checkpoints and restartpoints where files are written to disk, in milliseconds"
532 description: "Total amount of time that has been spent in the portion of processing checkpoints and restartpoints where files are synchronized to disk, in milliseconds"
535 description: "Number of buffers written during checkpoints and restartpoints"
538 description: "Time at which these statistics were last reset"
558 FROM pg_catalog.pg_stat_database
562 description: "Name of this database"
565 description: "Number of transactions in this database that have been committed"
568 description: "Number of transactions in this database that have been rolled back"
571 description: "Number of disk blocks read in this database"
574 description: "Number of times disk blocks were found already in the buffer cache, so that a read was not necessary (this only includes hits in the PostgreSQL buffer cache, not the operating system's file system cache)"
577 description: "Number of rows returned by queries in this database"
580 description: "Number of rows fetched by queries in this database"
583 description: "Number of rows inserted by queries in this database"
586 description: "Number of rows updated by queries in this database"
589 description: "Number of rows deleted by queries in this database"
592 description: "Number of queries canceled due to conflicts with recovery in this database"
595 description: "Number of temporary files created by queries in this database"
598 description: "Total amount of data written to temporary files by queries in this database"
601 description: "Number of deadlocks detected in this database"
604 description: "Time spent reading data file blocks by backends in this database, in milliseconds"
607 description: "Time spent writing data file blocks by backends in this database, in milliseconds"
613 , COALESCE(application_name, '') AS application_name
614 , COALESCE(client_addr::text, '') AS client_addr
615 , COALESCE(client_port::text, '') AS client_port
616 , EXTRACT(EPOCH FROM backend_start) AS backend_start
617 , COALESCE(pg_catalog.age(backend_xmin), 0) AS backend_xmin_age
618 , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), sent_lsn) AS sent_diff_bytes
619 , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), write_lsn) AS write_diff_bytes
620 , pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), flush_lsn) AS flush_diff_bytes
621 , COALESCE(pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), replay_lsn),0) AS replay_diff_bytes
622 , COALESCE((EXTRACT(EPOCH FROM write_lag)),0)::float AS write_lag_seconds
623 , COALESCE((EXTRACT(EPOCH FROM flush_lag)),0)::float AS flush_lag_seconds
624 , COALESCE((EXTRACT(EPOCH FROM replay_lag)),0)::float AS replay_lag_seconds
625 FROM pg_catalog.pg_stat_replication
629 description: "Name of the replication user"
632 description: "Name of the application"
635 description: "Client IP address"
638 description: "Client TCP port"
641 description: "Time when this process was started"
644 description: "The age of this standby's xmin horizon"
647 description: "Difference in bytes from the last write-ahead log location sent on this connection"
650 description: "Difference in bytes from the last write-ahead log location written to disk by this standby server"
653 description: "Difference in bytes from the last write-ahead log location flushed to disk by this standby server"
656 description: "Difference in bytes from the last write-ahead log location replayed into the database on this standby server"
659 description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it"
662 description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it"
663 - replay_lag_seconds:
665 description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it"
670 CASE setting WHEN 'on' THEN '1' WHEN 'off' THEN '0' ELSE setting END AS setting
671 FROM pg_catalog.pg_settings
672 WHERE vartype IN ('integer', 'real', 'bool')
677 description: "Name of the setting"
680 description: "Setting value"
685 pg_catalog.current_database() as datname,
690 WHEN default_version OPERATOR(pg_catalog.=) installed_version THEN 0
692 END AS update_available
693 FROM pg_catalog.pg_available_extensions
694 WHERE installed_version IS NOT NULL
698 description: "Name of the database"
701 description: "Extension name"
704 description: "Default version"
707 description: "Installed version"
710 description: "An update is available"