-
Notifications
You must be signed in to change notification settings - Fork 1k
/
Copy pathrun-e2e-kind.sh
executable file
·174 lines (144 loc) · 5.35 KB
/
run-e2e-kind.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
#!/bin/bash
#
# Copyright 2021 The Volcano Authors.
#
# 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.
#
export VK_ROOT=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )/..
export VC_BIN=${VK_ROOT}/${BIN_DIR}/${BIN_OSARCH}
export LOG_LEVEL=3
export CLEANUP_CLUSTER=${CLEANUP_CLUSTER:-1}
export E2E_TYPE=${E2E_TYPE:-"ALL"}
export ARTIFACTS_PATH=${ARTIFACTS_PATH:-"${VK_ROOT}/volcano-e2e-logs"}
mkdir -p "$ARTIFACTS_PATH"
NAMESPACE=${NAMESPACE:-volcano-system}
CLUSTER_NAME=${CLUSTER_NAME:-integration}
export CLUSTER_CONTEXT=("--name" "${CLUSTER_NAME}")
export KIND_OPT=${KIND_OPT:="--config ${VK_ROOT}/hack/e2e-kind-config.yaml"}
function install-volcano {
install-helm
# judge crd version
major=$(kubectl version --output yaml | awk '/serverVersion/,0' |grep -E 'major:' | awk '{print $2}' | tr "\"" " ")
minor=$(kubectl version --output yaml | awk '/serverVersion/,0' |grep -E 'minor:' | awk '{print $2}' | tr "\"" " ")
crd_version="v1"
# if k8s version less than v1.18, crd version use v1beta
if [ "$major" -le "1" ]; then
if [ "$minor" -lt "18" ]; then
crd_version="v1beta1"
fi
fi
echo "Ensure create namespace"
kubectl apply -f installer/namespace.yaml
echo "Install volcano chart with crd version $crd_version"
cat <<EOF | helm install ${CLUSTER_NAME} installer/helm/chart/volcano \
--namespace ${NAMESPACE} \
--kubeconfig ${KUBECONFIG} \
--values - \
--wait
basic:
image_pull_policy: IfNotPresent
image_tag_version: ${TAG}
scheduler_config_file: config/volcano-scheduler-ci.conf
crd_version: ${crd_version}
custom:
admission_tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
controller_tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
scheduler_tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Exists"
effect: "NoSchedule"
default_ns:
node-role.kubernetes.io/control-plane: ""
EOF
}
function uninstall-volcano {
helm uninstall "${CLUSTER_NAME}" -n ${NAMESPACE}
}
function generate-log {
echo "Generating volcano log files"
kind export logs "${CLUSTER_CONTEXT[@]}" "$ARTIFACTS_PATH"
}
# clean up
function cleanup {
uninstall-volcano
echo "Running kind: [kind delete cluster ${CLUSTER_CONTEXT[*]}]"
kind delete cluster "${CLUSTER_CONTEXT[@]}"
}
echo $* | grep -E -q "\-\-help|\-h"
if [[ $? -eq 0 ]]; then
echo "Customize the kind-cluster name:
export CLUSTER_NAME=<custom cluster name> # default: integration
Customize kind options other than --name:
export KIND_OPT=<kind options>
Disable displaying volcano component logs:
export SHOW_VOLCANO_LOGS=0
"
exit 0
fi
if [[ $CLEANUP_CLUSTER -eq 1 ]]; then
trap cleanup EXIT
fi
source "${VK_ROOT}/hack/lib/install.sh"
check-prerequisites
kind-up-cluster
if [[ -z ${KUBECONFIG+x} ]]; then
export KUBECONFIG="${HOME}/.kube/config"
fi
install-volcano
# Run e2e test
cd ${VK_ROOT}
install-ginkgo-if-not-exist
case ${E2E_TYPE} in
"ALL")
echo "Running e2e..."
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --nodes=4 --compilers=4 --randomize-all --randomize-suites --fail-on-pending --cover --trace --race --slow-spec-threshold='30s' --progress ./test/e2e/jobp/
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/jobseq/
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/schedulingbase/
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/schedulingaction/
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/vcctl/
;;
"JOBP")
echo "Running parallel job e2e suite..."
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --nodes=4 --compilers=4 --randomize-all --randomize-suites --fail-on-pending --cover --trace --race --slow-spec-threshold='30s' --progress ./test/e2e/jobp/
;;
"JOBSEQ")
echo "Running sequence job e2e suite..."
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/jobseq/
;;
"SCHEDULINGBASE")
echo "Running scheduling base e2e suite..."
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/schedulingbase/
;;
"SCHEDULINGACTION")
echo "Running scheduling action e2e suite..."
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/schedulingaction/
;;
"VCCTL")
echo "Running vcctl e2e suite..."
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/vcctl/
;;
"STRESS")
echo "Running stress e2e suite..."
KUBECONFIG=${KUBECONFIG} GOOS=${OS} ginkgo -r --slow-spec-threshold='30s' --progress ./test/e2e/stress/
;;
esac
if [[ $? -ne 0 ]]; then
generate-log
exit 1
fi