-
Notifications
You must be signed in to change notification settings - Fork 151
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-807: Allow customizing replset name with custom config #1252
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
ca74211
K8SPSMDB-807: Allow customizing replset name with custom config
egegunes 4553100
K8SPSMDB-807: fix backups for custom replSetName (#1238)
hors 2d990c0
Merge branch 'main' into K8SPSMDB-807
hors 27e25ba
Merge branch 'main' into K8SPSMDB-807
hors 3931224
K8SPSMDB-807: Add custom-replset-name test
inelpandzic eed68cb
Merge branch 'main' into K8SPSMDB-807
egegunes 7465ee7
fix Jenkinsfile
egegunes e7915cd
Merge branch 'main' into K8SPSMDB-807
hors aac7e59
Merge branch 'main' into K8SPSMDB-807
hors b75021b
Merge branch 'main' into K8SPSMDB-807
egegunes 86f1941
fix images
egegunes 5d9ea86
address review comments
egegunes c1a7588
Merge branch 'main' into K8SPSMDB-807
hors File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
switched to db myApp | ||
{ "_id" : , "x" : 100500 } | ||
{ "_id" : , "x" : 100501 } | ||
bye |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
switched to db myApp | ||
{ "_id" : , "x" : 100500 } | ||
bye |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDBBackup | ||
metadata: | ||
name: backup-aws-s3 | ||
spec: | ||
psmdbCluster: some-name | ||
storageName: aws-s3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDBBackup | ||
metadata: | ||
name: backup-gcp-cs | ||
spec: | ||
psmdbCluster: some-name | ||
storageName: gcp-cs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDBBackup | ||
metadata: | ||
name: backup-minio | ||
spec: | ||
psmdbCluster: some-name | ||
storageName: minio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDBRestore | ||
metadata: | ||
name: | ||
spec: | ||
clusterName: some-name | ||
backupName: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDB | ||
metadata: | ||
name: some-name | ||
spec: | ||
crVersion: 1.14.0 | ||
allowUnsafeConfigurations: true | ||
backup: | ||
enabled: true | ||
image: percona/percona-backup-mongodb:2.0.4 | ||
pitr: | ||
enabled: false | ||
serviceAccountName: percona-server-mongodb-operator | ||
storages: | ||
aws-s3: | ||
type: s3 | ||
s3: | ||
credentialsSecret: aws-s3-secret | ||
region: us-east-1 | ||
bucket: operator-testing | ||
prefix: psmdb | ||
minio: | ||
type: s3 | ||
s3: | ||
credentialsSecret: minio-secret | ||
region: us-east-1 | ||
bucket: operator-testing | ||
endpointUrl: http://minio-service:9000/ | ||
gcp-cs: | ||
type: s3 | ||
s3: | ||
credentialsSecret: gcp-cs-secret | ||
region: us-east-1 | ||
bucket: operator-testing | ||
prefix: psmdb | ||
endpointUrl: https://storage.googleapis.com | ||
image: percona/percona-server-mongodb:4.4.10-11 | ||
imagePullPolicy: Always | ||
pmm: | ||
enabled: false | ||
replsets: | ||
- affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
arbiter: | ||
affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
enabled: false | ||
size: 1 | ||
configuration: | | ||
storage: | ||
directoryPerDB: true | ||
wiredTiger: | ||
engineConfig: | ||
directoryForIndexes: true | ||
expose: | ||
enabled: true | ||
exposeType: ClusterIP | ||
serviceAnnotations: | ||
networking.gke.io/load-balancer-type: Internal | ||
name: shard1 | ||
podDisruptionBudget: | ||
maxUnavailable: 1 | ||
size: 3 | ||
volumeSpec: | ||
persistentVolumeClaim: | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
storageClassName: standard-rwo | ||
- affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
arbiter: | ||
affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
enabled: false | ||
size: 1 | ||
configuration: | | ||
storage: | ||
directoryPerDB: true | ||
wiredTiger: | ||
engineConfig: | ||
directoryForIndexes: true | ||
expose: | ||
enabled: true | ||
exposeType: ClusterIP | ||
serviceAnnotations: | ||
networking.gke.io/load-balancer-type: Internal | ||
name: shard3 | ||
podDisruptionBudget: | ||
maxUnavailable: 1 | ||
size: 3 | ||
volumeSpec: | ||
persistentVolumeClaim: | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
storageClassName: standard-rwo | ||
- affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
arbiter: | ||
affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
enabled: false | ||
size: 1 | ||
configuration: | | ||
storage: | ||
directoryPerDB: true | ||
wiredTiger: | ||
engineConfig: | ||
directoryForIndexes: true | ||
expose: | ||
enabled: true | ||
exposeType: ClusterIP | ||
serviceAnnotations: | ||
networking.gke.io/load-balancer-type: Internal | ||
name: shard5 | ||
podDisruptionBudget: | ||
maxUnavailable: 1 | ||
size: 3 | ||
volumeSpec: | ||
persistentVolumeClaim: | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
storageClassName: standard-rwo | ||
- affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
arbiter: | ||
affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
enabled: false | ||
size: 1 | ||
configuration: | | ||
storage: | ||
directoryPerDB: true | ||
wiredTiger: | ||
engineConfig: | ||
directoryForIndexes: true | ||
expose: | ||
enabled: true | ||
exposeType: ClusterIP | ||
serviceAnnotations: | ||
networking.gke.io/load-balancer-type: Internal | ||
name: shard7 | ||
podDisruptionBudget: | ||
maxUnavailable: 1 | ||
size: 3 | ||
volumeSpec: | ||
persistentVolumeClaim: | ||
resources: | ||
requests: | ||
storage: 2Gi | ||
storageClassName: standard-rwo | ||
secrets: | ||
users: some-users | ||
sharding: | ||
configsvrReplSet: | ||
affinity: | ||
antiAffinityTopologyKey: topology.kubernetes.io/zone | ||
configuration: | | ||
replication: | ||
replSetName: csReplSet | ||
storage: | ||
directoryPerDB: true | ||
wiredTiger: | ||
engineConfig: | ||
directoryForIndexes: true | ||
expose: | ||
enabled: true | ||
exposeType: ClusterIP | ||
serviceAnnotations: | ||
networking.gke.io/load-balancer-type: Internal | ||
podDisruptionBudget: | ||
maxUnavailable: 1 | ||
size: 3 | ||
volumeSpec: | ||
persistentVolumeClaim: | ||
resources: | ||
requests: | ||
storage: 5Gi | ||
storageClassName: standard-rwo | ||
enabled: true | ||
mongos: | ||
affinity: | ||
antiAffinityTopologyKey: kubernetes.io/hostname | ||
expose: | ||
exposeType: LoadBalancer | ||
serviceAnnotations: | ||
networking.gke.io/load-balancer-type: Internal | ||
podDisruptionBudget: | ||
maxUnavailable: 1 | ||
size: 3 | ||
unmanaged: false | ||
updateStrategy: SmartUpdate | ||
upgradeOptions: | ||
apply: Disabled | ||
schedule: 0 2 * * * | ||
setFCV: false | ||
versionServiceEndpoint: https://check.percona.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/bin/bash | ||
|
||
set -o errexit | ||
set -o xtrace | ||
|
||
test_dir=$(realpath $(dirname $0)) | ||
. ${test_dir}/../functions | ||
|
||
create_namespace $namespace | ||
deploy_operator | ||
apply_s3_storage_secrets | ||
deploy_minio | ||
|
||
kubectl_bin apply -f $conf_dir/secrets.yml -f $conf_dir/client.yml -f $conf_dir/minio-secret.yml | ||
cluster="some-name" | ||
|
||
desc 'create first PSMDB cluster' | ||
apply_cluster $test_dir/conf/${cluster}.yml | ||
wait_cluster_consistency $cluster | ||
|
||
desc 'write data, read from all' | ||
run_mongos \ | ||
'db.createUser({user:"myApp",pwd:"myPass",roles:[{db:"myApp",role:"readWrite"}]})' \ | ||
"userAdmin:userAdmin123456@$cluster-mongos.$namespace" | ||
sleep 2 | ||
run_mongos \ | ||
'use myApp\n db.test.insert({ x: 100500 })' \ | ||
"myApp:myPass@$cluster-mongos.$namespace" | ||
# compare_mongos_cmd "find" "myApp:myPass@$cluster-mongos.$namespace" | ||
|
||
wait_backup_agent $cluster-shard1-0 | ||
wait_backup_agent $cluster-shard1-1 | ||
wait_backup_agent $cluster-shard1-2 | ||
wait_backup_agent $cluster-shard3-0 | ||
wait_backup_agent $cluster-shard3-1 | ||
wait_backup_agent $cluster-shard3-2 | ||
wait_backup_agent $cluster-shard5-0 | ||
wait_backup_agent $cluster-shard5-1 | ||
wait_backup_agent $cluster-shard5-2 | ||
wait_backup_agent $cluster-shard7-0 | ||
wait_backup_agent $cluster-shard7-1 | ||
wait_backup_agent $cluster-shard7-2 | ||
backup_name_aws="backup-aws-s3" | ||
backup_name_minio="backup-minio" | ||
backup_name_gcp="backup-gcp-cs" | ||
|
||
desc 'run backups' | ||
run_backup minio | ||
wait_backup "$backup_name_minio" | ||
|
||
if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then | ||
run_backup aws-s3 | ||
run_backup gcp-cs | ||
|
||
wait_backup "$backup_name_aws" | ||
wait_backup "$backup_name_gcp" | ||
fi | ||
|
||
if [ -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then | ||
desc 'check backup and restore -- aws-s3' | ||
run_restore $backup_name_aws 3 1 "-mongos" | ||
wait_restore $backup_name_aws $cluster "ready" | ||
|
||
desc 'check backup and restore -- gcp-cs' | ||
run_restore $backup_name_gcp 3 1 "-mongos" | ||
wait_restore $backup_name_gcp $cluster "ready" | ||
fi | ||
|
||
desc 'check backup and restore -- minio' | ||
run_restore $backup_name_minio 3 1 "-mongos" | ||
|
||
sleep 120 | ||
wait_restore $backup_name_minio $cluster "ready" | ||
|
||
destroy $namespace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
arbiter | ||
balancer | ||
custom-replset-name | ||
data-at-rest-encryption | ||
data-sharded | ||
default-cr | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
arbiter | ||
balancer | ||
custom-replset-name | ||
default-cr | ||
demand-backup | ||
demand-backup-physical | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
arbiter | ||
balancer | ||
custom-replset-name | ||
cross-site-sharded | ||
data-at-rest-encryption | ||
data-sharded | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
arbiter | ||
balancer | ||
custom-replset-name | ||
cross-site-sharded | ||
data-at-rest-encryption | ||
data-sharded | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use only even shard numbers?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the CR is from a customer environment, following their setup
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I remember it. Oks. Could we add comment about it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, what do you want to see in comment?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As for me, It would be nice to add an explanation why we use this shards configuration