Skip to content

Commit 09a63a1

Browse files
authored
Merge branch 'main' into K8SPSMDB-1296
2 parents d6e9d6b + 6dedac1 commit 09a63a1

File tree

37 files changed

+1170
-89
lines changed

37 files changed

+1170
-89
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
steps:
88
- uses: actions/setup-go@v5
99
with:
10-
go-version: '^1.23'
10+
go-version: '^1.24'
1111
- uses: actions/[email protected]
1212
- name: run tests
1313
run: make test

e2e-tests/demand-backup-incremental-sharded/run

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,8 +127,16 @@ if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
127127
run_backup azure-blob ${backup_name_azure}
128128

129129
wait_backup "${backup_name_aws}"
130+
check_backup_in_storage ${backup_name_aws} s3 rs0
131+
check_backup_in_storage ${backup_name_aws} s3 cfg
132+
130133
wait_backup "${backup_name_gcp}"
134+
check_backup_in_storage ${backup_name_gcp} gcs rs0
135+
check_backup_in_storage ${backup_name_gcp} gcs cfg
136+
131137
wait_backup "${backup_name_azure}"
138+
check_backup_in_storage ${backup_name_azure} azure rs0
139+
check_backup_in_storage ${backup_name_azure} azure cfg
132140
fi
133141

134142
backup_name_minio="backup-minio-sharded"

e2e-tests/demand-backup-incremental/run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,13 @@ if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
111111
run_backup azure-blob ${backup_name_azure}
112112

113113
wait_backup "${backup_name_aws}"
114+
check_backup_in_storage ${backup_name_aws} s3 rs0
115+
114116
wait_backup "${backup_name_gcp}"
117+
check_backup_in_storage ${backup_name_gcp} gcs rs0
118+
115119
wait_backup "${backup_name_azure}"
120+
check_backup_in_storage ${backup_name_azure} azure rs0
116121
fi
117122

118123
backup_name_minio="backup-minio"

e2e-tests/demand-backup-physical-sharded/run

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,8 +112,16 @@ if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
112112
run_backup azure-blob ${backup_name_azure}
113113

114114
wait_backup "${backup_name_aws}"
115+
check_backup_in_storage ${backup_name_aws} s3 rs0
116+
check_backup_in_storage ${backup_name_aws} s3 cfg
117+
115118
wait_backup "${backup_name_gcp}"
119+
check_backup_in_storage ${backup_name_gcp} gcs rs0
120+
check_backup_in_storage ${backup_name_gcp} gcs cfg
121+
116122
wait_backup "${backup_name_azure}"
123+
check_backup_in_storage ${backup_name_azure} azure rs0
124+
check_backup_in_storage ${backup_name_azure} azure cfg
117125
fi
118126
wait_backup "${backup_name_minio}"
119127

e2e-tests/demand-backup-physical/run

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,13 @@ if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
9898
run_backup azure-blob ${backup_name_azure}
9999

100100
wait_backup "${backup_name_aws}"
101+
check_backup_in_storage ${backup_name_aws} s3 rs0
102+
101103
wait_backup "${backup_name_gcp}"
104+
check_backup_in_storage ${backup_name_gcp} gcs rs0
105+
102106
wait_backup "${backup_name_azure}"
107+
check_backup_in_storage ${backup_name_azure} azure rs0
103108
fi
104109
wait_backup "${backup_name_minio}"
105110

e2e-tests/functions

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ IMAGE_PMM_CLIENT=${IMAGE_PMM_CLIENT:-"perconalab/pmm-client:dev-latest"}
1717
IMAGE_PMM_SERVER=${IMAGE_PMM_SERVER:-"perconalab/pmm-server:dev-latest"}
1818
CERT_MANAGER_VER="1.16.3"
1919
UPDATE_COMPARE_FILES=${UPDATE_COMPARE_FILES:-0}
20+
DELETE_CRD_ON_START=${DELETE_CRD_ON_START:-1}
2021
tmp_dir=$(mktemp -d)
2122
sed=$(which gsed || which sed)
2223
date=$(which gdate || which date)
@@ -1331,8 +1332,10 @@ check_backup_deletion() {
13311332
create_infra() {
13321333
local ns="$1"
13331334

1334-
delete_crd
1335-
check_crd_for_deletion "${GIT_BRANCH}"
1335+
if [[ ${DELETE_CRD_ON_START} == 1 ]]; then
1336+
delete_crd
1337+
check_crd_for_deletion "${GIT_BRANCH}"
1338+
fi
13361339
if [ -n "$OPERATOR_NS" ]; then
13371340
create_namespace $OPERATOR_NS
13381341
deploy_operator
@@ -1867,3 +1870,31 @@ wait_for_oplogs() {
18671870
sleep 10
18681871
done
18691872
}
1873+
1874+
check_backup_in_storage() {
1875+
local backup=$1
1876+
local storage_type=$2
1877+
local replset=$3
1878+
local file=${4:-"filelist.pbm"}
1879+
1880+
local endpoint
1881+
case ${storage_type} in
1882+
s3)
1883+
endpoint="s3.amazonaws.com"
1884+
;;
1885+
gcs)
1886+
endpoint="storage.googleapis.com"
1887+
;;
1888+
azure)
1889+
endpoint="engk8soperators.blob.core.windows.net"
1890+
;;
1891+
*)
1892+
echo "unsupported storage type: ${storage_type}"
1893+
exit 1
1894+
esac
1895+
1896+
backup_dest=$(get_backup_dest "$backup")
1897+
local url="https://${endpoint}/${backup_dest}/${replset}/${file}"
1898+
log "checking if ${url} exists"
1899+
curl --fail --head "${url}"
1900+
}

