Moved PSQL to NG
This commit is contained in:
1 parent
2676ecef5d
commit
bcfbfcd362
35 files changed
+32682
No files matched your search
@@ -0,0 +1,21 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: cnpg
|
||||
namespace: argocd
|
||||
spec:
|
||||
project: core
|
||||
destination:
|
||||
namespace: cnpg-system
|
||||
server: https://kubernetes.default.svc
|
||||
source:
|
||||
repoURL: https://gt.hexor.cy/ab/homelab.git
|
||||
targetRevision: k8s-ng
|
||||
path: k8s-ng/cnpg
|
||||
syncPolicy:
|
||||
automated:
|
||||
selfHeal: true
|
||||
prune: true
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
- ServerSideApply=true
|
||||
@@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
@@ -0,0 +1,6 @@
|
||||
dependencies:
|
||||
- name: cluster
|
||||
repository: https://cloudnative-pg.github.io/grafana-dashboards
|
||||
version: 0.0.5
|
||||
digest: sha256:92acaa7742cad61339d69da604eda609e3d5e02f05efa224f5a58f2b845cd2b4
|
||||
generated: "2026-01-19T21:05:18.955160552+02:00"
|
||||
@@ -0,0 +1,26 @@
|
||||
apiVersion: v2
|
||||
appVersion: 1.30.1
|
||||
dependencies:
|
||||
- alias: monitoring
|
||||
condition: monitoring.grafanaDashboard.create
|
||||
name: cluster
|
||||
repository: https://cloudnative-pg.github.io/grafana-dashboards
|
||||
version: "0.0"
|
||||
description: CloudNativePG Operator Helm Chart
|
||||
home: https://cloudnative-pg.io
|
||||
icon: https://raw.githubusercontent.com/cloudnative-pg/artwork/main/cloudnativepg-logo.svg
|
||||
keywords:
|
||||
- operator
|
||||
- controller
|
||||
- postgresql
|
||||
- postgres
|
||||
- database
|
||||
kubeVersion: '>=1.29.0-0'
|
||||
maintainers:
|
||||
- email: p.scorsolini@gmail.com
|
||||
name: phisco
|
||||
name: cloudnative-pg
|
||||
sources:
|
||||
- https://github.com/cloudnative-pg/charts
|
||||
type: application
|
||||
version: 0.29.1
|
||||
@@ -0,0 +1,202 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
@@ -0,0 +1,189 @@
|
||||
# cloudnative-pg
|
||||
|
||||
  
