Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

K8SPSMDB-1172: fix special chars in backup user/password #1731

Merged
merged 11 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion e2e-tests/custom-replset-name/conf/some-name.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ kind: PerconaServerMongoDB
metadata:
name: some-name
spec:
crVersion: 1.16.0
crVersion: 1.18.0
backup:
enabled: true
image: percona/percona-backup-mongodb:2.0.4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,13 +141,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-my-cluster-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-my-cluster-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-my-cluster-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-my-cluster-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-my-cluster-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-my-cluster-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-my-cluster-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-my-cluster-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,13 +159,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
1 change: 0 additions & 1 deletion e2e-tests/demand-backup-fs/conf/some-name.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ spec:
volumeMounts:
- mountPath: /mnt/nfs/
name: backup-nfs
crVersion: 1.18.0
image: perconalab/percona-server-mongodb-operator:main-mongod7.0
imagePullPolicy: Always
pmm:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
name: some-users
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
name: some-users
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
name: some-users
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
name: some-users
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
name: some-users
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
name: some-users
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
name: some-users
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
name: some-users
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
name: some-users
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
name: some-users
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
name: some-users
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
name: some-users
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: POD_NAME
valueFrom:
fieldRef:
Expand Down
16 changes: 16 additions & 0 deletions e2e-tests/demand-backup-physical/conf/secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
apiVersion: v1
kind: Secret
metadata:
name: some-users
type: Opaque
data:
MONGODB_BACKUP_USER: YmFja3VwJCMl
MONGODB_BACKUP_PASSWORD: YmFja3VwMTIzNDU2Iw==
MONGODB_DATABASE_ADMIN_USER: ZGF0YWJhc2VBZG1pbg==
MONGODB_DATABASE_ADMIN_PASSWORD: ZGF0YWJhc2VBZG1pbjEyMzQ1Ng==
MONGODB_USER_ADMIN_USER: dXNlckFkbWlu
MONGODB_USER_ADMIN_PASSWORD: dXNlckFkbWluMTIzNDU2
MONGODB_CLUSTER_ADMIN_USER: Y2x1c3RlckFkbWlu
MONGODB_CLUSTER_ADMIN_PASSWORD: Y2x1c3RlckFkbWluMTIzNDU2
MONGODB_CLUSTER_MONITOR_USER: Y2x1c3Rlck1vbml0b3I=
MONGODB_CLUSTER_MONITOR_PASSWORD: Y2x1c3Rlck1vbml0b3IxMjM0NTY=
18 changes: 9 additions & 9 deletions e2e-tests/demand-backup-physical/run
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ run_backup() {
local storage=$1
local backup_name=$2

cat $test_dir/conf/backup.yml |
$sed -e "s/name:/name: ${backup_name}/" |
$sed -e "s/storageName:/storageName: ${storage}/" |
kubectl_bin apply -f -
cat $test_dir/conf/backup.yml \
| $sed -e "s/name:/name: ${backup_name}/" \
| $sed -e "s/storageName:/storageName: ${storage}/" \
| kubectl_bin apply -f -
}

run_restore() {
local backup_name=$1

cat $test_dir/conf/restore.yml |
$sed -e "s/name:/name: restore-${backup_name}/" |
$sed -e "s/backupName:/backupName: ${backup_name}/" |
kubectl_bin apply -f -
cat $test_dir/conf/restore.yml \
| $sed -e "s/name:/name: restore-${backup_name}/" \
| $sed -e "s/backupName:/backupName: ${backup_name}/" \
| kubectl_bin apply -f -
}

run_recovery_check() {
Expand Down Expand Up @@ -60,7 +60,7 @@ desc 'Testing on not sharded cluster'

echo "Creating PSMDB cluster"
cluster="some-name"
kubectl_bin apply -f "${conf_dir}/secrets.yml"
kubectl_bin apply -f "${test_dir}/conf/secrets.yml"
apply_cluster "${test_dir}/conf/${cluster}.yml"
kubectl_bin apply -f "${conf_dir}/client_with_tls.yml"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,13 +163,13 @@ spec:
- name: PBM_AGENT_MONGODB_USERNAME
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_USER
key: MONGODB_BACKUP_USER_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_AGENT_MONGODB_PASSWORD
valueFrom:
secretKeyRef:
key: MONGODB_BACKUP_PASSWORD
key: MONGODB_BACKUP_PASSWORD_ESCAPED
name: internal-some-name-users
optional: false
- name: PBM_MONGODB_REPLSET
Expand Down
Loading
Loading