e2e-tests/init-deploy/compare/backup-80.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@
133133
"update"
134134
]
135135
},
136+
{
137+
"resource": {
138+
"db": "",
139+
"collection": "system.views"
140+
},
141+
"actions": [
142+
"dropCollection"
143+
]
144+
},
136145
{
137146
"resource": {
138147
"db": "admin",
@@ -243,15 +252,6 @@
243252
"updateSearchIndex"
244253
]
245254
},
246-
{
247-
"resource": {
248-
"db": "admin",
249-
"collection": "system.views"
250-
},
251-
"actions": [
252-
"dropCollection"
253-
]
254-
},
255255
{
256256
"resource": {
257257
"db": "admin",

e2e-tests/init-deploy/run

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ test_dir=$(realpath $(dirname $0))
66
. ${test_dir}/../functions
77
set_debug
88

9-
max_conn=16
9+
max_conn=17
1010

1111
create_infra $namespace
1212

e2e-tests/rs-shard-migration/compare/statefulset_some-name-rs0.yml

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ spec:
5555
- --encryptionKeyFile=/etc/mongodb-encryption/encryption-key
5656
- --wiredTigerCacheSizeGB=0.25
5757
- --wiredTigerIndexPrefixCompression=true
58-
- --config=/etc/mongodb-config/mongod.conf
5958
- --quiet
6059
command:
6160
- /opt/percona/ps-entry.sh
@@ -138,8 +137,6 @@ spec:
138137
- mountPath: /etc/mongodb-ssl-internal
139138
name: ssl-internal
140139
readOnly: true
141-
- mountPath: /etc/mongodb-config
142-
name: config
143140
- mountPath: /opt/percona
144141
name: bin
145142
- mountPath: /etc/mongodb-encryption
@@ -148,6 +145,57 @@ spec:
148145
- mountPath: /etc/users-secret
149146
name: users-secret-file
150147
workingDir: /data/db
148+
- args:
149+
- pbm-agent-entrypoint
150+
command:
151+
- /opt/percona/pbm-entry.sh
152+
env:
153+
- name: PBM_AGENT_MONGODB_USERNAME
154+
valueFrom:
155+
secretKeyRef:
156+
key: MONGODB_BACKUP_USER_ESCAPED
157+
name: internal-some-name-users
158+
optional: false
159+
- name: PBM_AGENT_MONGODB_PASSWORD
160+
valueFrom:
161+
secretKeyRef:
162+
key: MONGODB_BACKUP_PASSWORD_ESCAPED
163+
name: internal-some-name-users
164+
optional: false
165+
- name: PBM_MONGODB_REPLSET
166+
value: rs0
167+
- name: PBM_MONGODB_PORT
168+
value: "27017"
169+
- name: PBM_AGENT_SIDECAR
170+
value: "true"
171+
- name: PBM_AGENT_SIDECAR_SLEEP
172+
value: "5"
173+
- name: POD_NAME
174+
valueFrom:
175+
fieldRef:
176+
apiVersion: v1
177+
fieldPath: metadata.name
178+
- name: PBM_MONGODB_URI
179+
value: mongodb://$(PBM_AGENT_MONGODB_USERNAME):$(PBM_AGENT_MONGODB_PASSWORD)@localhost:$(PBM_MONGODB_PORT)/?tls=true&tlsCertificateKeyFile=/tmp/tls.pem&tlsCAFile=/etc/mongodb-ssl/ca.crt&tlsInsecure=true
180+
- name: PBM_AGENT_TLS_ENABLED
181+
value: "true"
182+
imagePullPolicy: Always
183+
name: backup-agent
184+
resources: {}
185+
securityContext:
186+
runAsNonRoot: true
187+
runAsUser: 1001
188+
terminationMessagePath: /dev/termination-log
189+
terminationMessagePolicy: File
190+
volumeMounts:
191+
- mountPath: /etc/mongodb-ssl
192+
name: ssl
193+
readOnly: true
194+
- mountPath: /opt/percona
195+
name: bin
196+
readOnly: true
197+
- mountPath: /data/db
198+
name: mongod-data
151199
dnsPolicy: ClusterFirst
152200
initContainers:
153201
- command:
@@ -183,11 +231,6 @@ spec:
183231
secretName: some-name-mongodb-keyfile
184232
- emptyDir: {}
185233
name: bin
186-
- configMap:
187-
defaultMode: 420
188-
name: some-name-rs0-mongod
189-
optional: true
190-
name: config
191234
- name: some-name-mongodb-encryption-key
192235
secret:
193236
defaultMode: 288
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: psmdb.percona.com/v1
2+
kind: PerconaServerMongoDBBackup
3+
metadata:
4+
finalizers:
5+
- percona.com/delete-backup
6+
name: backup-minio
7+
spec:
8+
clusterName: some-name
9+
storageName: minio

0 commit comments

Comments
 (0)