-
Notifications
You must be signed in to change notification settings - Fork 150
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-1212: Don't disable balancer during restore #1710
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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,9 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDBBackup | ||
metadata: | ||
finalizers: | ||
- percona.com/delete-backup | ||
name: backup-minio | ||
spec: | ||
clusterName: 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
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 |
---|---|---|
@@ -0,0 +1,23 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: psmdb-client | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
name: psmdb-client | ||
template: | ||
metadata: | ||
labels: | ||
name: psmdb-client | ||
spec: | ||
terminationGracePeriodSeconds: 10 | ||
containers: | ||
- name: psmdb-client | ||
image: percona/percona-server-mongodb:7.0 | ||
imagePullPolicy: Always | ||
command: | ||
- sleep | ||
args: | ||
- "100500" |
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 |
---|---|---|
@@ -0,0 +1,51 @@ | ||
apiVersion: psmdb.percona.com/v1 | ||
kind: PerconaServerMongoDB | ||
metadata: | ||
name: some-name | ||
spec: | ||
#platform: openshift | ||
image: | ||
imagePullPolicy: Always | ||
backup: | ||
enabled: false | ||
sharding: | ||
enabled: true | ||
configsvrReplSet: | ||
size: 3 | ||
volumeSpec: | ||
persistentVolumeClaim: | ||
resources: | ||
requests: | ||
storage: 3Gi | ||
expose: | ||
enabled: false | ||
|
||
mongos: | ||
size: 3 | ||
configuration: | | ||
replication: | ||
localPingThresholdMs: 15 | ||
expose: | ||
type: ClusterIP | ||
|
||
replsets: | ||
- name: rs0 | ||
affinity: | ||
antiAffinityTopologyKey: none | ||
expose: | ||
enabled: false | ||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 1G | ||
requests: | ||
cpu: 100m | ||
memory: 0.1G | ||
volumeSpec: | ||
persistentVolumeClaim: | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
size: 3 | ||
secrets: | ||
users: some-users |
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 | ||
---|---|---|---|---|
|
@@ -9,7 +9,7 @@ set_debug | |||
check_cr_config() { | ||||
local cluster="$1" | ||||
|
||||
desc "create first PSMDB cluster $cluster" | ||||
desc "create PSMDB cluster $cluster" | ||||
apply_cluster $test_dir/conf/$cluster.yml | ||||
|
||||
desc 'check if all 3 Pods started' | ||||
|
@@ -40,8 +40,8 @@ check_cr_config() { | |||
compare_mongo_cmd "find" "myApp:myPass@$(get_service_ip $cluster-1)" "" ":27017" | ||||
compare_mongo_cmd "find" "myApp:myPass@$(get_service_ip $cluster-2)" "" ":27017" | ||||
|
||||
desc 'add service-per-pod lebel and annotation' | ||||
if [[ $cluster == "node-port-rs0" ]]; then | ||||
desc 'add service-per-pod label and annotation' | ||||
old_node_port=$(kubectl_bin get svc node-port-rs0-0 -o 'jsonpath={.spec.ports[0].nodePort}') | ||||
kubectl_bin patch psmdb node-port --type=json --patch '[ | ||||
{ | ||||
|
@@ -74,6 +74,36 @@ check_cr_config() { | |||
-f $test_dir/conf/$cluster.yml | ||||
} | ||||
|
||||
check_service() { | ||||
state=$1 | ||||
svc_name=$2 | ||||
if [ $state = "present" ]; then | ||||
echo -n "check that $svc_name was created" | ||||
local timeout=0 | ||||
until kubectl_bin get service/$svc_name -o 'jsonpath={.spec.type}' 2>&1 | grep -vq NotFound; do | ||||
sleep 1 | ||||
timeout=$((timeout + 1)) | ||||
echo -n '.' | ||||
if [[ ${timeout} -gt 900 ]]; then | ||||
echo "Waiting timeout has been reached. Service $svc_name is not present. Exiting..." | ||||
exit 1 | ||||
fi | ||||
done | ||||
echo ".OK" | ||||
elif [ $state = "removed" ]; then | ||||
echo -n "check that $svc_name was removed" | ||||
if [[ -z $(kubectl_bin get service/$svc_name -o 'jsonpath={.spec.type}' 2>&1 | grep NotFound) ]]; then | ||||
echo "$svc_name was not removed." | ||||
exit 1 | ||||
else | ||||
echo ".OK" | ||||
fi | ||||
else | ||||
echo "unknown state $state" | ||||
fi | ||||
} | ||||
|
||||
|
||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [shfmt] reported by reviewdog 🐶
Suggested change
|
||||
main() { | ||||
create_infra $namespace | ||||
deploy_cert_manager | ||||
|
@@ -92,6 +122,21 @@ main() { | |||
desc 'check NodePort' | ||||
check_cr_config "node-port-rs0" | ||||
|
||||
desc 'check Mongos in sharded cluster' | ||||
local cluster=some-name | ||||
apply_cluster "$test_dir/conf/sharded.yml" | ||||
wait_for_running $cluster-rs0 3 | ||||
wait_for_running $cluster-cfg 3 "false" | ||||
wait_for_running $cluster-mongos 3 | ||||
|
||||
desc 'enabling servicePerPod for mongos' | ||||
kubectl patch psmdb some-name --type=merge -p '{"spec":{"sharding":{"mongos":{"expose":{"servicePerPod":true}}}}}' | ||||
wait_for_running $cluster-mongos 3 | ||||
check_service present $cluster-mongos-0 | ||||
check_service present $cluster-mongos-1 | ||||
check_service present $cluster-mongos-2 | ||||
check_service removed $cluster-mongos | ||||
|
||||
destroy $namespace | ||||
|
||||
desc 'test passed' | ||||
|
Oops, something went wrong.
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.
[shfmt] reported by reviewdog 🐶