Skip to content

Commit 3d5734f

Browse files
authored
Nexus storage change, update Nexus to latest 3.70.x version (#1342)
1 parent 6c66b1b commit 3d5734f

14 files changed

Lines changed: 220 additions & 35 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77

88
### Changed
9+
- Nexus storage change ([#1341](https://github.com/opendevstack/ods-core/issues/1341))
910

1011

1112
### Fixed

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,13 @@ backup-sonarqube:
179179
.PHONY: backup-sonarqube
180180

181181

182+
# PVC MIGRATION
183+
## Migrate data from one PVC to another.
184+
migrate-pvc-data:
185+
./scripts/migrate_pvc_data.sh --source-pvc $(SOURCE_PVC) --target-pvc $(TARGET_PVC) --namespace $(ODS_NAMESPACE)
186+
.PHONY: migrate-pvc-data
187+
188+
182189
### HELP
183190
### Based on https://gist.github.com/prwhite/8168133#gistcomment-2278355.
184191
help:

configuration-sample/ods-core.env.sample

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ ODS_BITBUCKET_PROJECT=opendevstack
4545
# Nexus base image
4646
# See Dockerhub https://hub.docker.com/r/sonatype/nexus3/tags.
4747
# Officially supported is:
48-
# - 3.70.3-java11-ubi
49-
NEXUS_IMAGE_TAG=3.70.3-java11-ubi
48+
# - 3.70.4-java11-ubi
49+
NEXUS_IMAGE_TAG=3.70.4-java11-ubi
5050

5151
# Nexus host without protocol.
5252
# The domain should be equal to OPENSHIFT_APPS_BASEDOMAIN (see below).
@@ -77,9 +77,26 @@ NEXUS_MEMORY_REQUEST=3Gi
7777
NEXUS_CPU_LIMIT=1
7878
NEXUS_MEMORY_LIMIT=5Gi
7979

80-
# Nexus data and backup capacity
80+
# Nexus data capacity
8181
NEXUS_DATA_CAPACITY=60Gi
82-
NEXUS_DATA_BACKUP_CAPACITY=10Gi
82+
83+
# Nexus storage name
84+
NEXUS_STORAGE_NAME="storage"
85+
86+
# Storage class provisioner, for AWS this should be "kubernetes.io/aws-ebs"
87+
NEXUS_STORAGE_PROVISIONER=""
88+
89+
# Storage class for Nexus data, for AWS this should be "gp3"
90+
NEXUS_STORAGE_CLASS_DATA=""
91+
92+
# Storage class for Nexus backup, for AWS this should be "gp2-encrypted"
93+
NEXUS_STORAGE_CLASS_BACKUP=""
94+
95+
# Nexus snapshot configuration, default to run daily at 2 AM
96+
NEXUS_SNAPSHOT_SCHEDULE="0 2 * * *"
97+
98+
# Nexus snapshot TTL in seconds (default: 30 days)
99+
NEXUS_SNAPSHOT_TTL=2592000
83100

84101
#############
85102
# SonarQube #

docs/modules/administration/nav.adoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
** xref:administration:installation.adoc[Installation]
33
** Upgrade
44
*** xref:administration:helm-migration.adoc[Helm migration]
5+
*** xref:administration:pvc-migration.adoc[PVC Migration]
56
*** xref:administration:update-2-to-3.adoc[2.x to 3.x]
67
*** xref:administration:update-older.adoc[older]
78
** xref:provisioning-app:configuration.adoc[Provisioning App]
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
= PVC Migration
2+
3+
This document describes the process to migrate data from one Persistent Volume Claim (PVC) to another within the OpenShift cluster.
4+
5+
== Prerequisites
6+
7+
- Ensure the source and target PVCs exist in the desired namespace.
8+
- Have access to the `ods-core` repository.
9+
10+
== Migration Process
11+
12+
To migrate data between PVCs, follow these steps:
13+
14+
1. Navigate to the `ods-core` repository.
15+
2. Run the following command:
16+
17+
[source,sh]
18+
----
19+
make migrate-pvc-data SOURCE_PVC=<source-pvc-name> TARGET_PVC=<target-pvc-name>
20+
----
21+
22+
Replace `<source-pvc-name>`, and `<target-pvc-name>` with the appropriate values for your environment.
23+
24+
== Details
25+
26+
- The migration process creates a temporary pod that uses `rsync` to copy data from the source PVC to the target PVC.
27+
- Logs of the migration are stored in `/tmp/target/rsync.log` within the target PVC.
28+
- After the migration, verify the data integrity and delete the temporary pod if necessary.

nexus/chart/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,10 @@ type: application
1515
# This is the chart version. This version number should be incremented each time you make changes
1616
# to the chart and its templates, including the app version.
1717
# Versions are expected to follow Semantic Versioning (https://semver.org/)
18-
version: 1.1.0
18+
version: 1.2.0
1919

2020
# This is the version number of the application being deployed. This version number should be
2121
# incremented each time you make changes to the application. Versions are not expected to
2222
# follow Semantic Versioning. They should reflect the version the application is using.
2323
# It is recommended to use it with quotes.
24-
appVersion: "3.70.3-java11-ubi"
24+
appVersion: "3.70.4-java11-ubi"

nexus/chart/templates/NOTES.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,16 @@
1-
OpenDevStack Nexus OSS edition on version {{ .Values.global.nexusImageTag }} released with Helm!
1+
Thank you for installing the OpenDevStack Nexus OSS Helm chart!
2+
3+
Nexus Repository Manager has been deployed.
4+
5+
Access Nexus UI:
6+
https://{{ .Values.global.nexusHost }}
7+
8+
Docker Registry Endpoint:
9+
{{ .Values.global.nexusDockerGroup }}-{{ .Values.global.odsNamespace }}{{ .Values.global.openshiftAppDomain}}
10+
11+
Nexus Version: {{ .Values.global.nexusImageTag }}
12+
13+
For more information, visit:
14+
- Sonatype Nexus Repository OSS: https://help.sonatype.com/en/ce-onboarding.html
15+
- OpenDevStack: https://www.opendevstack.org/ods-documentation/opendevstack/latest/nexus/administration.html
16+
- Community Support: https://community.sonatype.com/

nexus/chart/templates/deploymentconfig.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ spec:
3737
volumes:
3838
- name: {{ .Values.global.appName }}-data
3939
persistentVolumeClaim:
40-
claimName: {{ .Values.global.appName }}-data
41-
- name: {{ .Values.global.appName }}-db-backup
42-
persistentVolumeClaim:
43-
claimName: {{ .Values.global.appName }}-db-backup
40+
claimName: {{ .Values.global.nexusStorageName }}
4441
containers:
4542
- resources:
4643
limits:
@@ -88,8 +85,6 @@ spec:
8885
volumeMounts:
8986
- name: {{ .Values.global.appName }}-data
9087
mountPath: /nexus-data
91-
- name: {{ .Values.global.appName }}-db-backup
92-
mountPath: /nexus-backup
9388
terminationMessagePolicy: File
9489
image: {{ .Values.global.registry }}/{{ .Values.global.odsNamespace }}/{{ .Values.global.appName }}:{{ .Values.global.odsImageTag }}
9590
restartPolicy: Always
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
apiVersion: batch/v1
2+
kind: CronJob
3+
metadata:
4+
name: nexus-volume-snapshot
5+
labels:
6+
app: nexus
7+
spec:
8+
schedule: "{{ .Values.global.nexusSnapshotSchedule }}"
9+
concurrencyPolicy: Forbid
10+
jobTemplate:
11+
spec:
12+
ttlSecondsAfterFinished: {{ .Values.global.nexusSnapshotTTL }}
13+
template:
14+
spec:
15+
serviceAccountName: ods-edit
16+
containers:
17+
- name: snapshot-creator
18+
image: image-registry.openshift-image-registry.svc:5000/openshift/ose-cli:latest
19+
command:
20+
- /bin/sh
21+
- -c
22+
- |
23+
cat <<EOF | oc apply -f -
24+
apiVersion: snapshot.storage.k8s.io/v1
25+
kind: VolumeSnapshot
26+
metadata:
27+
name: {{ .Values.global.appName }}-snapshot.$(date +%Y-%m-%d.%H-%M-%S)
28+
namespace: {{ .Values.global.odsNamespace }}
29+
spec:
30+
volumeSnapshotClassName: {{ .Values.global.nexusSnapshotClass }}
31+
source:
32+
persistentVolumeClaimName: {{ .Values.global.nexusStorageName }}
33+
EOF
34+
# Cleanup snapshots older than the TTL
35+
oc get volumesnapshots --namespace {{ .Values.global.odsNamespace }} \
36+
--no-headers -o custom-columns=NAME:.metadata.name,CREATED:.metadata.creationTimestamp | \
37+
while read name created; do
38+
if [[ $(date -d "$created" +%s) -lt $(date -d "-{{ .Values.global.nexusSnapshotTTL }} seconds" +%s) ]]; then
39+
oc delete volumesnapshot "$name" --namespace {{ .Values.global.odsNamespace }}
40+
fi
41+
done
42+
resources: {}
43+
imagePullPolicy: IfNotPresent
44+
restartPolicy: OnFailure
45+
successfulJobsHistoryLimit: 30
46+
failedJobsHistoryLimit: 30

nexus/chart/templates/pvc-data.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ kind: PersistentVolumeClaim
33
metadata:
44
annotations:
55
volume.beta.kubernetes.io/storage-provisioner: {{ .Values.global.storageProvisioner }}
6+
helm.sh/resource-policy: keep
67
finalizers:
78
- kubernetes.io/pvc-protection
89
labels:
910
app: {{ .Values.global.appName }}
10-
name: {{ .Values.global.appName }}-data
11+
name: {{ .Values.global.nexusStorageName }}
1112
spec:
1213
accessModes:
1314
- ReadWriteOnce

0 commit comments

Comments
 (0)