|
||||
|
||||
CloudNativePG Operator Helm Chart
|
||||
|
||||
**Homepage:** <https://cloudnative-pg.io>
|
||||
|
||||
About this chart
|
||||
----------------
|
||||
|
||||
Helm chart to install the [CloudNativePG operator](https://cloudnative-pg.io), originally created and sponsored
|
||||
by [EDB](https://www.enterprisedb.com/) to manage PostgreSQL workloads on any supported Kubernetes cluster
|
||||
running in private, public, or hybrid cloud environments.
|
||||
|
||||
**NOTE**: this chart supports only the latest point release of the CloudNativePG operator.
|
||||
|
||||
The chart installs only the operator (controller manager, webhooks, RBAC and CRDs). To provision a PostgreSQL
|
||||
`Cluster` resource, use the companion [`cluster`](https://github.com/cloudnative-pg/charts/tree/main/charts/cluster) chart
|
||||
(see the [Cluster chart README](https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/README.md) for details)
|
||||
or apply your own `Cluster` manifest.
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
### Add the chart repository
|
||||
|
||||
```console
|
||||
helm repo add cnpg https://cloudnative-pg.github.io/charts
|
||||
helm repo update
|
||||
```
|
||||
|
||||
### Install the operator
|
||||
|
||||
```console
|
||||
helm upgrade --install cnpg \
|
||||
--namespace cnpg-system \
|
||||
--create-namespace \
|
||||
cnpg/cloudnative-pg
|
||||
```
|
||||
|
||||
### Install with custom parameters
|
||||
|
||||
You can override individual chart values from the command line with `--set`.
|
||||
For example, to enable the Prometheus `PodMonitor`:
|
||||
|
||||
```console
|
||||
helm upgrade --install cnpg \
|
||||
--namespace cnpg-system \
|
||||
--create-namespace \
|
||||
--set monitoring.podMonitorEnabled=true \
|
||||
cnpg/cloudnative-pg
|
||||
```
|
||||
|
||||
> **Note**
|
||||
> Enabling the `PodMonitor` requires the Prometheus Operator CRDs to be installed in the cluster.
|
||||
> Without them the install fails with `no matches for kind "PodMonitor"`.
|
||||
|
||||
See the [Values](#values) section below for the full list of configurable parameters.
|
||||
|
||||
### Verify the installation
|
||||
|
||||
```console
|
||||
kubectl -n cnpg-system get deploy
|
||||
kubectl -n cnpg-system rollout status deploy/cnpg-cloudnative-pg
|
||||
```
|
||||
|
||||
Single namespace installation
|
||||
-----------------------------
|
||||
|
||||
It is possible to limit the operator's capabilities to solely the namespace in which it has been installed.
|
||||
With this restriction, the cluster-level permissions required by the operator will be substantially reduced,
|
||||
and the security profile of the installation will be enhanced.
|
||||
|
||||
You can install the operator in single-namespace mode by setting the `config.clusterWide` flag to `false`,
|
||||
as in the following example:
|
||||
|
||||
```console
|
||||
helm upgrade --install cnpg \
|
||||
--namespace cnpg-system \
|
||||
--create-namespace \
|
||||
--set config.clusterWide=false \
|
||||
cnpg/cloudnative-pg
|
||||
```
|
||||
|
||||
**IMPORTANT**: the single-namespace installation mode can't coexist with the cluster-wide operator. Otherwise
|
||||
there would be collisions when managing the resources in the namespace watched by the single-namespace
|
||||
operator. It is up to the user to ensure there is no collision between operators.
|
||||
|
||||
Uninstalling
|
||||
------------
|
||||
|
||||
```console
|
||||
helm uninstall cnpg --namespace cnpg-system
|
||||
```
|
||||
|
||||
> **Warning**
|
||||
> Uninstalling the chart does not remove the CRDs. Deleting them cascade-deletes every `Cluster` (and other
|
||||
> CloudNativePG) resource across the whole cluster, together with the PostgreSQL data stored in their PVCs.
|
||||
> This is irreversible, so only delete the CRDs if you intend to permanently remove all managed databases.
|
||||
|
||||
## Source Code
|
||||
|
||||
* <https://github.com/cloudnative-pg/charts>
|
||||
|
||||
## Requirements
|
||||
|
||||
Kubernetes: `>=1.29.0-0`
|
||||
|
||||
| Repository | Name | Version |
|
||||
|------------|------|---------|
|
||||
| https://cloudnative-pg.github.io/grafana-dashboards | monitoring(cluster) | 0.0 |
|
||||
|
||||
## Values
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
|-----|------|---------|-------------|
|
||||
| additionalArgs | list | `[]` | Additional arguments to be added to the operator's args list. |
|
||||
| additionalEnv | list | `[]` | Array containing extra environment variables which can be templated. |
|
||||
| affinity | object | `{}` | Affinity for the operator to be installed. |
|
||||
| commonAnnotations | object | `{}` | Annotations to be added to all other resources. |
|
||||
| config.clusterWide | bool | `true` | This option determines if the operator is responsible for observing events across the entire Kubernetes cluster or if its focus should be narrowed down to the specific namespace within which it has been deployed. |
|
||||
| config.create | bool | `true` | Specifies whether the secret should be created. |
|
||||
| config.data | object | `{}` | The content of the configmap/secret, see https://cloudnative-pg.io/documentation/current/operator_conf/#available-options for all the available options. |
|
||||
| config.maxConcurrentReconciles | int | `10` | The maximum number of concurrent reconciles. Defaults to 10. |
|
||||
| config.name | string | `"cnpg-controller-manager-config"` | The name of the configmap/secret to use. |
|
||||
| config.secret | bool | `false` | Specifies whether it should be stored in a secret, instead of a configmap. |
|
||||
| containerSecurityContext | object | `{"allowPrivilegeEscalation":false,"capabilities":{"drop":["ALL"]},"readOnlyRootFilesystem":true,"runAsGroup":10001,"runAsUser":10001,"seccompProfile":{"type":"RuntimeDefault"}}` | Container Security Context. |
|
||||
| crds.create | bool | `true` | Specifies whether the CRDs should be created when installing the chart. |
|
||||
| dnsPolicy | string | `""` | |
|
||||
| fullnameOverride | string | `""` | |
|
||||
| hostNetwork | bool | `false` | |
|
||||
| image.pullPolicy | string | `"IfNotPresent"` | |
|
||||
| image.repository | string | `"ghcr.io/cloudnative-pg/cloudnative-pg"` | |
|
||||
| image.tag | string | `""` | Overrides the image tag whose default is the chart appVersion. |
|
||||
| imagePullSecrets | list | `[]` | |
|
||||
| monitoring.grafanaDashboard.annotations | object | `{}` | Annotations that ConfigMaps can have to get configured in Grafana. |
|
||||
| monitoring.grafanaDashboard.configMapName | string | `"cnpg-grafana-dashboard"` | The name of the ConfigMap containing the dashboard. |
|
||||
| monitoring.grafanaDashboard.create | bool | `false` | |
|
||||
| monitoring.grafanaDashboard.labels | object | `{}` | Labels that ConfigMaps should have to get configured in Grafana. |
|
||||
| monitoring.grafanaDashboard.namespace | string | `""` | Allows overriding the namespace where the ConfigMap will be created, defaulting to the same one as the Release. |
|
||||
| monitoring.grafanaDashboard.sidecarLabel | string | `"grafana_dashboard"` | Label that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead. |
|
||||
| monitoring.grafanaDashboard.sidecarLabelValue | string | `"1"` | Label value that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead. |
|
||||
| monitoring.podMonitorAdditionalLabels | object | `{}` | Additional labels for the podMonitor |
|
||||
| monitoring.podMonitorEnabled | bool | `false` | Specifies whether the monitoring should be enabled. Requires Prometheus Operator CRDs. |
|
||||
| monitoring.podMonitorMetricRelabelings | list | `[]` | Metrics relabel configurations to apply to samples before ingestion. |
|
||||
| monitoring.podMonitorRelabelings | list | `[]` | Relabel configurations to apply to samples before scraping. |
|
||||
| monitoringQueriesConfigMap.name | string | `"cnpg-default-monitoring"` | The name of the default monitoring configmap. |
|
||||
| monitoringQueriesConfigMap.queries | string | `"backends:\n query: |\n SELECT sa.datname\n , sa.usename\n , sa.application_name\n , states.state\n , COALESCE(sa.count, 0) AS total\n , COALESCE(sa.max_tx_secs, 0) AS max_tx_duration_seconds\n FROM ( VALUES ('active')\n , ('idle')\n , ('idle in transaction')\n , ('idle in transaction (aborted)')\n , ('fastpath function call')\n , ('disabled')\n ) AS states(state)\n LEFT JOIN (\n SELECT datname\n , state\n , usename\n , COALESCE(application_name, '') AS application_name\n , pg_catalog.count(*)\n , COALESCE(EXTRACT (EPOCH FROM (pg_catalog.max(pg_catalog.now() OPERATOR(pg_catalog.-) xact_start))), 0) AS max_tx_secs\n FROM pg_catalog.pg_stat_activity\n GROUP BY datname, state, usename, application_name\n ) sa ON states.state OPERATOR(pg_catalog.=) sa.state\n WHERE sa.usename IS NOT NULL\n metrics:\n - datname:\n usage: \"LABEL\"\n description: \"Name of the database\"\n - usename:\n usage: \"LABEL\"\n description: \"Name of the user\"\n - application_name:\n usage: \"LABEL\"\n description: \"Name of the application\"\n - state:\n usage: \"LABEL\"\n description: \"State of the backend\"\n - total:\n usage: \"GAUGE\"\n description: \"Number of backends\"\n - max_tx_duration_seconds:\n usage: \"GAUGE\"\n description: \"Maximum duration of a transaction in seconds\"\n\nbackends_waiting:\n query: |\n SELECT pg_catalog.count(*) AS total\n FROM pg_catalog.pg_locks blocked_locks\n JOIN pg_catalog.pg_locks blocking_locks\n ON blocking_locks.locktype OPERATOR(pg_catalog.=) blocked_locks.locktype\n AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database\n AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation\n AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page\n AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple\n AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid\n AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid\n AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid\n AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid\n AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid\n AND blocking_locks.pid OPERATOR(pg_catalog.<>) blocked_locks.pid\n JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid OPERATOR(pg_catalog.=) blocking_locks.pid\n WHERE NOT blocked_locks.granted\n metrics:\n - total:\n usage: \"GAUGE\"\n description: \"Total number of backends that are currently waiting on other queries\"\n\npg_database:\n query: |\n SELECT datname\n , pg_catalog.pg_database_size(datname) AS size_bytes\n , pg_catalog.age(datfrozenxid) AS xid_age\n , pg_catalog.mxid_age(datminmxid) AS mxid_age\n FROM pg_catalog.pg_database\n WHERE datallowconn\n metrics:\n - datname:\n usage: \"LABEL\"\n description: \"Name of the database\"\n - size_bytes:\n usage: \"GAUGE\"\n description: \"Disk space used by the database\"\n - xid_age:\n usage: \"GAUGE\"\n description: \"Number of transactions from the frozen XID to the current one\"\n - mxid_age:\n usage: \"GAUGE\"\n description: \"Number of multiple transactions (Multixact) from the frozen XID to the current one\"\n\npg_postmaster:\n query: |\n SELECT EXTRACT(EPOCH FROM pg_postmaster_start_time) AS start_time\n FROM pg_catalog.pg_postmaster_start_time()\n metrics:\n - start_time:\n usage: \"GAUGE\"\n description: \"Time at which postgres started (based on epoch)\"\n\npg_replication:\n query: |\n SELECT CASE WHEN (\n NOT pg_catalog.pg_is_in_recovery()\n OR pg_catalog.pg_last_wal_receive_lsn() OPERATOR(pg_catalog.=) pg_catalog.pg_last_wal_replay_lsn())\n THEN 0\n ELSE GREATEST (0,\n EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) pg_catalog.pg_last_xact_replay_timestamp())))\n END AS lag,\n pg_catalog.pg_is_in_recovery() AS in_recovery,\n EXISTS (TABLE pg_catalog.pg_stat_wal_receiver) AS is_wal_receiver_up,\n (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS streaming_replicas\n metrics:\n - lag:\n usage: \"GAUGE\"\n description: \"Replication lag behind primary in seconds\"\n - in_recovery:\n usage: \"GAUGE\"\n description: \"Whether the instance is in recovery\"\n - is_wal_receiver_up:\n usage: \"GAUGE\"\n description: \"Whether the instance wal_receiver is up\"\n - streaming_replicas:\n usage: \"GAUGE\"\n description: \"Number of streaming replicas connected to the instance\"\n\nLine truncated
|
||||
| nameOverride | string | `""` | |
|
||||
| namespaceOverride | string | `""` | |
|
||||
| nodeSelector | object | `{}` | Nodeselector for the operator to be installed. |
|
||||
| podAnnotations | object | `{}` | Annotations to be added to the pod. |
|
||||
| podLabels | object | `{}` | Labels to be added to the pod. |
|
||||
| podSecurityContext | object | `{"runAsNonRoot":true,"seccompProfile":{"type":"RuntimeDefault"}}` | Security Context for the whole pod. |
|
||||
| priorityClassName | string | `""` | Priority indicates the importance of a Pod relative to other Pods. |
|
||||
| rbac.aggregateClusterRoles | bool | `false` | Aggregate ClusterRoles to Kubernetes default user-facing roles. Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles |
|
||||
| rbac.create | bool | `true` | Specifies whether ClusterRole and ClusterRoleBinding should be created. |
|
||||
| replicaCount | int | `1` | |
|
||||
| resources | object | `{}` | |
|
||||
| scratchData.emptyDir | object | `{}` | EmptyDir options for the scratch-data volume. |
|
||||
| service.ipFamilies | list | `[]` | 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. |
|
||||
| service.ipFamilyPolicy | string | `""` | Set the ip family policy to configure dual-stack see [Configure dual-stack](https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services) |
|
||||
| service.name | string | `"cnpg-webhook-service"` | The name of the Webhook Service. |
|
||||
| service.port | int | `443` | |
|
||||
| service.type | string | `"ClusterIP"` | |
|
||||
| serviceAccount.create | bool | `true` | Specifies whether the service account should be created. |
|
||||
| serviceAccount.name | string | `""` | The name of the service account to use. If not set and create is true, a name is generated using the fullname template. |
|
||||
| tolerations | list | `[]` | Tolerations for the operator to be installed. |
|
||||
| topologySpreadConstraints | list | `[]` | Topology Spread Constraints for the operator to be installed. |
|
||||
| updateStrategy | object | `{}` | Update strategy for the operator. ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy |
|
||||
| webhook | object | `{"livenessProbe":{"initialDelaySeconds":3},"mutating":{"create":true,"failurePolicy":"Fail"},"port":9443,"readinessProbe":{"initialDelaySeconds":3},"startupProbe":{"failureThreshold":6,"periodSeconds":5},"validating":{"create":true,"failurePolicy":"Fail"}}` | The webhook configuration. |
|
||||
|
||||
## Maintainers
|
||||
|
||||
| Name | Email | Url |
|
||||
| ---- | ------ | --- |
|
||||
| phisco | <p.scorsolini@gmail.com> | |
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Please read the [code of conduct](https://github.com/cloudnative-pg/charts/blob/main/CODE-OF-CONDUCT.md) and the
|
||||
[guidelines](https://github.com/cloudnative-pg/charts/blob/main/CONTRIBUTING.md) to contribute to the project.
|
||||
|
||||
Copyright
|
||||
---------
|
||||
|
||||
Helm charts for CloudNativePG are distributed under [Apache License 2.0](./LICENSE).
|
||||
@@ -0,0 +1,139 @@
|
||||
{{ template "chart.header" . }}
|
||||
|
||||
|
||||
{{ template "chart.deprecationWarning" . }}
|
||||
|
||||
|
||||
{{ template "chart.badgesSection" . }}
|
||||
|
||||
|
||||
{{ template "chart.description" . }}
|
||||
|
||||
|
||||
{{ template "chart.homepageLine" . }}
|
||||
|
||||
|
||||
About this chart
|
||||
----------------
|
||||
|
||||
Helm chart to install the [CloudNativePG operator](https://cloudnative-pg.io), originally created and sponsored
|
||||
by [EDB](https://www.enterprisedb.com/) to manage PostgreSQL workloads on any supported Kubernetes cluster
|
||||
running in private, public, or hybrid cloud environments.
|
||||
|
||||
**NOTE**: this chart supports only the latest point release of the CloudNativePG operator.
|
||||
|
||||
The chart installs only the operator (controller manager, webhooks, RBAC and CRDs). To provision a PostgreSQL
|
||||
`Cluster` resource, use the companion [`cluster`](https://github.com/cloudnative-pg/charts/tree/main/charts/cluster) chart
|
||||
(see the [Cluster chart README](https://github.com/cloudnative-pg/charts/blob/main/charts/cluster/README.md) for details)
|
||||
or apply your own `Cluster` manifest.
|
||||
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
### Add the chart repository
|
||||
|
||||
```console
|
||||
helm repo add cnpg https://cloudnative-pg.github.io/charts
|
||||
helm repo update
|
||||
```
|
||||
|
||||
### Install the operator
|
||||
|
||||
```console
|
||||
helm upgrade --install cnpg \
|
||||
--namespace cnpg-system \
|
||||
--create-namespace \
|
||||
cnpg/cloudnative-pg
|
||||
```
|
||||
|
||||
### Install with custom parameters
|
||||
|
||||
You can override individual chart values from the command line with `--set`.
|
||||
For example, to enable the Prometheus `PodMonitor`:
|
||||
|
||||
```console
|
||||
helm upgrade --install cnpg \
|
||||
--namespace cnpg-system \
|
||||
--create-namespace \
|
||||
--set monitoring.podMonitorEnabled=true \
|
||||
cnpg/cloudnative-pg
|
||||
```
|
||||
|
||||
> **Note**
|
||||
> Enabling the `PodMonitor` requires the Prometheus Operator CRDs to be installed in the cluster.
|
||||
> Without them the install fails with `no matches for kind "PodMonitor"`.
|
||||
|
||||
See the [Values](#values) section below for the full list of configurable parameters.
|
||||
|
||||
### Verify the installation
|
||||
|
||||
```console
|
||||
kubectl -n cnpg-system get deploy
|
||||
kubectl -n cnpg-system rollout status deploy/cnpg-cloudnative-pg
|
||||
```
|
||||
|
||||
|
||||
Single namespace installation
|
||||
-----------------------------
|
||||
|
||||
It is possible to limit the operator's capabilities to solely the namespace in which it has been installed.
|
||||
With this restriction, the cluster-level permissions required by the operator will be substantially reduced,
|
||||
and the security profile of the installation will be enhanced.
|
||||
|
||||
You can install the operator in single-namespace mode by setting the `config.clusterWide` flag to `false`,
|
||||
as in the following example:
|
||||
|
||||
```console
|
||||
helm upgrade --install cnpg \
|
||||
--namespace cnpg-system \
|
||||
--create-namespace \
|
||||
--set config.clusterWide=false \
|
||||
cnpg/cloudnative-pg
|
||||
```
|
||||
|
||||
**IMPORTANT**: the single-namespace installation mode can't coexist with the cluster-wide operator. Otherwise
|
||||
there would be collisions when managing the resources in the namespace watched by the single-namespace
|
||||
operator. It is up to the user to ensure there is no collision between operators.
|
||||
|
||||
|
||||
Uninstalling
|
||||
------------
|
||||
|
||||
```console
|
||||
helm uninstall cnpg --namespace cnpg-system
|
||||
```
|
||||
|
||||
> **Warning**
|
||||
> Uninstalling the chart does not remove the CRDs. Deleting them cascade-deletes every `Cluster` (and other
|
||||
> CloudNativePG) resource across the whole cluster, together with the PostgreSQL data stored in their PVCs.
|
||||
> This is irreversible, so only delete the CRDs if you intend to permanently remove all managed databases.
|
||||
|
||||
|
||||
{{ template "chart.sourcesSection" . }}
|
||||
|
||||
|
||||
{{ template "chart.requirementsSection" . }}
|
||||
|
||||
|
||||
{{ template "chart.valuesSection" . }}
|
||||
|
||||
|
||||
{{ template "chart.maintainersSection" . }}
|
||||
|
||||
Contributing
|
||||
------------
|
||||
|
||||
Please read the [code of conduct](https://github.com/cloudnative-pg/charts/blob/main/CODE-OF-CONDUCT.md) and the
|
||||
[guidelines](https://github.com/cloudnative-pg/charts/blob/main/CONTRIBUTING.md) to contribute to the project.
|
||||
|
||||
|
||||
Copyright
|
||||
---------
|
||||
|
||||
Helm charts for CloudNativePG are distributed under [Apache License 2.0](./LICENSE).
|
||||
|
||||
|
||||
{{- if not .SkipVersionFooter }}
|
||||
{{ template "helm-docs.versionFooter" . }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,23 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*.orig
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
.vscode/
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: v2
|
||||
appVersion: 1.16.0
|
||||
description: CloudNativePG Grafana Cluster Dashboard.
|
||||
name: cluster
|
||||
type: application
|
||||
version: 0.0.5
|
||||
@@ -0,0 +1,59 @@
|
||||
<!-- THIS FILE IS AUTOMATICALLY GENERATED. Make changes to README.md.gotmpl instead. -->
|
||||
|
||||
# cluster
|
||||
|
||||
  
|
||||
|
||||

|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
_**Note,** this dashboard is already included in the [CloudNativePG Operator Helm Chart][operator]._
|
||||
|
||||
There are 4 ways to use the CloudNativePG Grafana Cluster Dashboard:
|
||||
|
||||
0. Install the [CloudNativePG Operator Helm Chart][operator]
|
||||
|
||||
1. Install manually via [Grafana.com](https://grafana.com/grafana/dashboards/20417-cloudnativepg/).
|
||||
|
||||
2. Install manually via the [Grafana JSON](https://github.com/cloudnative-pg/grafana-dashboards/blob/main/charts/cluster/grafana-dashboard.json):
|
||||
|
||||
```
|
||||
https://raw.githubusercontent.com/cloudnative-pg/grafana-dashboards/main/charts/cluster/grafana-dashboard.json
|
||||
```
|
||||
|
||||
3. Install directly in your cluster as a Helm Chart:
|
||||
|
||||
```bash
|
||||
helm repo add cnpg-grafana https://cloudnative-pg.github.io/grafana-dashboards
|
||||
helm upgrade
|
||||
--install \
|
||||
--namespace monitoring \
|
||||
cnpg-grafana-cluster cnpg-grafana/cluster
|
||||
```
|
||||
|
||||
2. As as a dependency to an existing chart:
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
- name: cluster
|
||||
alias: cnpg-grafana-cluster-dashboard
|
||||
version: "0.0"
|
||||
repository: https://cloudnative-pg.github.io/grafana-dashboards
|
||||
```
|
||||
|
||||
## Values
|
||||
|
||||
| Key | Type | Default | Description |
|
||||
|-----|------|---------|-------------|
|
||||
| fullnameOverride | string | `""` | |
|
||||
| grafanaDashboard.annotations | object | `{}` | Annotations that ConfigMaps can have to get configured in Grafana. |
|
||||
| grafanaDashboard.configMapName | string | `"cnpg-grafana-dashboard"` | The name of the ConfigMap containing the dashboard. |
|
||||
| grafanaDashboard.labels | object | `{}` | Labels that ConfigMaps should have to get configured in Grafana. |
|
||||
| grafanaDashboard.namespace | string | `""` | Allows overriding the namespace where the ConfigMap will be created, defaulting to the same one as the Release. |
|
||||
| grafanaDashboard.sidecarLabel | string | `"grafana_dashboard"` | Label that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead. |
|
||||
| grafanaDashboard.sidecarLabelValue | string | `"1"` | Label value that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead. |
|
||||
| nameOverride | string | `""` | |
|
||||
|
||||
[operator]: https://github.com/cloudnative-pg/charts/tree/main/charts/cloudnative-pg
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
<!-- THIS FILE IS AUTOMATICALLY GENERATED. Make changes to README.md.gotmpl instead. -->
|
||||
|
||||
{{ template "chart.header" . }}
|
||||
|
||||
{{ template "chart.deprecationWarning" . }}
|
||||
|
||||
{{ template "chart.badgesSection" . }}
|
||||
|
||||

|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
_**Note,** this dashboard is already included in the [CloudNativePG Operator Helm Chart][operator]._
|
||||
|
||||
There are 4 ways to use the CloudNativePG Grafana Cluster Dashboard:
|
||||
|
||||
0. Install the [CloudNativePG Operator Helm Chart][operator]
|
||||
|
||||
1. Install manually via [Grafana.com](https://grafana.com/grafana/dashboards/20417-cloudnativepg/).
|
||||
|
||||
2. Install manually via the [Grafana JSON](https://github.com/cloudnative-pg/grafana-dashboards/blob/main/charts/cluster/grafana-dashboard.json):
|
||||
|
||||
```
|
||||
https://raw.githubusercontent.com/cloudnative-pg/grafana-dashboards/main/charts/cluster/grafana-dashboard.json
|
||||
```
|
||||
|
||||
3. Install directly in your cluster as a Helm Chart:
|
||||
|
||||
```bash
|
||||
helm repo add cnpg-grafana https://cloudnative-pg.github.io/grafana-dashboards
|
||||
helm upgrade
|
||||
--install \
|
||||
--namespace monitoring \
|
||||
cnpg-grafana-cluster cnpg-grafana/cluster
|
||||
```
|
||||
|
||||
2. As as a dependency to an existing chart:
|
||||
|
||||
```yaml
|
||||
dependencies:
|
||||
- name: cluster
|
||||
alias: cnpg-grafana-cluster-dashboard
|
||||
version: "0.0"
|
||||
repository: https://cloudnative-pg.github.io/grafana-dashboards
|
||||
```
|
||||
|
||||
|
||||
{{ template "chart.requirementsSection" . }}
|
||||
|
||||
|
||||
{{ template "chart.valuesSection" . }}
|
||||
|
||||
|
||||
{{ template "chart.maintainersSection" . }}
|
||||
|
||||
{{ template "helm-docs.versionFooter" . }}
|
||||
|
||||
[operator]: https://github.com/cloudnative-pg/charts/tree/main/charts/cloudnative-pg
|
||||
+9347
File diff suppressed because it is too large.
Load diff
+5
@@ -0,0 +1,5 @@
|
||||
CloudNativePG Grafana Dashboard installed successfully.
|
||||
|
||||
{{- if (or .Values.grafanaDashboard.sidecarLabel .Values.grafanaDashboard.sidecarLabelValue) }}
|
||||
DEPRECATION NOTICE: The grafanaDashboard.sidecarLabel is deprecated and will be removed in a future release. Use the grafanaDashboard.labels instead.
|
||||
{{- end }}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Values.grafanaDashboard.configMapName }}
|
||||
namespace: {{ default .Release.Namespace .Values.grafanaDashboard.namespace }}
|
||||
{{- if (or .Values.grafanaDashboard.labels .Values.grafanaDashboard.sidecarLabel) }}
|
||||
labels:
|
||||
{{- if .Values.grafanaDashboard.sidecarLabel }}
|
||||
{{ .Values.grafanaDashboard.sidecarLabel }}: {{ .Values.grafanaDashboard.sidecarLabelValue | quote }}
|
||||
{{- end }}
|
||||
{{- with .Values.grafanaDashboard.labels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- with .Values.grafanaDashboard.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
cnp.json: |-
|
||||
{{ .Files.Get "grafana-dashboard.json" | indent 6 }}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/schema#",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"fullnameOverride": {
|
||||
"type": "string"
|
||||
},
|
||||
"grafanaDashboard": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"annotations": {
|
||||
"type": "object"
|
||||
},
|
||||
"configMapName": {
|
||||
"type": "string"
|
||||
},
|
||||
"labels": {
|
||||
"type": "object"
|
||||
},
|
||||
"namespace": {
|
||||
"type": "string"
|
||||
},
|
||||
"sidecarLabel": {
|
||||
"type": "string"
|
||||
},
|
||||
"sidecarLabelValue": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"nameOverride": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
# Default values for cluster.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
|
||||
grafanaDashboard:
|
||||
# -- Allows overriding the namespace where the ConfigMap will be created, defaulting to the same one as the Release.
|
||||
namespace: ""
|
||||
# -- The name of the ConfigMap containing the dashboard.
|
||||
configMapName: "cnpg-grafana-dashboard"
|
||||
# -- Label that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead.
|
||||
sidecarLabel: "grafana_dashboard"
|
||||
# -- Label value that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead.
|
||||
sidecarLabelValue: "1"
|
||||
# -- Labels that ConfigMaps should have to get configured in Grafana.
|
||||
labels: {}
|
||||
# -- Annotations that ConfigMaps can have to get configured in Grafana.
|
||||
annotations: {}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
The JSON file has been moved to a dedicated repository for CloudNativePG dashboards located at:
|
||||
|
||||
https://github.com/cloudnative-pg/grafana-dashboards/blob/main/charts/cluster/grafana-dashboard.json
|
||||
@@ -0,0 +1,21 @@
|
||||
|
||||
CloudNativePG operator should be installed in namespace "{{ include "cloudnative-pg.namespace" . }}".
|
||||
You can now create a PostgreSQL cluster with 3 nodes as follows:
|
||||
|
||||
cat <<EOF | kubectl apply -f -
|
||||
# Example of PostgreSQL cluster
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: cluster-example
|
||||
{{if not .Values.config.clusterWide -}}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
{{- end }}
|
||||
spec:
|
||||
instances: 3
|
||||
storage:
|
||||
size: 1Gi
|
||||
EOF
|
||||
|
||||
kubectl get -A cluster
|
||||
|
||||
@@ -0,0 +1,325 @@
|
||||
{{/*
|
||||
Allow the release namespace to be overridden for multi-namespace deployments in combined charts
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.namespace" -}}
|
||||
{{- if .Values.namespaceOverride -}}
|
||||
{{- .Values.namespaceOverride -}}
|
||||
{{- else -}}
|
||||
{{- .Release.Namespace -}}
|
||||
{{- end -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
If release name contains chart name it will be used as a full name.
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.fullname" -}}
|
||||
{{- if .Values.fullnameOverride }}
|
||||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride }}
|
||||
{{- if contains $name .Release.Name }}
|
||||
{{- .Release.Name | trunc 63 | trimSuffix "-" }}
|
||||
{{- else }}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create chart name and version as used by the chart label.
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.chart" -}}
|
||||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Common labels
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.labels" -}}
|
||||
helm.sh/chart: {{ include "cloudnative-pg.chart" . }}
|
||||
{{ include "cloudnative-pg.selectorLabels" . }}
|
||||
{{- if .Chart.AppVersion }}
|
||||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
|
||||
{{- end }}
|
||||
app.kubernetes.io/managed-by: {{ .Release.Service }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Selector labels
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.selectorLabels" -}}
|
||||
app.kubernetes.io/name: {{ include "cloudnative-pg.name" . }}
|
||||
app.kubernetes.io/instance: {{ .Release.Name }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Create the name of the service account to use
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.serviceAccountName" -}}
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
{{- default (include "cloudnative-pg.fullname" .) .Values.serviceAccount.name }}
|
||||
{{- else }}
|
||||
{{- default "default" .Values.serviceAccount.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Define the common set of rules that can be applied either with
|
||||
namespace scope or clusterwide
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.commonRules" }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps
|
||||
- secrets
|
||||
- services
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- configmaps/status
|
||||
- secrets/status
|
||||
verbs:
|
||||
- get
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- create
|
||||
- patch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- persistentvolumeclaims
|
||||
- pods
|
||||
- pods/exec
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- pods/status
|
||||
verbs:
|
||||
- get
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- serviceaccounts
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- deployments
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
- jobs
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- watch
|
||||
- apiGroups:
|
||||
- coordination.k8s.io
|
||||
resources:
|
||||
- leases
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- discovery.k8s.io
|
||||
resources:
|
||||
- endpointslices
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- monitoring.coreos.com
|
||||
resources:
|
||||
- podmonitors
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- watch
|
||||
- apiGroups:
|
||||
- policy
|
||||
resources:
|
||||
- poddisruptionbudgets
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- backups
|
||||
- clusters
|
||||
- databaseroles
|
||||
- databases
|
||||
- poolers
|
||||
- publications
|
||||
- scheduledbackups
|
||||
- subscriptions
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- failoverquorums
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- backups/status
|
||||
- databases/status
|
||||
- publications/status
|
||||
- scheduledbackups/status
|
||||
- subscriptions/status
|
||||
verbs:
|
||||
- get
|
||||
- patch
|
||||
- update
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- imagecatalogs
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- clusters/finalizers
|
||||
- databaseroles/finalizers
|
||||
- poolers/finalizers
|
||||
verbs:
|
||||
- update
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- clusters/status
|
||||
- databaseroles/status
|
||||
- poolers/status
|
||||
- failoverquorums/status
|
||||
verbs:
|
||||
- get
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- rbac.authorization.k8s.io
|
||||
resources:
|
||||
- rolebindings
|
||||
- roles
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- update
|
||||
- watch
|
||||
- apiGroups:
|
||||
- snapshot.storage.k8s.io
|
||||
resources:
|
||||
- volumesnapshots
|
||||
verbs:
|
||||
- create
|
||||
- get
|
||||
- list
|
||||
- patch
|
||||
- watch
|
||||
{{- end }}
|
||||
|
||||
{{/*
|
||||
Define the set of rules that must be applied clusterwide
|
||||
*/}}
|
||||
{{- define "cloudnative-pg.clusterwideRules" }}
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- nodes
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- admissionregistration.k8s.io
|
||||
resources:
|
||||
- mutatingwebhookconfigurations
|
||||
- validatingwebhookconfigurations
|
||||
verbs:
|
||||
- get
|
||||
- patch
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- clusterimagecatalogs
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
{{- end }}
|
||||
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
{{- if .Values.config.create }}
|
||||
{{- if not .Values.config.secret }}
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Values.config.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
{{- if .Values.config.clusterWide -}}
|
||||
{{- toYaml .Values.config.data | nindent 2 }}
|
||||
{{- else -}}
|
||||
{{- $watchNamespaceMap := dict "WATCH_NAMESPACE" .Release.Namespace -}}
|
||||
{{- $fullConfiguration := merge .Values.config.data $watchNamespaceMap -}}
|
||||
{{- toYaml $fullConfiguration | nindent 2 }}
|
||||
{{- end -}}
|
||||
{{- else }}
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
type: Opaque
|
||||
metadata:
|
||||
name: {{ .Values.config.name }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
stringData:
|
||||
{{- if .Values.config.clusterWide -}}
|
||||
{{- toYaml .Values.config.data | nindent 2 }}
|
||||
{{- else -}}
|
||||
{{- $watchNamespaceMap := dict "WATCH_NAMESPACE" .Release.Namespace -}}
|
||||
{{- $fullConfiguration := merge .Values.config.data $watchNamespaceMap -}}
|
||||
{{- toYaml $fullConfiguration | nindent 2 }}
|
||||
{{- end -}}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,176 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.fullname" . }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "cloudnative-pg.selectorLabels" . | nindent 6 }}
|
||||
{{- if .Values.updateStrategy }}
|
||||
strategy:
|
||||
{{- toYaml .Values.updateStrategy | nindent 4 }}
|
||||
{{- end }}
|
||||
template:
|
||||
metadata:
|
||||
annotations:
|
||||
checksum/rbac: {{ include (print $.Template.BasePath "/rbac.yaml") . | sha256sum }}
|
||||
checksum/config: {{ include (print $.Template.BasePath "/config.yaml") . | sha256sum }}
|
||||
checksum/monitoring-config: {{ include (print $.Template.BasePath "/monitoring-configmap.yaml") . | sha256sum }}
|
||||
{{- with .Values.podAnnotations }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.selectorLabels" . | nindent 8 }}
|
||||
{{- with .Values.podLabels }}
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
{{- with .Values.imagePullSecrets }}
|
||||
imagePullSecrets:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- if .Values.hostNetwork }}
|
||||
hostNetwork: {{ .Values.hostNetwork }}
|
||||
{{- end }}
|
||||
{{- if .Values.dnsPolicy }}
|
||||
dnsPolicy: {{ .Values.dnsPolicy }}
|
||||
{{- end }}
|
||||
containers:
|
||||
- args:
|
||||
- controller
|
||||
- --leader-elect
|
||||
- --max-concurrent-reconciles={{ .Values.config.maxConcurrentReconciles }}
|
||||
{{- if .Values.config.name }}
|
||||
{{- if not .Values.config.secret }}
|
||||
- --config-map-name={{ .Values.config.name }}
|
||||
{{- else }}
|
||||
- --secret-name={{ .Values.config.name }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
- --webhook-port={{ .Values.webhook.port }}
|
||||
{{- range .Values.additionalArgs }}
|
||||
- {{ . }}
|
||||
{{- end }}
|
||||
command:
|
||||
- /manager
|
||||
env:
|
||||
- name: OPERATOR_IMAGE_NAME
|
||||
value: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
- name: OPERATOR_NAMESPACE
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: metadata.namespace
|
||||
- name: MONITORING_QUERIES_CONFIGMAP
|
||||
value: "{{ .Values.monitoringQueriesConfigMap.name }}"
|
||||
{{- if not .Values.config.clusterWide }}
|
||||
- name: WATCH_NAMESPACE
|
||||
value: "{{ include "cloudnative-pg.namespace" . }}"
|
||||
{{- end }}
|
||||
{{- if .Values.additionalEnv }}
|
||||
{{- tpl (.Values.additionalEnv | toYaml) . | nindent 8 }}
|
||||
{{- end }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: webhook-server
|
||||
scheme: HTTPS
|
||||
{{- if .Values.webhook.livenessProbe.initialDelaySeconds }}
|
||||
initialDelaySeconds: {{ .Values.webhook.livenessProbe.initialDelaySeconds }}
|
||||
{{- end }}
|
||||
name: manager
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
name: metrics
|
||||
protocol: TCP
|
||||
- containerPort: {{ .Values.webhook.port }}
|
||||
name: webhook-server
|
||||
protocol: TCP
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: webhook-server
|
||||
scheme: HTTPS
|
||||
{{- if .Values.webhook.readinessProbe.initialDelaySeconds }}
|
||||
initialDelaySeconds: {{ .Values.webhook.readinessProbe.initialDelaySeconds }}
|
||||
{{- end }}
|
||||
resources:
|
||||
{{- toYaml .Values.resources | nindent 10 }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.containerSecurityContext | nindent 10 }}
|
||||
startupProbe:
|
||||
{{- if .Values.webhook.startupProbe.failureThreshold }}
|
||||
failureThreshold: {{ .Values.webhook.startupProbe.failureThreshold }}
|
||||
{{- end }}
|
||||
httpGet:
|
||||
path: /readyz
|
||||
port: webhook-server
|
||||
scheme: HTTPS
|
||||
{{- if .Values.webhook.startupProbe.periodSeconds }}
|
||||
periodSeconds: {{ .Values.webhook.startupProbe.periodSeconds }}
|
||||
{{- end }}
|
||||
volumeMounts:
|
||||
- mountPath: /controller
|
||||
name: scratch-data
|
||||
- mountPath: /run/secrets/cnpg.io/webhook
|
||||
name: webhook-certificates
|
||||
{{- if .Values.priorityClassName }}
|
||||
priorityClassName: {{ .Values.priorityClassName }}
|
||||
{{- end }}
|
||||
securityContext:
|
||||
{{- toYaml .Values.podSecurityContext | nindent 8 }}
|
||||
serviceAccountName: {{ include "cloudnative-pg.serviceAccountName" . }}
|
||||
terminationGracePeriodSeconds: 10
|
||||
{{- with .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.topologySpreadConstraints }}
|
||||
topologySpreadConstraints:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.affinity }}
|
||||
affinity:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
{{- with .Values.tolerations }}
|
||||
tolerations:
|
||||
{{- toYaml . | nindent 8 }}
|
||||
{{- end }}
|
||||
volumes:
|
||||
- name: scratch-data
|
||||
emptyDir:
|
||||
{{- toYaml .Values.scratchData.emptyDir | nindent 10 }}
|
||||
- name: webhook-certificates
|
||||
secret:
|
||||
defaultMode: 420
|
||||
optional: true
|
||||
secretName: cnpg-webhook-cert
|
||||
+33
@@ -0,0 +1,33 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ .Values.monitoringQueriesConfigMap.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
cnpg.io/reload: ""
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
data:
|
||||
queries: {{- toYaml .Values.monitoringQueriesConfigMap.queries | nindent 4 }}
|
||||
+116
@@ -0,0 +1,116 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
{{- if .Values.webhook.mutating.create }}
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: MutatingWebhookConfiguration
|
||||
metadata:
|
||||
name: cnpg-mutating-webhook-configuration
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
webhooks:
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /mutate-postgresql-cnpg-io-v1-backup
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.mutating.failurePolicy }}
|
||||
name: mbackup.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- backups
|
||||
sideEffects: None
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /mutate-postgresql-cnpg-io-v1-cluster
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.mutating.failurePolicy }}
|
||||
name: mcluster.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- clusters
|
||||
sideEffects: None
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /mutate-postgresql-cnpg-io-v1-database
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.mutating.failurePolicy }}
|
||||
name: mdatabase.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- databases
|
||||
sideEffects: None
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /mutate-postgresql-cnpg-io-v1-scheduledbackup
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.mutating.failurePolicy }}
|
||||
name: mscheduledbackup.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- scheduledbackups
|
||||
sideEffects: None
|
||||
{{- end }}
|
||||
@@ -0,0 +1,48 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
{{- if .Values.monitoring.podMonitorEnabled }}
|
||||
apiVersion: monitoring.coreos.com/v1
|
||||
kind: PodMonitor
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.fullname" . }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.monitoring.podMonitorAdditionalLabels }}
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end}}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
{{- include "cloudnative-pg.selectorLabels" . | nindent 6 }}
|
||||
podMetricsEndpoints:
|
||||
- port: metrics
|
||||
{{- with .Values.monitoring.podMonitorMetricRelabelings }}
|
||||
metricRelabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- with .Values.monitoring.podMonitorRelabelings }}
|
||||
relabelings:
|
||||
{{- toYaml . | nindent 6 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,182 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
{{- if .Values.serviceAccount.create }}
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.serviceAccountName" . }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
|
||||
{{- if .Values.rbac.create }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.fullname" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- include "cloudnative-pg.clusterwideRules" . }}
|
||||
{{/*
|
||||
If we're doing a clusterWide installation (default)
|
||||
we add ALL the necessary rules for the operator to the ClusterRole
|
||||
*/}}
|
||||
{{- if .Values.config.clusterWide }}
|
||||
{{- include "cloudnative-pg.commonRules" . }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.fullname" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: {{ include "cloudnative-pg.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "cloudnative-pg.serviceAccountName" . }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
{{/*
|
||||
If we're doing a single-namespace installation
|
||||
we create a Role with the common rules for the operator,
|
||||
and a RoleBinding. We already created the ClusterRole above with the
|
||||
required cluster-wide rules
|
||||
*/}}
|
||||
{{- if eq .Values.config.clusterWide false }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: Role
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.fullname" . }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
rules:
|
||||
{{- include "cloudnative-pg.commonRules" . }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: RoleBinding
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.fullname" . }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: Role
|
||||
name: {{ include "cloudnative-pg.fullname" . }}
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: {{ include "cloudnative-pg.serviceAccountName" . }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
{{- end }}
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.fullname" . }}-view
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- if .Values.rbac.aggregateClusterRoles }}
|
||||
rbac.authorization.k8s.io/aggregate-to-view: "true"
|
||||
rbac.authorization.k8s.io/aggregate-to-edit: "true"
|
||||
rbac.authorization.k8s.io/aggregate-to-admin: "true"
|
||||
{{- end }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- backups
|
||||
- clusters
|
||||
- clusters/status
|
||||
- databaseroles
|
||||
- databases
|
||||
- failoverquorums
|
||||
- poolers
|
||||
- publications
|
||||
- scheduledbackups
|
||||
- imagecatalogs
|
||||
- clusterimagecatalogs
|
||||
- subscriptions
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: {{ include "cloudnative-pg.fullname" . }}-edit
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- if .Values.rbac.aggregateClusterRoles }}
|
||||
rbac.authorization.k8s.io/aggregate-to-edit: "true"
|
||||
rbac.authorization.k8s.io/aggregate-to-admin: "true"
|
||||
{{- end }}
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
resources:
|
||||
- backups
|
||||
- clusters
|
||||
- clusters/status
|
||||
- databaseroles
|
||||
- databases
|
||||
- failoverquorums
|
||||
- poolers
|
||||
- publications
|
||||
- scheduledbackups
|
||||
- imagecatalogs
|
||||
- clusterimagecatalogs
|
||||
- subscriptions
|
||||
verbs:
|
||||
- create
|
||||
- delete
|
||||
- deletecollection
|
||||
- patch
|
||||
- update
|
||||
---
|
||||
{{- end }}
|
||||
@@ -0,0 +1,44 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.commonAnnotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
type: {{ .Values.service.type }}
|
||||
{{- if .Values.service.ipFamilyPolicy }}
|
||||
ipFamilyPolicy: {{ .Values.service.ipFamilyPolicy }}
|
||||
{{- end }}
|
||||
{{- if .Values.service.ipFamilies }}
|
||||
ipFamilies: {{ .Values.service.ipFamilies | toYaml | nindent 2 }}
|
||||
{{- end }}
|
||||
ports:
|
||||
- port: {{ .Values.service.port }}
|
||||
targetPort: webhook-server
|
||||
name: webhook-server
|
||||
selector:
|
||||
{{- include "cloudnative-pg.selectorLabels" . | nindent 4 }}
|
||||
+137
@@ -0,0 +1,137 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
{{- if .Values.webhook.validating.create }}
|
||||
---
|
||||
apiVersion: admissionregistration.k8s.io/v1
|
||||
kind: ValidatingWebhookConfiguration
|
||||
metadata:
|
||||
name: cnpg-validating-webhook-configuration
|
||||
labels:
|
||||
{{- include "cloudnative-pg.labels" . | nindent 4 }}
|
||||
{{- with .Values.rbac.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
webhooks:
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /validate-postgresql-cnpg-io-v1-backup
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.validating.failurePolicy }}
|
||||
name: vbackup.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- backups
|
||||
sideEffects: None
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /validate-postgresql-cnpg-io-v1-cluster
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.validating.failurePolicy }}
|
||||
name: vcluster.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- clusters
|
||||
sideEffects: None
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /validate-postgresql-cnpg-io-v1-scheduledbackup
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.validating.failurePolicy }}
|
||||
name: vscheduledbackup.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- scheduledbackups
|
||||
sideEffects: None
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /validate-postgresql-cnpg-io-v1-database
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.validating.failurePolicy }}
|
||||
name: vdatabase.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- databases
|
||||
sideEffects: None
|
||||
- admissionReviewVersions:
|
||||
- v1
|
||||
clientConfig:
|
||||
service:
|
||||
name: {{ .Values.service.name }}
|
||||
namespace: {{ include "cloudnative-pg.namespace" . }}
|
||||
path: /validate-postgresql-cnpg-io-v1-pooler
|
||||
port: {{ .Values.service.port }}
|
||||
failurePolicy: {{ .Values.webhook.validating.failurePolicy }}
|
||||
name: vpooler.cnpg.io
|
||||
rules:
|
||||
- apiGroups:
|
||||
- postgresql.cnpg.io
|
||||
apiVersions:
|
||||
- v1
|
||||
operations:
|
||||
- CREATE
|
||||
- UPDATE
|
||||
resources:
|
||||
- poolers
|
||||
sideEffects: None
|
||||
{{- end }}
|
||||
@@ -0,0 +1,481 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"properties": {
|
||||
"additionalArgs": {
|
||||
"description": "Additional arguments to be added to the operator's args list.",
|
||||
"items": {
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"additionalEnv": {
|
||||
"description": "Array containing extra environment variables which can be templated.",
|
||||
"items": {
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"affinity": {
|
||||
"description": "Affinity for the operator to be installed.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"commonAnnotations": {
|
||||
"description": "Annotations to be added to all other resources.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"config": {
|
||||
"description": "Operator configuration.",
|
||||
"properties": {
|
||||
"clusterWide": {
|
||||
"default": true,
|
||||
"description": "This option determines if the operator is responsible for observing\nevents across the entire Kubernetes cluster or if its focus should be\nnarrowed down to the specific namespace within which it has been deployed.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"create": {
|
||||
"default": true,
|
||||
"description": "Specifies whether the secret should be created.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"data": {
|
||||
"description": "The content of the configmap/secret, see\nhttps://cloudnative-pg.io/documentation/current/operator_conf/#available-options\nfor all the available options.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"maxConcurrentReconciles": {
|
||||
"default": 10,
|
||||
"description": "The maximum number of concurrent reconciles. Defaults to 10.",
|
||||
"type": "integer"
|
||||
},
|
||||
"name": {
|
||||
"default": "cnpg-controller-manager-config",
|
||||
"description": "The name of the configmap/secret to use.",
|
||||
"type": "string"
|
||||
},
|
||||
"secret": {
|
||||
"default": false,
|
||||
"description": "Specifies whether it should be stored in a secret, instead of a configmap.",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"containerSecurityContext": {
|
||||
"description": "Container Security Context.",
|
||||
"properties": {
|
||||
"allowPrivilegeEscalation": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"capabilities": {
|
||||
"properties": {
|
||||
"drop": {
|
||||
"items": {
|
||||
"anyOf": [
|
||||
{
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"readOnlyRootFilesystem": {
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"runAsGroup": {
|
||||
"default": 10001,
|
||||
"type": "integer"
|
||||
},
|
||||
"runAsUser": {
|
||||
"default": 10001,
|
||||
"type": "integer"
|
||||
},
|
||||
"seccompProfile": {
|
||||
"properties": {
|
||||
"type": {
|
||||
"default": "RuntimeDefault",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"crds": {
|
||||
"properties": {
|
||||
"create": {
|
||||
"default": true,
|
||||
"description": "Specifies whether the CRDs should be created when installing the chart.",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"dnsPolicy": {
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
"fullnameOverride": {
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
"global": {
|
||||
"description": "Global values are values that can be accessed from any chart or subchart by exactly the same name.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"hostNetwork": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"image": {
|
||||
"properties": {
|
||||
"pullPolicy": {
|
||||
"default": "IfNotPresent",
|
||||
"type": "string"
|
||||
},
|
||||
"repository": {
|
||||
"default": "ghcr.io/cloudnative-pg/cloudnative-pg",
|
||||
"type": "string"
|
||||
},
|
||||
"tag": {
|
||||
"default": "",
|
||||
"description": "Overrides the image tag whose default is the chart appVersion.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"imagePullSecrets": {
|
||||
"items": {
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"monitoring": {
|
||||
"properties": {
|
||||
"grafanaDashboard": {
|
||||
"properties": {
|
||||
"annotations": {
|
||||
"description": "Annotations that ConfigMaps can have to get configured in Grafana.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"configMapName": {
|
||||
"default": "cnpg-grafana-dashboard",
|
||||
"description": "The name of the ConfigMap containing the dashboard.",
|
||||
"type": "string"
|
||||
},
|
||||
"create": {
|
||||
"default": false,
|
||||
"type": "boolean"
|
||||
},
|
||||
"labels": {
|
||||
"description": "Labels that ConfigMaps should have to get configured in Grafana.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"namespace": {
|
||||
"default": "",
|
||||
"description": "Allows overriding the namespace where the ConfigMap will be created, defaulting to the same one as the Release.",
|
||||
"type": "string"
|
||||
},
|
||||
"sidecarLabel": {
|
||||
"default": "grafana_dashboard",
|
||||
"description": "Label that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead.",
|
||||
"type": "string"
|
||||
},
|
||||
"sidecarLabelValue": {
|
||||
"default": "1",
|
||||
"description": "Label value that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"podMonitorAdditionalLabels": {
|
||||
"description": "Additional labels for the podMonitor",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"podMonitorEnabled": {
|
||||
"default": false,
|
||||
"description": "Specifies whether the monitoring should be enabled. Requires Prometheus Operator CRDs.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"podMonitorMetricRelabelings": {
|
||||
"description": "Metrics relabel configurations to apply to samples before ingestion.",
|
||||
"items": {
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"podMonitorRelabelings": {
|
||||
"description": "Relabel configurations to apply to samples before scraping.",
|
||||
"items": {
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"monitoringQueriesConfigMap": {
|
||||
"description": "Default monitoring queries",
|
||||
"properties": {
|
||||
"name": {
|
||||
"default": "cnpg-default-monitoring",
|
||||
"description": "The name of the default monitoring configmap.",
|
||||
"type": "string"
|
||||
},
|
||||
"queries": {
|
||||
"default": "backends:\n query: |\n SELECT sa.datname\n , sa.usename\n , sa.application_name\n , states.state\n , COALESCE(sa.count, 0) AS total\n , COALESCE(sa.max_tx_secs, 0) AS max_tx_duration_seconds\n FROM ( VALUES ('active')\n , ('idle')\n , ('idle in transaction')\n , ('idle in transaction (aborted)')\n , ('fastpath function call')\n , ('disabled')\n ) AS states(state)\n LEFT JOIN (\n SELECT datname\n , state\n , usename\n , COALESCE(application_name, '') AS application_name\n , pg_catalog.count(*)\n , COALESCE(EXTRACT (EPOCH FROM (pg_catalog.max(pg_catalog.now() OPERATOR(pg_catalog.-) xact_start))), 0) AS max_tx_secs\n FROM pg_catalog.pg_stat_activity\n GROUP BY datname, state, usename, application_name\n ) sa ON states.state OPERATOR(pg_catalog.=) sa.state\n WHERE sa.usename IS NOT NULL\n metrics:\n - datname:\n usage: \"LABEL\"\n description: \"Name of the database\"\n - usename:\n usage: \"LABEL\"\n description: \"Name of the user\"\n - application_name:\n usage: \"LABEL\"\n description: \"Name of the application\"\n - state:\n usage: \"LABEL\"\n description: \"State of the backend\"\n - total:\n usage: \"GAUGE\"\n description: \"Number of backends\"\n - max_tx_duration_seconds:\n usage: \"GAUGE\"\n description: \"Maximum duration of a transaction in seconds\"\n\nbackends_waiting:\n query: |\n SELECT pg_catalog.count(*) AS total\n FROM pg_catalog.pg_locks blocked_locks\n JOIN pg_catalog.pg_locks blocking_locks\n ON blocking_locks.locktype OPERATOR(pg_catalog.=) blocked_locks.locktype\n AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database\n AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation\n AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page\n AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple\n AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid\n AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid\n AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid\n AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid\n AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid\n AND blocking_locks.pid OPERATOR(pg_catalog.\u003c\u003e) blocked_locks.pid\n JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid OPERATOR(pg_catalog.=) blocking_locks.pid\n WHERE NOT blocked_locks.granted\n metrics:\n - total:\n usage: \"GAUGE\"\n description: \"Total number of backends that are currently waiting on other queries\"\n\npg_database:\n query: |\n SELECT datname\n , pg_catalog.pg_database_size(datname) AS size_bytes\n , pg_catalog.age(datfrozenxid) AS xid_age\n , pg_catalog.mxid_age(datminmxid) AS mxid_age\n FROM pg_catalog.pg_database\n WHERE datallowconn\n metrics:\n - datname:\n usage: \"LABEL\"\n description: \"Name of the database\"\n - size_bytes:\n usage: \"GAUGE\"\n description: \"Disk space used by the database\"\n - xid_age:\n usage: \"GAUGE\"\n description: \"Number of transactions from the frozen XID to the current one\"\n - mxid_age:\n usage: \"GAUGE\"\n description: \"Number of multiple transactions (Multixact) from the frozen XID to the current one\"\n\npg_postmaster:\n query: |\n SELECT EXTRACT(EPOCH FROM pg_postmaster_start_time) AS start_time\n FROM pg_catalog.pg_postmaster_start_time()\n metrics:\n - start_time:\n usage: \"GAUGE\"\n description: \"Time at which postgres started (based on epoch)\"\n\npg_replication:\n query: |\n SELECT CASE WHEN (\n NOT pg_catalog.pg_is_in_recovery()\n OR pg_catalog.pg_last_wal_receive_lsn() OPERATOR(pg_catalog.=) pg_catalog.pg_last_wal_replay_lsn())\n THEN 0\n ELSE GREATEST (0,\n EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) pg_catalog.pg_last_xact_replay_timestamp())))\n END AS lag,\n pg_catalog.pg_is_in_recovery() AS in_recovery,\n EXISTS (TABLE pg_catalog.pg_stat_wal_receiver) AS is_wal_receiver_up,\n (SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS streaming_replicas\n metrics:\n - lag:\n usage: \"GAUGE\"\n description: \"Replication lag behind primary in seconds\"\n - in_recovery:\n usage: \"GAUGE\"\n description: \"Whether the instance is in recovery\"\n - is_wal_receiver_up:\n usage: \"GAUGE\"\n description: \"Whether the instance wal_receiver is up\"\n - streaming_replicas:\n usage: \"GAUGE\"\n description: \"Number of streaming replicas connected to the instance\"\n\npg_replication_sloLine truncated
|
||||
"description": "A string representation of a YAML defining monitoring queries.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"nameOverride": {
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
"namespaceOverride": {
|
||||
"default": "",
|
||||
"type": "string"
|
||||
},
|
||||
"nodeSelector": {
|
||||
"description": "Nodeselector for the operator to be installed.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"podAnnotations": {
|
||||
"description": "Annotations to be added to the pod.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"podLabels": {
|
||||
"description": "Labels to be added to the pod.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"podSecurityContext": {
|
||||
"description": "Security Context for the whole pod.",
|
||||
"properties": {
|
||||
"runAsNonRoot": {
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"seccompProfile": {
|
||||
"properties": {
|
||||
"type": {
|
||||
"default": "RuntimeDefault",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"priorityClassName": {
|
||||
"default": "",
|
||||
"description": "Priority indicates the importance of a Pod relative to other Pods.",
|
||||
"type": "string"
|
||||
},
|
||||
"rbac": {
|
||||
"properties": {
|
||||
"aggregateClusterRoles": {
|
||||
"default": false,
|
||||
"description": "Aggregate ClusterRoles to Kubernetes default user-facing roles.\nRef: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles",
|
||||
"type": "boolean"
|
||||
},
|
||||
"create": {
|
||||
"default": true,
|
||||
"description": "Specifies whether ClusterRole and ClusterRoleBinding should be created.",
|
||||
"type": "boolean"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"replicaCount": {
|
||||
"default": 1,
|
||||
"type": "integer"
|
||||
},
|
||||
"resources": {
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"scratchData": {
|
||||
"properties": {
|
||||
"emptyDir": {
|
||||
"description": "EmptyDir options for the scratch-data volume.",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"service": {
|
||||
"properties": {
|
||||
"ipFamilies": {
|
||||
"description": "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.",
|
||||
"items": {
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"ipFamilyPolicy": {
|
||||
"default": "",
|
||||
"description": "Set the ip family policy to configure dual-stack see [Configure dual-stack](https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services)",
|
||||
"type": "string"
|
||||
},
|
||||
"name": {
|
||||
"default": "cnpg-webhook-service",
|
||||
"description": "The name of the Webhook Service.",
|
||||
"type": "string"
|
||||
},
|
||||
"port": {
|
||||
"default": 443,
|
||||
"type": "integer"
|
||||
},
|
||||
"type": {
|
||||
"default": "ClusterIP",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"serviceAccount": {
|
||||
"properties": {
|
||||
"create": {
|
||||
"default": true,
|
||||
"description": "Specifies whether the service account should be created.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"name": {
|
||||
"default": "",
|
||||
"description": "The name of the service account to use.\nIf not set and create is true, a name is generated using the fullname template.",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"tolerations": {
|
||||
"description": "Tolerations for the operator to be installed.",
|
||||
"items": {
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"topologySpreadConstraints": {
|
||||
"description": "Topology Spread Constraints for the operator to be installed.",
|
||||
"items": {
|
||||
"required": []
|
||||
},
|
||||
"type": "array"
|
||||
},
|
||||
"updateStrategy": {
|
||||
"description": "Update strategy for the operator.\nref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy",
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"webhook": {
|
||||
"description": "The webhook configuration.",
|
||||
"properties": {
|
||||
"livenessProbe": {
|
||||
"properties": {
|
||||
"initialDelaySeconds": {
|
||||
"default": 3,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"mutating": {
|
||||
"properties": {
|
||||
"create": {
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"failurePolicy": {
|
||||
"default": "Fail",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"port": {
|
||||
"default": 9443,
|
||||
"type": "integer"
|
||||
},
|
||||
"readinessProbe": {
|
||||
"properties": {
|
||||
"initialDelaySeconds": {
|
||||
"default": 3,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"startupProbe": {
|
||||
"properties": {
|
||||
"failureThreshold": {
|
||||
"default": 6,
|
||||
"type": "integer"
|
||||
},
|
||||
"periodSeconds": {
|
||||
"default": 5,
|
||||
"type": "integer"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
},
|
||||
"validating": {
|
||||
"properties": {
|
||||
"create": {
|
||||
"default": true,
|
||||
"type": "boolean"
|
||||
},
|
||||
"failurePolicy": {
|
||||
"default": "Fail",
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
}
|
||||
},
|
||||
"required": [],
|
||||
"type": "object"
|
||||
}
|
||||
@@ -0,0 +1,700 @@
|
||||
#
|
||||
# Copyright © contributors to CloudNativePG, established as
|
||||
# CloudNativePG a Series of LF Projects, LLC.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
#
|
||||
# Default values for CloudNativePG.
|
||||
# This is a YAML-formatted file.
|
||||
# Please declare variables to be passed to your templates.
|
||||
|
||||
replicaCount: 1
|
||||
|
||||
image:
|
||||
repository: ghcr.io/cloudnative-pg/cloudnative-pg
|
||||
pullPolicy: IfNotPresent
|
||||
# -- Overrides the image tag whose default is the chart appVersion.
|
||||
tag: ""
|
||||
|
||||
imagePullSecrets: []
|
||||
nameOverride: ""
|
||||
fullnameOverride: ""
|
||||
namespaceOverride: ""
|
||||
|
||||
hostNetwork: false
|
||||
dnsPolicy: ""
|
||||
|
||||
# -- Update strategy for the operator.
|
||||
# ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#strategy
|
||||
updateStrategy: {}
|
||||
# For example:
|
||||
# type: RollingUpdate
|
||||
# rollingUpdate:
|
||||
# maxSurge: 25%
|
||||
# maxUnavailable: 25%
|
||||
|
||||
crds:
|
||||
# -- Specifies whether the CRDs should be created when installing the chart.
|
||||
create: true
|
||||
|
||||
# -- The webhook configuration.
|
||||
webhook:
|
||||
port: 9443
|
||||
mutating:
|
||||
create: true
|
||||
failurePolicy: Fail
|
||||
validating:
|
||||
create: true
|
||||
failurePolicy: Fail
|
||||
livenessProbe:
|
||||
initialDelaySeconds: 3
|
||||
readinessProbe:
|
||||
initialDelaySeconds: 3
|
||||
startupProbe:
|
||||
failureThreshold: 6
|
||||
periodSeconds: 5
|
||||
|
||||
# Operator configuration.
|
||||
config:
|
||||
# -- Specifies whether the secret should be created.
|
||||
create: true
|
||||
# -- The name of the configmap/secret to use.
|
||||
name: cnpg-controller-manager-config
|
||||
# -- Specifies whether it should be stored in a secret, instead of a configmap.
|
||||
secret: false
|
||||
# -- This option determines if the operator is responsible for observing
|
||||
# events across the entire Kubernetes cluster or if its focus should be
|
||||
# narrowed down to the specific namespace within which it has been deployed.
|
||||
clusterWide: true
|
||||
# -- The content of the configmap/secret, see
|
||||
# https://cloudnative-pg.io/documentation/current/operator_conf/#available-options
|
||||
# for all the available options.
|
||||
data: {}
|
||||
# INHERITED_ANNOTATIONS: categories
|
||||
# INHERITED_LABELS: environment, workload, app
|
||||
# WATCH_NAMESPACE: namespace-a,namespace-b
|
||||
|
||||
# -- The maximum number of concurrent reconciles. Defaults to 10.
|
||||
maxConcurrentReconciles: 10
|
||||
|
||||
# -- Additional arguments to be added to the operator's args list.
|
||||
additionalArgs: []
|
||||
|
||||
# -- Array containing extra environment variables which can be templated.
|
||||
additionalEnv: []
|
||||
# For example:
|
||||
# - name: RELEASE_NAME
|
||||
# value: "{{ .Release.Name }}"
|
||||
# - name: MY_VAR
|
||||
# value: "mySpecialKey"
|
||||
|
||||
serviceAccount:
|
||||
# -- Specifies whether the service account should be created.
|
||||
create: true
|
||||
# -- The name of the service account to use.
|
||||
# If not set and create is true, a name is generated using the fullname template.
|
||||
name: ""
|
||||
|
||||
rbac:
|
||||
# -- Specifies whether ClusterRole and ClusterRoleBinding should be created.
|
||||
create: true
|
||||
# -- Aggregate ClusterRoles to Kubernetes default user-facing roles.
|
||||
# Ref: https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles
|
||||
aggregateClusterRoles: false
|
||||
|
||||
# -- Annotations to be added to all other resources.
|
||||
commonAnnotations: {}
|
||||
# -- Annotations to be added to the pod.
|
||||
podAnnotations: {}
|
||||
# -- Labels to be added to the pod.
|
||||
podLabels: {}
|
||||
|
||||
# -- Container Security Context.
|
||||
containerSecurityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
readOnlyRootFilesystem: true
|
||||
runAsUser: 10001
|
||||
runAsGroup: 10001
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
capabilities:
|
||||
drop:
|
||||
- "ALL"
|
||||
|
||||
# -- Security Context for the whole pod.
|
||||
podSecurityContext:
|
||||
runAsNonRoot: true
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
# fsGroup: 2000
|
||||
|
||||
# -- Priority indicates the importance of a Pod relative to other Pods.
|
||||
priorityClassName: ""
|
||||
|
||||
service:
|
||||
type: ClusterIP
|
||||
# -- The name of the Webhook Service.
|
||||
name: cnpg-webhook-service
|
||||
# DO NOT CHANGE THE SERVICE NAME as it is currently used to generate the certificate
|
||||
# and can not be configured
|
||||
|
||||
port: 443
|
||||
# -- Set the ip family policy to configure dual-stack see [Configure dual-stack](https://kubernetes.io/docs/concepts/services-networking/dual-stack/#services)
|
||||
ipFamilyPolicy: ""
|
||||
# -- 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.
|
||||
ipFamilies: []
|
||||
|
||||
resources: {}
|
||||
# If you want to specify resources, uncomment the following
|
||||
# lines, adjust them as necessary, and remove the curly braces after 'resources:'.
|
||||
#
|
||||
# limits:
|
||||
# cpu: 100m
|
||||
# memory: 200Mi
|
||||
# requests:
|
||||
# cpu: 100m
|
||||
# memory: 100Mi
|
||||
|
||||
scratchData:
|
||||
# -- EmptyDir options for the scratch-data volume.
|
||||
emptyDir: {}
|
||||
|
||||
# -- Nodeselector for the operator to be installed.
|
||||
nodeSelector: {}
|
||||
|
||||
# -- Topology Spread Constraints for the operator to be installed.
|
||||
topologySpreadConstraints: []
|
||||
|
||||
# -- Tolerations for the operator to be installed.
|
||||
tolerations: []
|
||||
|
||||
# -- Affinity for the operator to be installed.
|
||||
affinity: {}
|
||||
|
||||
monitoring:
|
||||
|
||||
# -- Specifies whether the monitoring should be enabled. Requires Prometheus Operator CRDs.
|
||||
podMonitorEnabled: false
|
||||
# -- Metrics relabel configurations to apply to samples before ingestion.
|
||||
podMonitorMetricRelabelings: []
|
||||
# -- Relabel configurations to apply to samples before scraping.
|
||||
podMonitorRelabelings: []
|
||||
# -- Additional labels for the podMonitor
|
||||
podMonitorAdditionalLabels: {}
|
||||
|
||||
grafanaDashboard:
|
||||
create: false
|
||||
# -- Allows overriding the namespace where the ConfigMap will be created, defaulting to the same one as the Release.
|
||||
namespace: ""
|
||||
# -- The name of the ConfigMap containing the dashboard.
|
||||
configMapName: "cnpg-grafana-dashboard"
|
||||
# -- Label that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead.
|
||||
sidecarLabel: "grafana_dashboard"
|
||||
# -- Label value that ConfigMaps should have to be loaded as dashboards. DEPRECATED: Use labels instead.
|
||||
sidecarLabelValue: "1"
|
||||
# -- Labels that ConfigMaps should have to get configured in Grafana.
|
||||
labels: {}
|
||||
# -- Annotations that ConfigMaps can have to get configured in Grafana.
|
||||
annotations: {}
|
||||
|
||||
# Default monitoring queries
|
||||
monitoringQueriesConfigMap:
|
||||
# -- The name of the default monitoring configmap.
|
||||
name: cnpg-default-monitoring
|
||||
# -- A string representation of a YAML defining monitoring queries.
|
||||
queries: |
|
||||
backends:
|
||||
query: |
|
||||
SELECT sa.datname
|
||||
, sa.usename
|
||||
, sa.application_name
|
||||
, states.state
|
||||
, COALESCE(sa.count, 0) AS total
|
||||
, COALESCE(sa.max_tx_secs, 0) AS max_tx_duration_seconds
|
||||
FROM ( VALUES ('active')
|
||||
, ('idle')
|
||||
, ('idle in transaction')
|
||||
, ('idle in transaction (aborted)')
|
||||
, ('fastpath function call')
|
||||
, ('disabled')
|
||||
) AS states(state)
|
||||
LEFT JOIN (
|
||||
SELECT datname
|
||||
, state
|
||||
, usename
|
||||
, COALESCE(application_name, '') AS application_name
|
||||
, pg_catalog.count(*)
|
||||
, COALESCE(EXTRACT (EPOCH FROM (pg_catalog.max(pg_catalog.now() OPERATOR(pg_catalog.-) xact_start))), 0) AS max_tx_secs
|
||||
FROM pg_catalog.pg_stat_activity
|
||||
GROUP BY datname, state, usename, application_name
|
||||
) sa ON states.state OPERATOR(pg_catalog.=) sa.state
|
||||
WHERE sa.usename IS NOT NULL
|
||||
metrics:
|
||||
- datname:
|
||||
usage: "LABEL"
|
||||
description: "Name of the database"
|
||||
- usename:
|
||||
usage: "LABEL"
|
||||
description: "Name of the user"
|
||||
- application_name:
|
||||
usage: "LABEL"
|
||||
description: "Name of the application"
|
||||
- state:
|
||||
usage: "LABEL"
|
||||
description: "State of the backend"
|
||||
- total:
|
||||
usage: "GAUGE"
|
||||
description: "Number of backends"
|
||||
- max_tx_duration_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Maximum duration of a transaction in seconds"
|
||||
|
||||
backends_waiting:
|
||||
query: |
|
||||
SELECT pg_catalog.count(*) AS total
|
||||
FROM pg_catalog.pg_locks blocked_locks
|
||||
JOIN pg_catalog.pg_locks blocking_locks
|
||||
ON blocking_locks.locktype OPERATOR(pg_catalog.=) blocked_locks.locktype
|
||||
AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database
|
||||
AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation
|
||||
AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page
|
||||
AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple
|
||||
AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid
|
||||
AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid
|
||||
AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid
|
||||
AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid
|
||||
AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid
|
||||
AND blocking_locks.pid OPERATOR(pg_catalog.<>) blocked_locks.pid
|
||||
JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid OPERATOR(pg_catalog.=) blocking_locks.pid
|
||||
WHERE NOT blocked_locks.granted
|
||||
metrics:
|
||||
- total:
|
||||
usage: "GAUGE"
|
||||
description: "Total number of backends that are currently waiting on other queries"
|
||||
|
||||
pg_database:
|
||||
query: |
|
||||
SELECT datname
|
||||
, pg_catalog.pg_database_size(datname) AS size_bytes
|
||||
, pg_catalog.age(datfrozenxid) AS xid_age
|
||||
, pg_catalog.mxid_age(datminmxid) AS mxid_age
|
||||
FROM pg_catalog.pg_database
|
||||
WHERE datallowconn
|
||||
metrics:
|
||||
- datname:
|
||||
usage: "LABEL"
|
||||
description: "Name of the database"
|
||||
- size_bytes:
|
||||
usage: "GAUGE"
|
||||
description: "Disk space used by the database"
|
||||
- xid_age:
|
||||
usage: "GAUGE"
|
||||
description: "Number of transactions from the frozen XID to the current one"
|
||||
- mxid_age:
|
||||
usage: "GAUGE"
|
||||
description: "Number of multiple transactions (Multixact) from the frozen XID to the current one"
|
||||
|
||||
pg_postmaster:
|
||||
query: |
|
||||
SELECT EXTRACT(EPOCH FROM pg_postmaster_start_time) AS start_time
|
||||
FROM pg_catalog.pg_postmaster_start_time()
|
||||
metrics:
|
||||
- start_time:
|
||||
usage: "GAUGE"
|
||||
description: "Time at which postgres started (based on epoch)"
|
||||
|
||||
pg_replication:
|
||||
query: |
|
||||
SELECT CASE WHEN (
|
||||
NOT pg_catalog.pg_is_in_recovery()
|
||||
OR pg_catalog.pg_last_wal_receive_lsn() OPERATOR(pg_catalog.=) pg_catalog.pg_last_wal_replay_lsn())
|
||||
THEN 0
|
||||
ELSE GREATEST (0,
|
||||
EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) pg_catalog.pg_last_xact_replay_timestamp())))
|
||||
END AS lag,
|
||||
pg_catalog.pg_is_in_recovery() AS in_recovery,
|
||||
EXISTS (TABLE pg_catalog.pg_stat_wal_receiver) AS is_wal_receiver_up,
|
||||
(SELECT pg_catalog.count(*) FROM pg_catalog.pg_stat_replication) AS streaming_replicas
|
||||
metrics:
|
||||
- lag:
|
||||
usage: "GAUGE"
|
||||
description: "Replication lag behind primary in seconds"
|
||||
- in_recovery:
|
||||
usage: "GAUGE"
|
||||
description: "Whether the instance is in recovery"
|
||||
- is_wal_receiver_up:
|
||||
usage: "GAUGE"
|
||||
description: "Whether the instance wal_receiver is up"
|
||||
- streaming_replicas:
|
||||
usage: "GAUGE"
|
||||
description: "Number of streaming replicas connected to the instance"
|
||||
|
||||
pg_replication_slots:
|
||||
query: |
|
||||
SELECT slot_name,
|
||||
slot_type,
|
||||
database,
|
||||
active,
|
||||
(CASE pg_catalog.pg_is_in_recovery()
|
||||
WHEN TRUE THEN pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_last_wal_receive_lsn(), restart_lsn)
|
||||
ELSE pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), restart_lsn)
|
||||
END) as pg_wal_lsn_diff
|
||||
FROM pg_catalog.pg_replication_slots
|
||||
WHERE NOT temporary
|
||||
metrics:
|
||||
- slot_name:
|
||||
usage: "LABEL"
|
||||
description: "Name of the replication slot"
|
||||
- slot_type:
|
||||
usage: "LABEL"
|
||||
description: "Type of the replication slot"
|
||||
- database:
|
||||
usage: "LABEL"
|
||||
description: "Name of the database"
|
||||
- active:
|
||||
usage: "GAUGE"
|
||||
description: "Flag indicating whether the slot is active"
|
||||
- pg_wal_lsn_diff:
|
||||
usage: "GAUGE"
|
||||
description: "Replication lag in bytes"
|
||||
|
||||
pg_stat_archiver:
|
||||
query: |
|
||||
SELECT archived_count
|
||||
, failed_count
|
||||
, COALESCE(EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) last_archived_time)), -1) AS seconds_since_last_archival
|
||||
, COALESCE(EXTRACT(EPOCH FROM (pg_catalog.now() OPERATOR(pg_catalog.-) last_failed_time)), -1) AS seconds_since_last_failure
|
||||
, COALESCE(EXTRACT(EPOCH FROM last_archived_time), -1) AS last_archived_time
|
||||
, COALESCE(EXTRACT(EPOCH FROM last_failed_time), -1) AS last_failed_time
|
||||
, 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
|
||||
, 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
|
||||
, EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time
|
||||
FROM pg_catalog.pg_stat_archiver
|
||||
predicate_query: |
|
||||
SELECT NOT pg_catalog.pg_is_in_recovery()
|
||||
OR pg_catalog.current_setting('archive_mode') OPERATOR(pg_catalog.=) 'always'
|
||||
metrics:
|
||||
- archived_count:
|
||||
usage: "COUNTER"
|
||||
description: "Number of WAL files that have been successfully archived"
|
||||
- failed_count:
|
||||
usage: "COUNTER"
|
||||
description: "Number of failed attempts for archiving WAL files"
|
||||
- seconds_since_last_archival:
|
||||
usage: "GAUGE"
|
||||
description: "Seconds since the last successful archival operation"
|
||||
- seconds_since_last_failure:
|
||||
usage: "GAUGE"
|
||||
description: "Seconds since the last failed archival operation"
|
||||
- last_archived_time:
|
||||
usage: "GAUGE"
|
||||
description: "Epoch of the last time WAL archiving succeeded"
|
||||
- last_failed_time:
|
||||
usage: "GAUGE"
|
||||
description: "Epoch of the last time WAL archiving failed"
|
||||
- last_archived_wal_start_lsn:
|
||||
usage: "GAUGE"
|
||||
description: "Archived WAL start LSN"
|
||||
- last_failed_wal_start_lsn:
|
||||
usage: "GAUGE"
|
||||
description: "Last failed WAL LSN"
|
||||
- stats_reset_time:
|
||||
usage: "GAUGE"
|
||||
description: "Time at which these statistics were last reset"
|
||||
|
||||
pg_stat_bgwriter:
|
||||
runonserver: "<17.0.0"
|
||||
query: |
|
||||
SELECT checkpoints_timed
|
||||
, checkpoints_req
|
||||
, checkpoint_write_time
|
||||
, checkpoint_sync_time
|
||||
, buffers_checkpoint
|
||||
, buffers_clean
|
||||
, maxwritten_clean
|
||||
, buffers_backend
|
||||
, buffers_backend_fsync
|
||||
, buffers_alloc
|
||||
FROM pg_catalog.pg_stat_bgwriter
|
||||
metrics:
|
||||
- checkpoints_timed:
|
||||
usage: "COUNTER"
|
||||
description: "Number of scheduled checkpoints that have been performed"
|
||||
- checkpoints_req:
|
||||
usage: "COUNTER"
|
||||
description: "Number of requested checkpoints that have been performed"
|
||||
- checkpoint_write_time:
|
||||
usage: "COUNTER"
|
||||
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are written to disk, in milliseconds"
|
||||
- checkpoint_sync_time:
|
||||
usage: "COUNTER"
|
||||
description: "Total amount of time that has been spent in the portion of checkpoint processing where files are synchronized to disk, in milliseconds"
|
||||
- buffers_checkpoint:
|
||||
usage: "COUNTER"
|
||||
description: "Number of buffers written during checkpoints"
|
||||
- buffers_clean:
|
||||
usage: "COUNTER"
|
||||
description: "Number of buffers written by the background writer"
|
||||
- maxwritten_clean:
|
||||
usage: "COUNTER"
|
||||
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
|
||||
- buffers_backend:
|
||||
usage: "COUNTER"
|
||||
description: "Number of buffers written directly by a backend"
|
||||
- buffers_backend_fsync:
|
||||
usage: "COUNTER"
|
||||
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)"
|
||||
- buffers_alloc:
|
||||
usage: "COUNTER"
|
||||
description: "Number of buffers allocated"
|
||||
|
||||
pg_stat_bgwriter_17:
|
||||
runonserver: ">=17.0.0"
|
||||
name: pg_stat_bgwriter
|
||||
query: |
|
||||
SELECT buffers_clean
|
||||
, maxwritten_clean
|
||||
, buffers_alloc
|
||||
, EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time
|
||||
FROM pg_catalog.pg_stat_bgwriter
|
||||
metrics:
|
||||
- buffers_clean:
|
||||
usage: "COUNTER"
|
||||
description: "Number of buffers written by the background writer"
|
||||
- maxwritten_clean:
|
||||
usage: "COUNTER"
|
||||
description: "Number of times the background writer stopped a cleaning scan because it had written too many buffers"
|
||||
- buffers_alloc:
|
||||
usage: "COUNTER"
|
||||
description: "Number of buffers allocated"
|
||||
- stats_reset_time:
|
||||
usage: "GAUGE"
|
||||
description: "Time at which these statistics were last reset"
|
||||
|
||||
pg_stat_checkpointer:
|
||||
runonserver: ">=17.0.0"
|
||||
query: |
|
||||
SELECT num_timed AS checkpoints_timed
|
||||
, num_requested AS checkpoints_req
|
||||
, restartpoints_timed
|
||||
, restartpoints_req
|
||||
, restartpoints_done
|
||||
, write_time
|
||||
, sync_time
|
||||
, buffers_written
|
||||
, EXTRACT(EPOCH FROM stats_reset) AS stats_reset_time
|
||||
FROM pg_catalog.pg_stat_checkpointer
|
||||
metrics:
|
||||
- checkpoints_timed:
|
||||
usage: "COUNTER"
|
||||
description: "Number of scheduled checkpoints that have been performed"
|
||||
- checkpoints_req:
|
||||
usage: "COUNTER"
|
||||
description: "Number of requested checkpoints that have been performed"
|
||||
- restartpoints_timed:
|
||||
usage: "COUNTER"
|
||||
description: "Number of scheduled restartpoints due to timeout or after a failed attempt to perform it"
|
||||
- restartpoints_req:
|
||||
usage: "COUNTER"
|
||||
description: "Number of requested restartpoints that have been performed"
|
||||
- restartpoints_done:
|
||||
usage: "COUNTER"
|
||||
description: "Number of restartpoints that have been performed"
|
||||
- write_time:
|
||||
usage: "COUNTER"
|
||||
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"
|
||||
- sync_time:
|
||||
usage: "COUNTER"
|
||||
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"
|
||||
- buffers_written:
|
||||
usage: "COUNTER"
|
||||
description: "Number of buffers written during checkpoints and restartpoints"
|
||||
- stats_reset_time:
|
||||
usage: "GAUGE"
|
||||
description: "Time at which these statistics were last reset"
|
||||
|
||||
pg_stat_database:
|
||||
query: |
|
||||
SELECT datname
|
||||
, xact_commit
|
||||
, xact_rollback
|
||||
, blks_read
|
||||
, blks_hit
|
||||
, tup_returned
|
||||
, tup_fetched
|
||||
, tup_inserted
|
||||
, tup_updated
|
||||
, tup_deleted
|
||||
, conflicts
|
||||
, temp_files
|
||||
, temp_bytes
|
||||
, deadlocks
|
||||
, blk_read_time
|
||||
, blk_write_time
|
||||
FROM pg_catalog.pg_stat_database
|
||||
metrics:
|
||||
- datname:
|
||||
usage: "LABEL"
|
||||
description: "Name of this database"
|
||||
- xact_commit:
|
||||
usage: "COUNTER"
|
||||
description: "Number of transactions in this database that have been committed"
|
||||
- xact_rollback:
|
||||
usage: "COUNTER"
|
||||
description: "Number of transactions in this database that have been rolled back"
|
||||
- blks_read:
|
||||
usage: "COUNTER"
|
||||
description: "Number of disk blocks read in this database"
|
||||
- blks_hit:
|
||||
usage: "COUNTER"
|
||||
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)"
|
||||
- tup_returned:
|
||||
usage: "COUNTER"
|
||||
description: "Number of rows returned by queries in this database"
|
||||
- tup_fetched:
|
||||
usage: "COUNTER"
|
||||
description: "Number of rows fetched by queries in this database"
|
||||
- tup_inserted:
|
||||
usage: "COUNTER"
|
||||
description: "Number of rows inserted by queries in this database"
|
||||
- tup_updated:
|
||||
usage: "COUNTER"
|
||||
description: "Number of rows updated by queries in this database"
|
||||
- tup_deleted:
|
||||
usage: "COUNTER"
|
||||
description: "Number of rows deleted by queries in this database"
|
||||
- conflicts:
|
||||
usage: "COUNTER"
|
||||
description: "Number of queries canceled due to conflicts with recovery in this database"
|
||||
- temp_files:
|
||||
usage: "COUNTER"
|
||||
description: "Number of temporary files created by queries in this database"
|
||||
- temp_bytes:
|
||||
usage: "COUNTER"
|
||||
description: "Total amount of data written to temporary files by queries in this database"
|
||||
- deadlocks:
|
||||
usage: "COUNTER"
|
||||
description: "Number of deadlocks detected in this database"
|
||||
- blk_read_time:
|
||||
usage: "COUNTER"
|
||||
description: "Time spent reading data file blocks by backends in this database, in milliseconds"
|
||||
- blk_write_time:
|
||||
usage: "COUNTER"
|
||||
description: "Time spent writing data file blocks by backends in this database, in milliseconds"
|
||||
|
||||
pg_stat_replication:
|
||||
primary: true
|
||||
query: |
|
||||
SELECT usename
|
||||
, COALESCE(application_name, '') AS application_name
|
||||
, COALESCE(client_addr::text, '') AS client_addr
|
||||
, COALESCE(client_port::text, '') AS client_port
|
||||
, EXTRACT(EPOCH FROM backend_start) AS backend_start
|
||||
, COALESCE(pg_catalog.age(backend_xmin), 0) AS backend_xmin_age
|
||||
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), sent_lsn) AS sent_diff_bytes
|
||||
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), write_lsn) AS write_diff_bytes
|
||||
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), flush_lsn) AS flush_diff_bytes
|
||||
, COALESCE(pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), replay_lsn),0) AS replay_diff_bytes
|
||||
, COALESCE((EXTRACT(EPOCH FROM write_lag)),0)::float AS write_lag_seconds
|
||||
, COALESCE((EXTRACT(EPOCH FROM flush_lag)),0)::float AS flush_lag_seconds
|
||||
, COALESCE((EXTRACT(EPOCH FROM replay_lag)),0)::float AS replay_lag_seconds
|
||||
FROM pg_catalog.pg_stat_replication
|
||||
metrics:
|
||||
- usename:
|
||||
usage: "LABEL"
|
||||
description: "Name of the replication user"
|
||||
- application_name:
|
||||
usage: "LABEL"
|
||||
description: "Name of the application"
|
||||
- client_addr:
|
||||
usage: "LABEL"
|
||||
description: "Client IP address"
|
||||
- client_port:
|
||||
usage: "LABEL"
|
||||
description: "Client TCP port"
|
||||
- backend_start:
|
||||
usage: "COUNTER"
|
||||
description: "Time when this process was started"
|
||||
- backend_xmin_age:
|
||||
usage: "COUNTER"
|
||||
description: "The age of this standby's xmin horizon"
|
||||
- sent_diff_bytes:
|
||||
usage: "GAUGE"
|
||||
description: "Difference in bytes from the last write-ahead log location sent on this connection"
|
||||
- write_diff_bytes:
|
||||
usage: "GAUGE"
|
||||
description: "Difference in bytes from the last write-ahead log location written to disk by this standby server"
|
||||
- flush_diff_bytes:
|
||||
usage: "GAUGE"
|
||||
description: "Difference in bytes from the last write-ahead log location flushed to disk by this standby server"
|
||||
- replay_diff_bytes:
|
||||
usage: "GAUGE"
|
||||
description: "Difference in bytes from the last write-ahead log location replayed into the database on this standby server"
|
||||
- write_lag_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written it"
|
||||
- flush_lag_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written and flushed it"
|
||||
- replay_lag_seconds:
|
||||
usage: "GAUGE"
|
||||
description: "Time elapsed between flushing recent WAL locally and receiving notification that this standby server has written, flushed and applied it"
|
||||
|
||||
pg_settings:
|
||||
query: |
|
||||
SELECT name,
|
||||
CASE setting WHEN 'on' THEN '1' WHEN 'off' THEN '0' ELSE setting END AS setting
|
||||
FROM pg_catalog.pg_settings
|
||||
WHERE vartype IN ('integer', 'real', 'bool')
|
||||
ORDER BY 1
|
||||
metrics:
|
||||
- name:
|
||||
usage: "LABEL"
|
||||
description: "Name of the setting"
|
||||
- setting:
|
||||
usage: "GAUGE"
|
||||
description: "Setting value"
|
||||
|
||||
pg_extensions:
|
||||
query: |
|
||||
SELECT
|
||||
pg_catalog.current_database() as datname,
|
||||
name as extname,
|
||||
default_version,
|
||||
installed_version,
|
||||
CASE
|
||||
WHEN default_version OPERATOR(pg_catalog.=) installed_version THEN 0
|
||||
ELSE 1
|
||||
END AS update_available
|
||||
FROM pg_catalog.pg_available_extensions
|
||||
WHERE installed_version IS NOT NULL
|
||||
metrics:
|
||||
- datname:
|
||||
usage: "LABEL"
|
||||
description: "Name of the database"
|
||||
- extname:
|
||||
usage: "LABEL"
|
||||
description: "Extension name"
|
||||
- default_version:
|
||||
usage: "LABEL"
|
||||
description: "Default version"
|
||||
- installed_version:
|
||||
usage: "LABEL"
|
||||
description: "Installed version"
|
||||
- update_available:
|
||||
usage: "GAUGE"
|
||||
description: "An update is available"
|
||||
target_databases:
|
||||
- '*'
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- app.yaml
|
||||
|
||||
helmCharts:
|
||||
- name: cloudnative-pg
|
||||
repo: https://cloudnative-pg.github.io/charts
|
||||
version: 0.29.1
|
||||
releaseName: cnpg
|
||||
namespace: cnpg-system
|
||||
valuesFile: values.yaml
|
||||
includeCRDs: true
|
||||
@@ -0,0 +1,4 @@
|
||||
# CloudNativePG operator (chart 0.29.x = operator 1.30.x)
|
||||
|
||||
crds:
|
||||
create: true
|
||||
@@ -0,0 +1,22 @@
|
||||
apiVersion: argoproj.io/v1alpha1
|
||||
kind: Application
|
||||
metadata:
|
||||
name: postgresql
|
||||
namespace: argocd
|
||||
spec:
|
||||
project: core
|
||||
destination:
|
||||
namespace: psql
|
||||
server: https://kubernetes.default.svc
|
||||
source:
|
||||
repoURL: https://gt.hexor.cy/ab/homelab.git
|
||||
targetRevision: k8s-ng
|
||||
path: k8s-ng/postgresql
|
||||
syncPolicy:
|
||||
automated:
|
||||
selfHeal: true
|
||||
prune: false # never delete databases because of a manifest change
|
||||
syncOptions:
|
||||
- CreateNamespace=true
|
||||
- ServerSideApply=true
|
||||
- SkipDryRunOnMissingResource=true # the cnpg Application installs the CRDs
|
||||
@@ -0,0 +1,48 @@
|
||||
# Main HA PostgreSQL cluster: one primary and one streaming replica, each on its
|
||||
# own node with a node-local volume. Replication is asynchronous (nodes sit in
|
||||
# different regions), so a failover can lose the last few transactions.
|
||||
#
|
||||
# Nodes eligible for instances carry the label workload/postgres=true. To move a
|
||||
# replica: label the new node, unlabel the old one, then recreate the instance
|
||||
# (kubectl cnpg destroy main <N>); the operator re-clones it from the primary.
|
||||
#
|
||||
# Endpoints inside the cluster: main-rw (primary), main-ro (replicas),
|
||||
# main-r (any instance) in the psql namespace.
|
||||
apiVersion: postgresql.cnpg.io/v1
|
||||
kind: Cluster
|
||||
metadata:
|
||||
name: main
|
||||
namespace: psql
|
||||
spec:
|
||||
description: Main HA PostgreSQL cluster
|
||||
imageName: ghcr.io/cloudnative-pg/postgresql:17
|
||||
instances: 2
|
||||
enableSuperuserAccess: false
|
||||
|
||||
# Roll updates replica-first and hand over by switchover instead of restarting the primary.
|
||||
primaryUpdateStrategy: unsupervised
|
||||
primaryUpdateMethod: switchover
|
||||
|
||||
storage:
|
||||
storageClass: local-path
|
||||
size: 20Gi # local-path volumes cannot be expanded later
|
||||
|
||||
affinity:
|
||||
enablePodAntiAffinity: true
|
||||
podAntiAffinityType: required
|
||||
topologyKey: kubernetes.io/hostname
|
||||
nodeSelector:
|
||||
workload/postgres: "true"
|
||||
|
||||
resources:
|
||||
requests:
|
||||
cpu: 500m
|
||||
memory: 1Gi
|
||||
limits:
|
||||
memory: 2Gi
|
||||
|
||||
postgresql:
|
||||
parameters:
|
||||
max_connections: "200"
|
||||
shared_buffers: 512MB
|
||||
effective_cache_size: 1536MB
|
||||
@@ -0,0 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- app.yaml
|
||||
- cluster.yaml
|
||||
Reference in new issue
Block a user