Skip to content

Commit 66b3102

Browse files
authored
Merge branch 'main' into fix/null-external-clusters
2 parents 5401c65 + 2c85b15 commit 66b3102

25 files changed

+1905
-83
lines changed

RELEASE.md

Lines changed: 94 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ release (e.g. 1.17.1)
1515
## Charts
1616

1717
1. [Releasing the `cloudnative-pg` chart](#releasing-the-cloudnative-pg-chart)
18-
2. [Releasing `cluster` chart](#releasing-the-cluster-chart)
18+
2. [Releasing the `cluster` chart](#releasing-the-cluster-chart)
19+
3. [Releasing the `plugin-barman-cloud` chart](#releasing-the-plugin-barman-cloud)
1920

2021
## Releasing the `cloudnative-pg` chart
2122

@@ -25,7 +26,8 @@ In order to create a new release of the `cloudnative-pg` chart, follow these ste
2526
```bash
2627
OLD_VERSION=$(yq -r '.version' charts/cloudnative-pg/Chart.yaml)
2728
OLD_CNPG_VERSION=$(yq -r '.appVersion' charts/cloudnative-pg/Chart.yaml)
28-
echo $OLD_VERSION
29+
echo Old chart version: $OLD_VERSION
30+
echo Old CNPG version: $OLD_CNPG_VERSION
2931
```
3032
2. Decide which version to create, depending on the kind of jump of the CloudNativePG release, following semver
3133
semantics. For this document, let's call it `X.Y.Z`
@@ -44,8 +46,8 @@ In order to create a new release of the `cloudnative-pg` chart, follow these ste
4446
want to:
4547
1. Find the latest `cloudnative-pg` version by running:
4648
```bash
47-
NEW_CNPG_VERSION=$(curl "https://api.github.com/repos/cloudnative-pg/cloudnative-pg/tags" | jq -r '.[0].name | ltrimstr("v")')
48-
echo $NEW_CNPG_VERSION
49+
NEW_CNPG_VERSION=$(curl -Ssl "https://api.github.com/repos/cloudnative-pg/cloudnative-pg/tags" | jq -r '.[0].name | ltrimstr("v")')
50+
echo New CNPG version: $NEW_CNPG_VERSION
4951
```
5052
2. Update `.appVersion` in the [Chart.yaml](./charts/cloudnative-pg/Chart.yaml) file
5153
```bash
@@ -155,3 +157,91 @@ In order to create a new release of the `cluster` chart, follow these steps:
155157
helm search repo cnpg
156158
```
157159
and be able to see the new version `X.Y.Z` as `CHART VERSION` for `cluster`
160+
161+
## Releasing the `plugin-barman-cloud` chart
162+
163+
In order to create a new release of the `plugin-barman-cloud` chart, follow these steps:
164+
165+
1. Take note of the current value of the release: see `.version` in `charts/plugin-barman-cloud/Chart.yaml`
166+
```bash
167+
OLD_VERSION=$(yq -r '.version' charts/plugin-barman-cloud/Chart.yaml)
168+
OLD_APP_VERSION=$(yq -r '.appVersion' charts/plugin-barman-cloud/Chart.yaml)
169+
echo Old chart version: $OLD_VERSION
170+
echo Old app version: $OLD_APP_VERSION
171+
```
172+
2. Decide which version to create, depending on the kind of jump of the CloudNativePG release, following semver
173+
semantics. For this document, let's call it `X.Y.Z`
174+
```bash
175+
NEW_VERSION="X.Y.Z"
176+
```
177+
3. Create a branch named `release/plugin-barman-cloud-vX.Y.Z` and switch to it:
178+
```bash
179+
git switch --create release/plugin-barman-cloud-v$NEW_VERSION
180+
```
181+
4. Update the `.version` in the [Chart.yaml](./charts/plugin-barman-cloud/Chart.yaml) file to `"X.Y.Z"`
182+
```bash
183+
sed -i -E "s/^version: \"([0-9]+.?)+\"/version: \"$NEW_VERSION\"/" charts/plugin-barman-cloud/Chart.yaml
184+
```
185+
5. Update everything else as required, e.g. if releasing due to a new `plugin-barman-cloud` version being released, you might
186+
want to:
187+
1. Find the latest `plugin-barman-cloud` version by running:
188+
```bash
189+
NEW_APP_VERSION=$(curl -Ssl "https://api.github.com/repos/cloudnative-pg/plugin-barman-cloud/tags" | jq -r '.[0].name')
190+
echo New app version: $NEW_APP_VERSION
191+
```
192+
2. Update `.appVersion` in the [Chart.yaml](./charts/plugin-barman-cloud/Chart.yaml) file
193+
```bash
194+
sed -i -E "s/^appVersion: \"v([0-9]+.?)+\"/appVersion: \"$NEW_APP_VERSION\"/" charts/plugin-barman-cloud/Chart.yaml
195+
```
196+
3. Update [crds.yaml](./charts/plugin-barman-cloud/templates/crds/crds.yaml), which can be built using
197+
[kustomize](https://kustomize.io/) from the `plugin-barman-cloud` repo using kustomize
198+
[remoteBuild](https://github.com/kubernetes-sigs/kustomize/blob/master/examples/remoteBuild.md)
199+
running:
200+
201+
Verify the version is correct. Edit it if incorrect, then run:
202+
```bash
203+
echo '{{- if .Values.crds.create }}' > ./charts/plugin-barman-cloud/templates/crds/crds.yaml
204+
kustomize build https://github.com/cloudnative-pg/plugin-barman-cloud/config/crd/\?ref\=$NEW_APP_VERSION >> ./charts/plugin-barman-cloud/templates/crds/crds.yaml
205+
echo '{{- end }}' >> ./charts/plugin-barman-cloud/templates/crds/crds.yaml
206+
```
207+
208+
Check that the `helm.sh/resource-policy: keep` annotation is still present after regenerating the CRDs.
209+
4. To update the files in the [templates](./charts/plugin-barman-cloud/templates) directory, you can diff the previous
210+
CNPG release yaml against the new one, to find what should be updated (e.g.
211+
```bash
212+
vimdiff \
213+
"https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/${OLD_APP_VERSION}/manifest.yaml" \
214+
"https://github.com/cloudnative-pg/plugin-barman-cloud/releases/download/${NEW_APP_VERSION}/manifest.yaml"
215+
```
216+
217+
5. Update [values.yaml](./charts/plugin-barman-cloud/values.yaml) if needed
218+
6. NOTE: updating `values.yaml` just for the appVersion may not be necessary, as the value should default to the
219+
`appVersion` in `Chart.yaml`
220+
6. Run `make docs schema` to regenerate the docs and the values schema in case it is needed
221+
```bash
222+
make docs schema
223+
```
224+
7. Commit and add the relevant information you wish in the commit message.
225+
```bash
226+
git add .
227+
git commit -S -s -m "Release plugin-barman-cloud-v$NEW_VERSION" --edit
228+
```
229+
8. Push the new branch
230+
```bash
231+
git push --set-upstream origin release/plugin-barman-cloud-v$NEW_VERSION
232+
```
233+
9. A PR named `Release plugin-barman-cloud-vX.Y.Z` should be automatically created
234+
10. Wait for all the checks to pass
235+
11. Two approvals are required in order to merge the PR, if you are a maintainer approve the PR yourself and ask for
236+
another approval, otherwise ask for two approvals directly.
237+
12. Merge the PR squashing all commits and **taking care to keep the commit message to be
238+
`Release plugin-barman-cloud-vX.Y.Z`**
239+
13. A release `plugin-barman-cloud-vX.Y.Z` should be automatically created by an action, which will then trigger the release
240+
action. Verify they both are successful.
241+
14. Once done you should be able to run:
242+
```bash
243+
helm repo add cnpg https://cloudnative-pg.github.io/charts
244+
helm repo update
245+
helm search repo cnpg
246+
```
247+
and be able to see the new version `X.Y.Z` as `CHART VERSION` for `plugin-barman-cloud`

SECURITY.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Security Policy
2+
3+
For the most current and detailed version of our security procedures, please
4+
refer to the [official CloudNativePG Security Policy](https://github.com/cloudnative-pg/cloudnative-pg/blob/main/SECURITY.md).

charts/cloudnative-pg/templates/deployment.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ spec:
101101
livenessProbe:
102102
httpGet:
103103
path: /readyz
104-
port: {{ .Values.webhook.port }}
104+
port: webhook-server
105105
scheme: HTTPS
106106
{{- if .Values.webhook.livenessProbe.initialDelaySeconds }}
107107
initialDelaySeconds: {{ .Values.webhook.livenessProbe.initialDelaySeconds }}
@@ -117,7 +117,7 @@ spec:
117117
readinessProbe:
118118
httpGet:
119119
path: /readyz
120-
port: {{ .Values.webhook.port }}
120+
port: webhook-server
121121
scheme: HTTPS
122122
{{- if .Values.webhook.readinessProbe.initialDelaySeconds }}
123123
initialDelaySeconds: {{ .Values.webhook.readinessProbe.initialDelaySeconds }}
@@ -132,7 +132,7 @@ spec:
132132
{{- end }}
133133
httpGet:
134134
path: /readyz
135-
port: {{ .Values.webhook.port }}
135+
port: webhook-server
136136
scheme: HTTPS
137137
{{- if .Values.webhook.startupProbe.periodSeconds }}
138138
periodSeconds: {{ .Values.webhook.startupProbe.periodSeconds }}

charts/cloudnative-pg/values.yaml

Lines changed: 72 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -210,30 +210,30 @@ monitoringQueriesConfigMap:
210210
queries: |
211211
backends:
212212
query: |
213-
SELECT sa.datname
214-
, sa.usename
215-
, sa.application_name
216-
, states.state
217-
, COALESCE(sa.count, 0) AS total
218-
, COALESCE(sa.max_tx_secs, 0) AS max_tx_duration_seconds
219-
FROM ( VALUES ('active')
220-
, ('idle')
221-
, ('idle in transaction')
222-
, ('idle in transaction (aborted)')
223-
, ('fastpath function call')
224-
, ('disabled')
225-
) AS states(state)
226-
LEFT JOIN (
227-
SELECT datname
228-
, state
229-
, usename
230-
, COALESCE(application_name, '') AS application_name
231-
, COUNT(*)
232-
, COALESCE(EXTRACT (EPOCH FROM (max(now() - xact_start))), 0) AS max_tx_secs
233-
FROM pg_catalog.pg_stat_activity
234-
GROUP BY datname, state, usename, application_name
235-
) sa ON states.state = sa.state
236-
WHERE sa.usename IS NOT NULL
213+
SELECT sa.datname
214+
, sa.usename
215+
, sa.application_name
216+
, states.state
217+
, COALESCE(sa.count, 0) AS total
218+
, COALESCE(sa.max_tx_secs, 0) AS max_tx_duration_seconds
219+
FROM ( VALUES ('active')
220+
, ('idle')
221+
, ('idle in transaction')
222+
, ('idle in transaction (aborted)')
223+
, ('fastpath function call')
224+
, ('disabled')
225+
) AS states(state)
226+
LEFT JOIN (
227+
SELECT datname
228+
, state
229+
, usename
230+
, COALESCE(application_name, '') AS application_name
231+
, COUNT(*)
232+
, COALESCE(EXTRACT (EPOCH FROM (max(now() - xact_start))), 0) AS max_tx_secs
233+
FROM pg_catalog.pg_stat_activity
234+
GROUP BY datname, state, usename, application_name
235+
) sa ON states.state = sa.state
236+
WHERE sa.usename IS NOT NULL
237237
metrics:
238238
- datname:
239239
usage: "LABEL"
@@ -256,22 +256,22 @@ monitoringQueriesConfigMap:
256256
257257
backends_waiting:
258258
query: |
259-
SELECT count(*) AS total
260-
FROM pg_catalog.pg_locks blocked_locks
261-
JOIN pg_catalog.pg_locks blocking_locks
262-
ON blocking_locks.locktype = blocked_locks.locktype
263-
AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database
264-
AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation
265-
AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page
266-
AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple
267-
AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid
268-
AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid
269-
AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid
270-
AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid
271-
AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid
272-
AND blocking_locks.pid != blocked_locks.pid
273-
JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid = blocking_locks.pid
274-
WHERE NOT blocked_locks.granted
259+
SELECT count(*) AS total
260+
FROM pg_catalog.pg_locks blocked_locks
261+
JOIN pg_catalog.pg_locks blocking_locks
262+
ON blocking_locks.locktype = blocked_locks.locktype
263+
AND blocking_locks.database IS NOT DISTINCT FROM blocked_locks.database
264+
AND blocking_locks.relation IS NOT DISTINCT FROM blocked_locks.relation
265+
AND blocking_locks.page IS NOT DISTINCT FROM blocked_locks.page
266+
AND blocking_locks.tuple IS NOT DISTINCT FROM blocked_locks.tuple
267+
AND blocking_locks.virtualxid IS NOT DISTINCT FROM blocked_locks.virtualxid
268+
AND blocking_locks.transactionid IS NOT DISTINCT FROM blocked_locks.transactionid
269+
AND blocking_locks.classid IS NOT DISTINCT FROM blocked_locks.classid
270+
AND blocking_locks.objid IS NOT DISTINCT FROM blocked_locks.objid
271+
AND blocking_locks.objsubid IS NOT DISTINCT FROM blocked_locks.objsubid
272+
AND blocking_locks.pid != blocked_locks.pid
273+
JOIN pg_catalog.pg_stat_activity blocking_activity ON blocking_activity.pid = blocking_locks.pid
274+
WHERE NOT blocked_locks.granted
275275
metrics:
276276
- total:
277277
usage: "GAUGE"
@@ -309,16 +309,17 @@ monitoringQueriesConfigMap:
309309
description: "Time at which postgres started (based on epoch)"
310310
311311
pg_replication:
312-
query: "SELECT CASE WHEN (
313-
NOT pg_catalog.pg_is_in_recovery()
314-
OR pg_catalog.pg_last_wal_receive_lsn() = pg_catalog.pg_last_wal_replay_lsn())
315-
THEN 0
316-
ELSE GREATEST (0,
317-
EXTRACT(EPOCH FROM (now() - pg_catalog.pg_last_xact_replay_timestamp())))
318-
END AS lag,
319-
pg_catalog.pg_is_in_recovery() AS in_recovery,
320-
EXISTS (TABLE pg_stat_wal_receiver) AS is_wal_receiver_up,
321-
(SELECT count(*) FROM pg_catalog.pg_stat_replication) AS streaming_replicas"
312+
query: |
313+
SELECT CASE WHEN (
314+
NOT pg_catalog.pg_is_in_recovery()
315+
OR pg_catalog.pg_last_wal_receive_lsn() = pg_catalog.pg_last_wal_replay_lsn())
316+
THEN 0
317+
ELSE GREATEST (0,
318+
EXTRACT(EPOCH FROM (now() - pg_catalog.pg_last_xact_replay_timestamp())))
319+
END AS lag,
320+
pg_catalog.pg_is_in_recovery() AS in_recovery,
321+
EXISTS (TABLE pg_stat_wal_receiver) AS is_wal_receiver_up,
322+
(SELECT count(*) FROM pg_catalog.pg_stat_replication) AS streaming_replicas
322323
metrics:
323324
- lag:
324325
usage: "GAUGE"
@@ -586,20 +587,20 @@ monitoringQueriesConfigMap:
586587
pg_stat_replication:
587588
primary: true
588589
query: |
589-
SELECT usename
590-
, COALESCE(application_name, '') AS application_name
591-
, COALESCE(client_addr::text, '') AS client_addr
592-
, COALESCE(client_port::text, '') AS client_port
593-
, EXTRACT(EPOCH FROM backend_start) AS backend_start
594-
, COALESCE(pg_catalog.age(backend_xmin), 0) AS backend_xmin_age
595-
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), sent_lsn) AS sent_diff_bytes
596-
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), write_lsn) AS write_diff_bytes
597-
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), flush_lsn) AS flush_diff_bytes
598-
, COALESCE(pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), replay_lsn),0) AS replay_diff_bytes
599-
, COALESCE((EXTRACT(EPOCH FROM write_lag)),0)::float AS write_lag_seconds
600-
, COALESCE((EXTRACT(EPOCH FROM flush_lag)),0)::float AS flush_lag_seconds
601-
, COALESCE((EXTRACT(EPOCH FROM replay_lag)),0)::float AS replay_lag_seconds
602-
FROM pg_catalog.pg_stat_replication
590+
SELECT usename
591+
, COALESCE(application_name, '') AS application_name
592+
, COALESCE(client_addr::text, '') AS client_addr
593+
, COALESCE(client_port::text, '') AS client_port
594+
, EXTRACT(EPOCH FROM backend_start) AS backend_start
595+
, COALESCE(pg_catalog.age(backend_xmin), 0) AS backend_xmin_age
596+
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), sent_lsn) AS sent_diff_bytes
597+
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), write_lsn) AS write_diff_bytes
598+
, pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), flush_lsn) AS flush_diff_bytes
599+
, COALESCE(pg_catalog.pg_wal_lsn_diff(pg_catalog.pg_current_wal_lsn(), replay_lsn),0) AS replay_diff_bytes
600+
, COALESCE((EXTRACT(EPOCH FROM write_lag)),0)::float AS write_lag_seconds
601+
, COALESCE((EXTRACT(EPOCH FROM flush_lag)),0)::float AS flush_lag_seconds
602+
, COALESCE((EXTRACT(EPOCH FROM replay_lag)),0)::float AS replay_lag_seconds
603+
FROM pg_catalog.pg_stat_replication
603604
metrics:
604605
- usename:
605606
usage: "LABEL"
@@ -659,13 +660,13 @@ monitoringQueriesConfigMap:
659660
pg_extensions:
660661
query: |
661662
SELECT
662-
current_database() as datname,
663-
name as extname,
664-
default_version,
665-
installed_version,
666-
CASE
667-
WHEN default_version = installed_version THEN 0
668-
ELSE 1
663+
current_database() as datname,
664+
name as extname,
665+
default_version,
666+
installed_version,
667+
CASE
668+
WHEN default_version = installed_version THEN 0
669+
ELSE 1
669670
END AS update_available
670671
FROM pg_catalog.pg_available_extensions
671672
WHERE installed_version IS NOT NULL

charts/cluster/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ refer to the [CloudNativePG Documentation](https://cloudnative-pg.io/documentat
168168
| cluster.monitoring.customQueriesSecret | list | `[]` | The list of secrets containing the custom queries |
169169
| cluster.monitoring.disableDefaultQueries | bool | `false` | Whether the default queries should be injected. Set it to true if you don't want to inject default queries into the cluster. |
170170
| cluster.monitoring.enabled | bool | `false` | Whether to enable monitoring |
171+
| cluster.monitoring.instrumentation.logicalReplication | bool | `true` | Enable logical replication metrics |
171172
| cluster.monitoring.podMonitor.enabled | bool | `true` | Whether to enable the PodMonitor |
172173
| cluster.monitoring.podMonitor.metricRelabelings | list | `[]` | The list of metric relabelings for the PodMonitor. Applied to samples before ingestion. |
173174
| cluster.monitoring.podMonitor.relabelings | list | `[]` | The list of relabelings for the PodMonitor. Applied to samples before scraping. |

0 commit comments

Comments
 (0)