Skip to content

Commit 4d4f320

Browse files
onprem: 2.8.0-rc.2
1 parent b46fef1 commit 4d4f320

File tree

2 files changed

+260
-34
lines changed

2 files changed

+260
-34
lines changed

codefresh/README.md

Lines changed: 130 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2086,32 +2086,145 @@ Default PostgreSQL image is changed from 13.x to 17.x
20862086

20872087
If you run external PostgreSQL, follow the [official instructions](https://www.postgresql.org/docs/17/upgrading.html) to upgrade to 17.x.
20882088

2089-
⚠️ ⚠️ ⚠️ If you run built-in PostgreSQL `bitnami/postgresql` subchart, direct upgrade is not supported. You need to backup your data, delete the old PostgreSQL StatefulSet with PVCs and restore the data into a new PostgreSQL StatefulSet.
2089+
⚠️ ⚠️ ⚠️ If you run built-in PostgreSQL `bitnami/postgresql` subchart, direct upgrade is not supported due to **incompatible breaking changes** in the database files. You will see the following error in the logs:
2090+
```
2091+
postgresql 17:36:28.41 INFO ==> ** Starting PostgreSQL **
2092+
2025-05-21 17:36:28.432 GMT [1] FATAL: database files are incompatible with server
2093+
2025-05-21 17:36:28.432 GMT [1] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 17.2.
2094+
```
2095+
You need to backup your data, delete the old PostgreSQL StatefulSet with PVCs and restore the data into a new PostgreSQL StatefulSet.
2096+
2097+
- **Before the upgrade**, backup your data on a separate PVC
2098+
2099+
- Create PVC with the same or bigger size as your current PostgreSQL PVC:
2100+
2101+
```yaml
2102+
apiVersion: v1
2103+
kind: PersistentVolumeClaim
2104+
metadata:
2105+
name: postgresql-dump
2106+
spec:
2107+
storageClassName: <STORAGE_CLASS>
2108+
resources:
2109+
requests:
2110+
storage: <PVC_SIZE>
2111+
volumeMode: Filesystem
2112+
accessModes:
2113+
- ReadWriteOnce
2114+
```
2115+
2116+
- Create a job to dump the data from the old PostgreSQL StatefulSet into the new PVC:
2117+
2118+
```yaml
2119+
apiVersion: batch/v1
2120+
kind: Job
2121+
metadata:
2122+
name: postgresql-dump
2123+
spec:
2124+
ttlSecondsAfterFinished: 300
2125+
template:
2126+
spec:
2127+
containers:
2128+
- name: postgresql-dump
2129+
image: quay.io/codefresh/postgresql:17
2130+
resources:
2131+
requests:
2132+
memory: "128Mi"
2133+
cpu: "100m"
2134+
limits:
2135+
memory: "1Gi"
2136+
cpu: "1"
2137+
env:
2138+
- name: PGUSER
2139+
value: "<POSTGRES_USER>"
2140+
- name: PGPASSWORD
2141+
value: "<POSTGRES_PASSWORD>"
2142+
- name: PGHOST
2143+
value: "<POSTGRES_HOST>"
2144+
- name: PGPORT
2145+
value: "<POSTGRES_PORT>"
2146+
command:
2147+
- "/bin/bash"
2148+
- "-c"
2149+
- |
2150+
pg_dumpall --verbose > /opt/postgresql-dump/dump.sql
2151+
volumeMounts:
2152+
- name: postgresql-dump
2153+
mountPath: /opt/postgresql-dump
2154+
securityContext:
2155+
runAsUser: 0
2156+
fsGroup: 0
2157+
volumes:
2158+
- name: postgresql-dump
2159+
persistentVolumeClaim:
2160+
claimName: postgresql-dump
2161+
restartPolicy: Never
2162+
```
2163+
2164+
- Delete old PostgreSQL StatefulSet and PVC
20902165

20912166
```console
2092-
PGUSER=postgres
2093-
PGHOST=cf-postgresql
2094-
PGPORT=5432
2095-
PGPASSWORD=postgres
2096-
BACKUP_DIR=/tmp/pg_backup
2097-
BACKUP_SQL=backup.sql
2098-
TIMESTAMP=$(date +%Y%m%d%H%M%S)
2099-
NAMESPACE=codefresh
2100-
2101-
# Backup PostgreSQL data
2102-
pg_dumpall --verbose > "$BACKUP_DIR/$BACKUP_SQL.$TIMESTAMP" 2>> "$LOG_FILE"
2103-
2104-
# Delete old PostgreSQL StatefulSet
21052167
STS_NAME=$(kubectl get sts -n $NAMESPACE -l app.kubernetes.io/instance=$RELEASE_NAME -l app.kubernetes.io/name=postgresql -o jsonpath='{.items[0].metadata.name}')
21062168
PVC_NAME=$(kubectl get pvc -n $NAMESPACE -l app.kubernetes.io/instance=$RELEASE_NAME -l app.kubernetes.io/name=postgresql -o jsonpath='{.items[0].metadata.name}')
21072169
21082170
kubectl delete sts $STS_NAME -n $NAMESPACE
21092171
kubectl delete pvc $PVC_NAME -n $NAMESPACE
2172+
```
2173+
2174+
- Peform the upgrade to 2.8.x with PostgreSQL seed job enabled to re-create users and databases
2175+
2176+
```yaml
2177+
seed:
2178+
postgresSeedJob:
2179+
enabled: true
2180+
```
21102181

2111-
# Perform Codefresh On-Prem upgrade to 2.8.x
2182+
- Create a job to restore the data from the new PVC into the new PostgreSQL StatefulSet:
21122183

2113-
# Restore PostgreSQL data
2114-
psql -U -f "$BACKUP_DIR/$BACKUP_SQL.$TIMESTAMP" >> "$LOG_FILE" 2>&1
2184+
```yaml
2185+
apiVersion: batch/v1
2186+
kind: Job
2187+
metadata:
2188+
name: postgresql-restore
2189+
spec:
2190+
ttlSecondsAfterFinished: 300
2191+
template:
2192+
spec:
2193+
containers:
2194+
- name: postgresql-restore
2195+
image: quay.io/codefresh/postgresql:17
2196+
resources:
2197+
requests:
2198+
memory: "128Mi"
2199+
cpu: "100m"
2200+
limits:
2201+
memory: "1Gi"
2202+
cpu: "1"
2203+
env:
2204+
- name: PGUSER
2205+
value: "<POSTGRES_USER>"
2206+
- name: PGPASSWORD
2207+
value: "<POSTGRES_PASSWORD>"
2208+
- name: PGHOST
2209+
value: "<POSTGRES_HOST>"
2210+
- name: PGPORT
2211+
value: "<POSTGRES_PORT>"
2212+
command:
2213+
- "/bin/bash"
2214+
- "-c"
2215+
- |
2216+
psql -f /opt/postgresql-dump/dump.sql
2217+
volumeMounts:
2218+
- name: postgresql-dump
2219+
mountPath: /opt/postgresql-dump
2220+
securityContext:
2221+
runAsUser: 0
2222+
fsGroup: 0
2223+
volumes:
2224+
- name: postgresql-dump
2225+
persistentVolumeClaim:
2226+
claimName: postgresql-dump
2227+
restartPolicy: Never
21152228
```
21162229

21172230
### RabbitMQ update

codefresh/README.md.gotmpl

Lines changed: 130 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2096,32 +2096,145 @@ Default PostgreSQL image is changed from 13.x to 17.x
20962096

20972097
If you run external PostgreSQL, follow the [official instructions](https://www.postgresql.org/docs/17/upgrading.html) to upgrade to 17.x.
20982098

2099-
⚠️ ⚠️ ⚠️ If you run built-in PostgreSQL `bitnami/postgresql` subchart, direct upgrade is not supported. You need to backup your data, delete the old PostgreSQL StatefulSet with PVCs and restore the data into a new PostgreSQL StatefulSet.
2099+
⚠️ ⚠️ ⚠️ If you run built-in PostgreSQL `bitnami/postgresql` subchart, direct upgrade is not supported due to **incompatible breaking changes** in the database files. You will see the following error in the logs:
2100+
```
2101+
postgresql 17:36:28.41 INFO ==> ** Starting PostgreSQL **
2102+
2025-05-21 17:36:28.432 GMT [1] FATAL: database files are incompatible with server
2103+
2025-05-21 17:36:28.432 GMT [1] DETAIL: The data directory was initialized by PostgreSQL version 13, which is not compatible with this version 17.2.
2104+
```
2105+
You need to backup your data, delete the old PostgreSQL StatefulSet with PVCs and restore the data into a new PostgreSQL StatefulSet.
2106+
2107+
- **Before the upgrade**, backup your data on a separate PVC
2108+
2109+
- Create PVC with the same or bigger size as your current PostgreSQL PVC:
2110+
2111+
```yaml
2112+
apiVersion: v1
2113+
kind: PersistentVolumeClaim
2114+
metadata:
2115+
name: postgresql-dump
2116+
spec:
2117+
storageClassName: <STORAGE_CLASS>
2118+
resources:
2119+
requests:
2120+
storage: <PVC_SIZE>
2121+
volumeMode: Filesystem
2122+
accessModes:
2123+
- ReadWriteOnce
2124+
```
2125+
2126+
- Create a job to dump the data from the old PostgreSQL StatefulSet into the new PVC:
2127+
2128+
```yaml
2129+
apiVersion: batch/v1
2130+
kind: Job
2131+
metadata:
2132+
name: postgresql-dump
2133+
spec:
2134+
ttlSecondsAfterFinished: 300
2135+
template:
2136+
spec:
2137+
containers:
2138+
- name: postgresql-dump
2139+
image: quay.io/codefresh/postgresql:17
2140+
resources:
2141+
requests:
2142+
memory: "128Mi"
2143+
cpu: "100m"
2144+
limits:
2145+
memory: "1Gi"
2146+
cpu: "1"
2147+
env:
2148+
- name: PGUSER
2149+
value: "<POSTGRES_USER>"
2150+
- name: PGPASSWORD
2151+
value: "<POSTGRES_PASSWORD>"
2152+
- name: PGHOST
2153+
value: "<POSTGRES_HOST>"
2154+
- name: PGPORT
2155+
value: "<POSTGRES_PORT>"
2156+
command:
2157+
- "/bin/bash"
2158+
- "-c"
2159+
- |
2160+
pg_dumpall --verbose > /opt/postgresql-dump/dump.sql
2161+
volumeMounts:
2162+
- name: postgresql-dump
2163+
mountPath: /opt/postgresql-dump
2164+
securityContext:
2165+
runAsUser: 0
2166+
fsGroup: 0
2167+
volumes:
2168+
- name: postgresql-dump
2169+
persistentVolumeClaim:
2170+
claimName: postgresql-dump
2171+
restartPolicy: Never
2172+
```
2173+
2174+
- Delete old PostgreSQL StatefulSet and PVC
21002175

21012176
```console
2102-
PGUSER=postgres
2103-
PGHOST=cf-postgresql
2104-
PGPORT=5432
2105-
PGPASSWORD=postgres
2106-
BACKUP_DIR=/tmp/pg_backup
2107-
BACKUP_SQL=backup.sql
2108-
TIMESTAMP=$(date +%Y%m%d%H%M%S)
2109-
NAMESPACE=codefresh
2110-
2111-
# Backup PostgreSQL data
2112-
pg_dumpall --verbose > "$BACKUP_DIR/$BACKUP_SQL.$TIMESTAMP" 2>> "$LOG_FILE"
2113-
2114-
# Delete old PostgreSQL StatefulSet
21152177
STS_NAME=$(kubectl get sts -n $NAMESPACE -l app.kubernetes.io/instance=$RELEASE_NAME -l app.kubernetes.io/name=postgresql -o jsonpath='{.items[0].metadata.name}')
21162178
PVC_NAME=$(kubectl get pvc -n $NAMESPACE -l app.kubernetes.io/instance=$RELEASE_NAME -l app.kubernetes.io/name=postgresql -o jsonpath='{.items[0].metadata.name}')
21172179

21182180
kubectl delete sts $STS_NAME -n $NAMESPACE
21192181
kubectl delete pvc $PVC_NAME -n $NAMESPACE
2182+
```
2183+
2184+
- Peform the upgrade to 2.8.x with PostgreSQL seed job enabled to re-create users and databases
2185+
2186+
```yaml
2187+
seed:
2188+
postgresSeedJob:
2189+
enabled: true
2190+
```
21202191

2121-
# Perform Codefresh On-Prem upgrade to 2.8.x
2192+
- Create a job to restore the data from the new PVC into the new PostgreSQL StatefulSet:
21222193

2123-
# Restore PostgreSQL data
2124-
psql -U -f "$BACKUP_DIR/$BACKUP_SQL.$TIMESTAMP" >> "$LOG_FILE" 2>&1
2194+
```yaml
2195+
apiVersion: batch/v1
2196+
kind: Job
2197+
metadata:
2198+
name: postgresql-restore
2199+
spec:
2200+
ttlSecondsAfterFinished: 300
2201+
template:
2202+
spec:
2203+
containers:
2204+
- name: postgresql-restore
2205+
image: quay.io/codefresh/postgresql:17
2206+
resources:
2207+
requests:
2208+
memory: "128Mi"
2209+
cpu: "100m"
2210+
limits:
2211+
memory: "1Gi"
2212+
cpu: "1"
2213+
env:
2214+
- name: PGUSER
2215+
value: "<POSTGRES_USER>"
2216+
- name: PGPASSWORD
2217+
value: "<POSTGRES_PASSWORD>"
2218+
- name: PGHOST
2219+
value: "<POSTGRES_HOST>"
2220+
- name: PGPORT
2221+
value: "<POSTGRES_PORT>"
2222+
command:
2223+
- "/bin/bash"
2224+
- "-c"
2225+
- |
2226+
psql -f /opt/postgresql-dump/dump.sql
2227+
volumeMounts:
2228+
- name: postgresql-dump
2229+
mountPath: /opt/postgresql-dump
2230+
securityContext:
2231+
runAsUser: 0
2232+
fsGroup: 0
2233+
volumes:
2234+
- name: postgresql-dump
2235+
persistentVolumeClaim:
2236+
claimName: postgresql-dump
2237+
restartPolicy: Never
21252238
```
21262239

21272240
### RabbitMQ update

0 commit comments

Comments
 (0)