-
Notifications
You must be signed in to change notification settings - Fork 121
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement etcd lifecycle management for vineyardd (#1932)
Fixes #1922 Signed-off-by: Ye Cao <[email protected]>
- Loading branch information
Showing
25 changed files
with
1,385 additions
and
116 deletions.
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
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
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,28 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: consumer | ||
spec: | ||
parallelism: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: consumer | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: consumer | ||
image: python:3.10 | ||
command: | ||
- bash | ||
- -c | ||
- | | ||
pip install vineyard numpy pandas --index-url https://pypi.tuna.tsinghua.edu.cn/simple; | ||
cat << EOF >> consumer.py | ||
import vineyard | ||
client = vineyard.connect(host="vineyardd-svc.default.svc.cluster.local",port=9600) | ||
obj_id = client.get_name("test_data") | ||
print(obj_id) | ||
client.close() | ||
EOF | ||
python consumer.py; |
68 changes: 68 additions & 0 deletions
68
k8s/test/e2e/etcd-failover/five-etcd-nodes-failover-e2e.yaml
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,68 @@ | ||
# Copyright 2020-2023 Alibaba Group Holding Limited. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
setup: | ||
env: kind | ||
kubeconfig: /tmp/e2e-k8s.config | ||
steps: | ||
- name: deploy vineyardd | ||
command: | | ||
kubectl apply -f k8s/test/e2e/etcd-failover/vineyardd.yaml | ||
kubectl scale statefulsets vineyardd --replicas=7 | ||
kubectl rollout status statefulset/vineyardd | ||
- name: deploy producer | ||
command: | | ||
kubectl apply -f k8s/test/e2e/etcd-failover/producer.yaml | ||
kubectl wait --for=condition=complete job/producer --timeout=300s | ||
- name: random delete two different pods with launched etcd for 5 times | ||
command: | | ||
for i in {1..5}; do | ||
num1=$(shuf -i 0-4 -n 1) | ||
num2=$(shuf -i 0-4 -n 1) | ||
while [ "$num1" -eq "$num2" ]; do | ||
num2=$(shuf -i 0-4 -n 1) | ||
done | ||
kubectl delete pod "vineyardd-$num1" -n default --force | ||
kubectl delete pod "vineyardd-$num2" -n default --force | ||
# wait for the instance quit messages to be propagated | ||
sleep 240 | ||
kubectl rollout status statefulset/vineyardd | ||
done | ||
- name: install consumer | ||
command: | | ||
kubectl apply -f k8s/test/e2e/etcd-failover/consumer.yaml | ||
kubectl wait --for=condition=complete job/consumer --timeout=300s | ||
timeout: 60m | ||
|
||
cleanup: | ||
# always never success failure | ||
on: success | ||
|
||
verify: | ||
# verify with retry strategy | ||
retry: | ||
# max retry count | ||
count: 10 | ||
# the interval between two attempts, e.g. 10s, 1m. | ||
interval: 10s | ||
cases: | ||
- query: | | ||
kubectl get pod -l app=consumer -oname | \ | ||
awk -F '/' '{print $2}' | \ | ||
head -n 1 | \ | ||
xargs kubectl logs | \ | ||
tail -n 1 | \ | ||
awk '{print $1}' | ||
expected: ../verify/object-id.yaml |
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,45 @@ | ||
# Copyright 2020-2023 Alibaba Group Holding Limited. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: producer | ||
spec: | ||
parallelism: 1 | ||
template: | ||
metadata: | ||
labels: | ||
app: producer | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: producer | ||
image: python:3.10 | ||
command: | ||
- bash | ||
- -c | ||
- | | ||
pip install vineyard numpy pandas --index-url https://pypi.tuna.tsinghua.edu.cn/simple; | ||
cat << EOF >> producer.py | ||
import vineyard | ||
import numpy as np | ||
import pandas as pd | ||
client = vineyard.connect(host="vineyardd-svc.default.svc.cluster.local",port=9600) | ||
data = np.ones((1000, 1000)) | ||
client.put(data, persist=True, name="test_data"); | ||
client.close() | ||
EOF | ||
python producer.py; |
63 changes: 63 additions & 0 deletions
63
k8s/test/e2e/etcd-failover/three-etcd-nodes-failover-e2e.yaml
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,63 @@ | ||
# Copyright 2020-2023 Alibaba Group Holding Limited. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
setup: | ||
env: kind | ||
kubeconfig: /tmp/e2e-k8s.config | ||
steps: | ||
- name: deploy vineyardd | ||
command: | | ||
kubectl apply -f k8s/test/e2e/etcd-failover/vineyardd.yaml | ||
kubectl scale statefulsets vineyardd --replicas=3 | ||
kubectl rollout status statefulset/vineyardd | ||
- name: deploy producer | ||
command: | | ||
kubectl apply -f k8s/test/e2e/etcd-failover/producer.yaml | ||
kubectl wait --for=condition=complete job/producer --timeout=300s | ||
- name: random delete one pod for 5 times | ||
command: | | ||
for i in {1..5}; do | ||
kubectl delete pod vineyardd-$(shuf -i 0-2 -n 1) -n default --force | ||
kubectl rollout status statefulset/vineyardd | ||
# wait for the instance quit messages to be propagated | ||
sleep 60 | ||
kubectl rollout status statefulset/vineyardd | ||
done | ||
- name: install consumer | ||
command: | | ||
kubectl apply -f k8s/test/e2e/etcd-failover/consumer.yaml | ||
kubectl wait --for=condition=complete job/consumer --timeout=300s | ||
timeout: 60m | ||
|
||
cleanup: | ||
# always never success failure | ||
on: success | ||
|
||
verify: | ||
# verify with retry strategy | ||
retry: | ||
# max retry count | ||
count: 10 | ||
# the interval between two attempts, e.g. 10s, 1m. | ||
interval: 10s | ||
cases: | ||
- query: | | ||
kubectl get pod -l app=consumer -oname | \ | ||
awk -F '/' '{print $2}' | \ | ||
head -n 1 | \ | ||
xargs kubectl logs | \ | ||
tail -n 1 | \ | ||
awk '{print $1}' | ||
expected: ../verify/object-id.yaml |
Oops, something went wrong.