Skip to content

Commit

Permalink
chore(PSQL): Postgres 17 Upgrade (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurVardevanyan authored Dec 19, 2024
1 parent c81a6a1 commit 34d3837
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 79 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -492,6 +492,7 @@
"podspec",
"portainer",
"portmap",
"postgrescluster",
"postgresoperator",
"postrotate",
"PPROF",
Expand Down
23 changes: 12 additions & 11 deletions kubernetes/awx/base/postgres/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
labels:
app.kubernetes.io/instance: awx
spec:
shutdown: false
backups:
pgbackrest:
configuration:
Expand Down Expand Up @@ -135,29 +136,29 @@ spec:
# memory: 128Mi
openshift: true
port: 5432
postgresVersion: 15
postgresVersion: 17
# ---
# apiVersion: postgres-operator.crunchydata.com/v1beta1
# kind: PGUpgrade
# metadata:
# name: awx-upgrade
# namespace: postgres
# namespace: awx
# spec:
# fromPostgresVersion: 14
# fromPostgresVersion: 15
# postgresClusterName: awx
# toPostgresVersion: 15
# toPostgresVersion: 17

# kubectl delete ResourceQuota -n postgres --all
# kubectl delete LimitRange -n postgres --all
# kubectl delete ResourceQuota -n awx --all
# kubectl delete LimitRange -n awx --all

# kubectl patch postgrescluster awx -n postgres --type=merge \
# kubectl patch postgrescluster awx -n awx --type=merge \
# -p '{"spec":{"shutdown":true}}'

# kubectl annotate postgrescluster awx -n postgres \
# kubectl annotate postgrescluster awx -n awx \
# postgres-operator.crunchydata.com/allow-upgrade=awx-upgrade

# kubectl patch postgrescluster awx -n postgres --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":15}]'
# kubectl patch postgrescluster awx -n awx --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":17}]'

# kubectl patch postgrescluster awx -n postgres --type=merge \
# kubectl patch postgrescluster awx -n awx --type=merge \
# -p '{"spec":{"shutdown":false}}'
25 changes: 13 additions & 12 deletions kubernetes/gitea/base/postgres/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
labels:
app.kubernetes.io/instance: gitea
spec:
shutdown: false
backups:
pgbackrest:
configuration:
Expand Down Expand Up @@ -135,29 +136,29 @@ spec:
# memory: 128Mi
openshift: true
port: 5432
postgresVersion: 15
# ---
postgresVersion: 17
---
# apiVersion: postgres-operator.crunchydata.com/v1beta1
# kind: PGUpgrade
# metadata:
# name: gitea-upgrade
# namespace: postgres
# namespace: gitea
# spec:
# fromPostgresVersion: 14
# fromPostgresVersion: 15
# postgresClusterName: gitea
# toPostgresVersion: 15
# toPostgresVersion: 17

# kubectl delete ResourceQuota -n postgres --all
# kubectl delete LimitRange -n postgres --all
# kubectl delete ResourceQuota -n gitea --all
# kubectl delete LimitRange -n gitea --all

# kubectl patch postgrescluster gitea -n postgres --type=merge \
# kubectl patch postgrescluster gitea -n gitea --type=merge \
# -p '{"spec":{"shutdown":true}}'

# kubectl annotate postgrescluster gitea -n postgres \
# kubectl annotate postgrescluster gitea -n gitea \
# postgres-operator.crunchydata.com/allow-upgrade=gitea-upgrade

# kubectl patch postgrescluster gitea -n postgres --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":15}]'
# kubectl patch postgrescluster gitea -n gitea --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":17}]'

# kubectl patch postgrescluster gitea -n postgres --type=merge \
# kubectl patch postgrescluster gitea -n gitea --type=merge \
# -p '{"spec":{"shutdown":false}}'
28 changes: 27 additions & 1 deletion kubernetes/homeassistant/base/postgres/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
labels:
app.kubernetes.io/instance: homeassistant
spec:
shutdown: false
backups:
pgbackrest:
# configuration:
Expand Down Expand Up @@ -137,4 +138,29 @@ spec:
# memory: 128Mi
openshift: true
port: 5432
postgresVersion: 15
postgresVersion: 17
# ---
# apiVersion: postgres-operator.crunchydata.com/v1beta1
# kind: PGUpgrade
# metadata:
# name: homeassistant-upgrade
# namespace: homeassistant
# spec:
# fromPostgresVersion: 15
# postgresClusterName: homeassistant
# toPostgresVersion: 17

# kubectl delete ResourceQuota -n homeassistant --all
# kubectl delete LimitRange -n homeassistant --all

# kubectl patch postgrescluster homeassistant -n homeassistant --type=merge \
# -p '{"spec":{"shutdown":true}}'

# kubectl annotate postgrescluster homeassistant -n homeassistant \
# postgres-operator.crunchydata.com/allow-upgrade=homeassistant-upgrade

# kubectl patch postgrescluster homeassistant -n homeassistant --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":17}]'

# kubectl patch postgrescluster homeassistant -n homeassistant --type=merge \
# -p '{"spec":{"shutdown":false}}'
21 changes: 11 additions & 10 deletions kubernetes/netbox/base/postgres/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
labels:
app.kubernetes.io/instance: netbox
spec:
shutdown: false
backups:
pgbackrest:
configuration:
Expand Down Expand Up @@ -141,23 +142,23 @@ spec:
# kind: PGUpgrade
# metadata:
# name: netbox-upgrade
# namespace: postgres
# namespace: netbox
# spec:
# fromPostgresVersion: 14
# fromPostgresVersion: 15
# postgresClusterName: netbox
# toPostgresVersion: 15
# toPostgresVersion: 17

# kubectl delete ResourceQuota -n postgres --all
# kubectl delete LimitRange -n postgres --all
# kubectl delete ResourceQuota -n netbox --all
# kubectl delete LimitRange -n netbox --all

# kubectl patch postgrescluster netbox -n postgres --type=merge \
# kubectl patch postgrescluster netbox -n netbox --type=merge \
# -p '{"spec":{"shutdown":true}}'

# kubectl annotate postgrescluster netbox -n postgres \
# kubectl annotate postgrescluster netbox -n netbox \
# postgres-operator.crunchydata.com/allow-upgrade=netbox-upgrade

# kubectl patch postgrescluster netbox -n postgres --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":15}]'
# kubectl patch postgrescluster netbox -n netbox --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":17}]'

# kubectl patch postgrescluster netbox -n postgres --type=merge \
# kubectl patch postgrescluster netbox -n netbox --type=merge \
# -p '{"spec":{"shutdown":false}}'
2 changes: 1 addition & 1 deletion kubernetes/nextcloud/base/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ spec:
fsGroupChangePolicy: OnRootMismatch
containers:
- name: nextcloud
image: docker.io/nextcloud:30.0.1-apache
image: docker.io/nextcloud:30.0.4-apache
env:
- name: PHP_MEMORY_LIMIT
value: 3G
Expand Down
19 changes: 19 additions & 0 deletions kubernetes/nextcloud/base/network-policy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,22 @@ spec:
- 10.0.0.0/8
- 172.16.0.0/12
- 192.168.0.0/16
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: allow-to-openshift-ingress
namespace: nextcloud
annotations:
argocd.argoproj.io/sync-wave: "0"
labels:
app.kubernetes.io/instance: nextcloud
spec:
policyTypes:
- Egress
podSelector: {}
egress:
- to:
- namespaceSelector:
matchLabels:
network.openshift.io/policy-group: ingress
23 changes: 12 additions & 11 deletions kubernetes/nextcloud/base/postgres/postgres.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
labels:
app.kubernetes.io/instance: nextcloud
spec:
shutdown: false
backups:
pgbackrest:
configuration:
Expand Down Expand Up @@ -136,29 +137,29 @@ spec:
# memory: 128Mi
openshift: true
port: 5432
postgresVersion: 15
postgresVersion: 17
# ---
# apiVersion: postgres-operator.crunchydata.com/v1beta1
# kind: PGUpgrade
# metadata:
# name: nextcloud-upgrade
# namespace: postgres
# namespace: nextcloud
# spec:
# fromPostgresVersion: 14
# fromPostgresVersion: 15
# postgresClusterName: nextcloud
# toPostgresVersion: 15
# toPostgresVersion: 17

# kubectl delete ResourceQuota -n postgres --all
# kubectl delete LimitRange -n postgres --all
# kubectl delete ResourceQuota -n nextcloud --all
# kubectl delete LimitRange -n nextcloud --all

# kubectl patch postgrescluster nextcloud -n postgres --type=merge \
# kubectl patch postgrescluster nextcloud -n nextcloud --type=merge \
# -p '{"spec":{"shutdown":true}}'

# kubectl annotate postgrescluster nextcloud -n postgres \
# kubectl annotate postgrescluster nextcloud -n nextcloud \
# postgres-operator.crunchydata.com/allow-upgrade=nextcloud-upgrade

# kubectl patch postgrescluster nextcloud -n postgres --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":15}]'
# kubectl patch postgrescluster nextcloud -n nextcloud --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":17}]'

# kubectl patch postgrescluster nextcloud -n postgres --type=merge \
# kubectl patch postgrescluster nextcloud -n nextcloud --type=merge \
# -p '{"spec":{"shutdown":false}}'
19 changes: 19 additions & 0 deletions kubernetes/postgres/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,37 @@ kubectl kustomize kubernetes/postgres/overlays/okd | argocd-vault-plugin generat
```bash
kubectl get pods -n postgres -o wide -o yaml | grep "developers.crunchydata.com" | sed 's/^.*: /: /' | sort -u

skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4@sha256:ca4963804ad485ac3e16986fc8be01d251d2ac4d34d4269ad1a305b7257b93b0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgadmin4@sha256:ca4963804ad485ac3e16986fc8be01d251d2ac4d34d4269ad1a305b7257b93b0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-29 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-29
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-33 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgadmin4:ubi8-4.30-33
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-8.10-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgadmin4:ubi8-8.10-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgadmin4:ubi8-8.14-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgadmin4:ubi8-8.14-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest@sha256:5fc5d790670e8a1dfd8ab245021158f4fbbe40e7071b2c12bceac848b2add28d docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgbackrest@sha256:5fc5d790670e8a1dfd8ab245021158f4fbbe40e7071b2c12bceac848b2add28d
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.52.1-1 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgbackrest:ubi8-2.52.1-1
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.0-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgbackrest:ubi8-2.54.0-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.22-4 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgbouncer:ubi8-1.22-4
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-2 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-pgbouncer:ubi8-1.23-2
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter@sha256:0ada6c92c2f416d50329273ed50b9dcf727a39aced04084e073ad79e6ed2d8d4 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-exporter@sha256:0ada6c92c2f416d50329273ed50b9dcf727a39aced04084e073ad79e6ed2d8d4
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-0.15.0-10 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-exporter:ubi8-0.15.0-10
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-exporter:ubi8-0.15.0-14 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-exporter:ubi8-0.15.0-14
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-15.10-3.3-1 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-gis:ubi8-15.10-3.3-1
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-15.8-3.3-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-gis:ubi8-15.8-3.3-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.4-3.3-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-gis:ubi8-16.4-3.3-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.4-3.4-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-gis:ubi8-16.4-3.4-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.3-1 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.3-1
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.4-1 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-gis:ubi8-16.6-3.4-1
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-1 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres-gis:ubi8-17.2-3.4-1
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres@sha256:541fac5d9aba9c99ccebb157adf18909f517673739dddf15d9362b1e2d89c5fb docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres@sha256:541fac5d9aba9c99ccebb157adf18909f517673739dddf15d9362b1e2d89c5fb
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-15.10-1 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres:ubi8-15.10-1
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-15.8-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres:ubi8-15.8-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.4-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres:ubi8-16.4-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-16.6-1 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres:ubi8-16.6-1
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-17.2-1 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-postgres:ubi8-17.2-1
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.6.1-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-upgrade:ubi8-5.6.1-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/crunchy-upgrade:ubi8-5.7.2-0 docker://registry.arthurvardevanyan.com/crunchydata/crunchy-upgrade:ubi8-5.7.2-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/postgres-operator@sha256:29c8277f3332c076e4a9e8a9271ae085b72e6cf86a88d53699180262a340fe0b docker://registry.arthurvardevanyan.com/crunchydata/postgres-operator@sha256:29c8277f3332c076e4a9e8a9271ae085b72e6cf86a88d53699180262a340fe0b
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/postgres-operator:ubi8-5.6.1-0 docker://registry.arthurvardevanyan.com/crunchydata/postgres-operator:ubi8-5.6.1-0
skopeo copy docker://registry.developers.crunchydata.com/crunchydata/postgres-operator:ubi8-5.7.2-0 docker://registry.arthurvardevanyan.com/crunchydata/postgres-operator:ubi8-5.7.2-0
```

## REF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
labels:
app.kubernetes.io/instance: postgres
spec:
shutdown: false
backups:
pgbackrest:
configuration:
Expand Down Expand Up @@ -135,17 +136,17 @@ spec:
# memory: 128Mi
openshift: true
port: 5432
postgresVersion: 15
postgresVersion: 17
# ---
# apiVersion: postgres-operator.crunchydata.com/v1beta1
# kind: PGUpgrade
# metadata:
# name: grafana-upgrade
# namespace: postgres
# spec:
# fromPostgresVersion: 14
# fromPostgresVersion: 15
# postgresClusterName: grafana
# toPostgresVersion: 15
# toPostgresVersion: 17

# kubectl delete ResourceQuota -n postgres --all
# kubectl delete LimitRange -n postgres --all
Expand All @@ -157,7 +158,7 @@ spec:
# postgres-operator.crunchydata.com/allow-upgrade=grafana-upgrade

# kubectl patch postgrescluster grafana -n postgres --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":15}]'
# '[{"op":"replace","path":"/spec/postgresVersion","value":17}]'

# kubectl patch postgrescluster grafana -n postgres --type=merge \
# -p '{"spec":{"shutdown":false}}'
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ metadata:
labels:
app.kubernetes.io/instance: postgres
spec:
shutdown: false
backups:
pgbackrest:
configuration:
Expand Down Expand Up @@ -133,17 +134,17 @@ spec:
# memory: 128Mi
openshift: true
port: 5432
postgresVersion: 15
#---
postgresVersion: 17
# ---
# apiVersion: postgres-operator.crunchydata.com/v1beta1
# kind: PGUpgrade
# metadata:
# name: photoprism-upgrade
# namespace: postgres
# spec:
# fromPostgresVersion: 14
# fromPostgresVersion: 15
# postgresClusterName: photoprism
# toPostgresVersion: 15
# toPostgresVersion: 17

# kubectl delete ResourceQuota -n postgres
# kubectl delete LimitRange -n postgres
Expand All @@ -154,8 +155,8 @@ spec:
# kubectl annotate postgrescluster photoprism -n postgres \
# postgres-operator.crunchydata.com/allow-upgrade=photoprism-upgrade

#kubectl patch postgrescluster photoprism -n postgres --type "json" -p \
#'[{"op":"replace","path":"/spec/postgresVersion","value":15}]'
# kubectl patch postgrescluster photoprism -n postgres --type "json" -p \
# '[{"op":"replace","path":"/spec/postgresVersion","value":17}]'

# kubectl patch postgrescluster photoprism -n postgres --type=merge \
# -p '{"spec":{"shutdown":false}'
# -p '{"spec":{"shutdown":false}}'
Loading

0 comments on commit 34d3837

Please sign in to comment.