Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
a5d0616b
Commit
a5d0616b
authored
Jan 18, 2019
by
Roy Lenferink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improving syntax for bash scripts
parent
31e4ece5
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
89 additions
and
89 deletions
+89
-89
gen-swagger-docs.sh
hack/gen-swagger-doc/gen-swagger-docs.sh
+1
-1
ginkgo-e2e.sh
hack/ginkgo-e2e.sh
+1
-1
benchmark-dockerized.sh
hack/jenkins/benchmark-dockerized.sh
+1
-1
test-dockerized.sh
hack/jenkins/test-dockerized.sh
+1
-1
etcd.sh
hack/lib/etcd.sh
+3
-3
golang.sh
hack/lib/golang.sh
+3
-3
logging.sh
hack/lib/logging.sh
+5
-5
protoc.sh
hack/lib/protoc.sh
+1
-1
local-up-cluster.sh
hack/local-up-cluster.sh
+13
-13
make-help.sh
hack/make-rules/make-help.sh
+6
-6
test-e2e-node.sh
hack/make-rules/test-e2e-node.sh
+46
-46
test.sh
hack/make-rules/test.sh
+7
-7
update-gofmt.sh
hack/update-gofmt.sh
+1
-1
No files found.
hack/gen-swagger-doc/gen-swagger-docs.sh
View file @
a5d0616b
...
@@ -35,7 +35,7 @@ top_level_models=$(grep '&[A-Za-z]*{},' /register.go | sed 's/.*&//;s/{},//')
...
@@ -35,7 +35,7 @@ top_level_models=$(grep '&[A-Za-z]*{},' /register.go | sed 's/.*&//;s/{},//')
# check if the top level models exist in the definitions.adoc. If they exist,
# check if the top level models exist in the definitions.adoc. If they exist,
# their name will be <version>.<model_name>
# their name will be <version>.<model_name>
VERSION
=
"
${
1
#*_
}
"
VERSION
=
"
${
1
#*_
}
"
for
m
in
$
top_level_models
for
m
in
$
{
top_level_models
}
do
do
if
grep
-xq
"===
${
VERSION
}
.
$m
"
./definitions.adoc
if
grep
-xq
"===
${
VERSION
}
.
$m
"
./definitions.adoc
then
then
...
...
hack/ginkgo-e2e.sh
View file @
a5d0616b
...
@@ -87,7 +87,7 @@ if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then
...
@@ -87,7 +87,7 @@ if [[ "${KUBERNETES_PROVIDER}" == "gce" ]]; then
set_num_migs
set_num_migs
NODE_INSTANCE_GROUP
=
""
NODE_INSTANCE_GROUP
=
""
for
((
i
=
1
;
i<
=
${
NUM_MIGS
}
;
i++
))
;
do
for
((
i
=
1
;
i<
=
${
NUM_MIGS
}
;
i++
))
;
do
if
[[
$
i
==
${
NUM_MIGS
}
]]
;
then
if
[[
$
{
i
}
==
${
NUM_MIGS
}
]]
;
then
# We are assigning the same mig names as create-nodes function from cluster/gce/util.sh.
# We are assigning the same mig names as create-nodes function from cluster/gce/util.sh.
NODE_INSTANCE_GROUP
=
"
${
NODE_INSTANCE_GROUP
}${
NODE_INSTANCE_PREFIX
}
-group"
NODE_INSTANCE_GROUP
=
"
${
NODE_INSTANCE_GROUP
}${
NODE_INSTANCE_PREFIX
}
-group"
else
else
...
...
hack/jenkins/benchmark-dockerized.sh
View file @
a5d0616b
...
@@ -21,7 +21,7 @@ set -o xtrace
...
@@ -21,7 +21,7 @@ set -o xtrace
retry
()
{
retry
()
{
for
i
in
{
1..5
}
;
do
for
i
in
{
1..5
}
;
do
"
$@
"
&&
return
0
||
sleep
$i
"
$@
"
&&
return
0
||
sleep
"
${
i
}
"
done
done
"
$@
"
"
$@
"
}
}
...
...
hack/jenkins/test-dockerized.sh
View file @
a5d0616b
...
@@ -21,7 +21,7 @@ set -o xtrace
...
@@ -21,7 +21,7 @@ set -o xtrace
retry
()
{
retry
()
{
for
i
in
{
1..5
}
;
do
for
i
in
{
1..5
}
;
do
"
$@
"
&&
return
0
||
sleep
$i
"
$@
"
&&
return
0
||
sleep
"
${
i
}
"
done
done
"
$@
"
"
$@
"
}
}
...
...
hack/lib/etcd.sh
View file @
a5d0616b
...
@@ -47,12 +47,12 @@ kube::etcd::validate() {
...
@@ -47,12 +47,12 @@ kube::etcd::validate() {
# validate installed version is at least equal to minimum
# validate installed version is at least equal to minimum
version
=
$(
etcd
--version
|
tail
-n
+1 |
head
-n
1 |
cut
-d
" "
-f
3
)
version
=
$(
etcd
--version
|
tail
-n
+1 |
head
-n
1 |
cut
-d
" "
-f
3
)
if
[[
$(
kube::etcd::version
$
ETCD_VERSION
)
-gt
$(
kube::etcd::version
$version
)
]]
;
then
if
[[
$(
kube::etcd::version
$
{
ETCD_VERSION
})
-gt
$(
kube::etcd::version
${
version
}
)
]]
;
then
export
PATH
=
$
KUBE_ROOT
/third_party/etcd:
$PATH
export
PATH
=
$
{
KUBE_ROOT
}
/third_party/etcd:
$PATH
hash
etcd
hash
etcd
echo
$PATH
echo
$PATH
version
=
$(
etcd
--version
|
head
-n
1 |
cut
-d
" "
-f
3
)
version
=
$(
etcd
--version
|
head
-n
1 |
cut
-d
" "
-f
3
)
if
[[
$(
kube::etcd::version
$
ETCD_VERSION
)
-gt
$(
kube::etcd::version
$version
)
]]
;
then
if
[[
$(
kube::etcd::version
$
{
ETCD_VERSION
})
-gt
$(
kube::etcd::version
${
version
}
)
]]
;
then
kube::log::usage
"etcd version
${
ETCD_VERSION
}
or greater required."
kube::log::usage
"etcd version
${
ETCD_VERSION
}
or greater required."
kube::log::info
"You can use 'hack/install-etcd.sh' to install a copy in third_party/."
kube::log::info
"You can use 'hack/install-etcd.sh' to install a copy in third_party/."
exit
1
exit
1
...
...
hack/lib/golang.sh
View file @
a5d0616b
...
@@ -594,11 +594,11 @@ kube::golang::build_binaries_for_platform() {
...
@@ -594,11 +594,11 @@ kube::golang::build_binaries_for_platform() {
for
binary
in
"
${
binaries
[@]
}
"
;
do
for
binary
in
"
${
binaries
[@]
}
"
;
do
if
[[
"
${
binary
}
"
=
~
".test"
$
]]
;
then
if
[[
"
${
binary
}
"
=
~
".test"
$
]]
;
then
tests+
=(
$
binary
)
tests+
=(
$
{
binary
}
)
elif
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
elif
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
statics+
=(
$
binary
)
statics+
=(
$
{
binary
}
)
else
else
nonstatics+
=(
$
binary
)
nonstatics+
=(
$
{
binary
}
)
fi
fi
done
done
...
...
hack/lib/logging.sh
View file @
a5d0616b
...
@@ -57,10 +57,10 @@ kube::log::install_errexit() {
...
@@ -57,10 +57,10 @@ kube::log::install_errexit() {
kube::log::stack
()
{
kube::log::stack
()
{
local
stack_skip
=
${
1
:-
0
}
local
stack_skip
=
${
1
:-
0
}
stack_skip
=
$((
stack_skip
+
1
))
stack_skip
=
$((
stack_skip
+
1
))
if
[[
${#
FUNCNAME
[@]
}
-gt
$
stack_skip
]]
;
then
if
[[
${#
FUNCNAME
[@]
}
-gt
$
{
stack_skip
}
]]
;
then
echo
"Call stack:"
>
&2
echo
"Call stack:"
>
&2
local
i
local
i
for
((
i
=
1
;
i <
=
${#
FUNCNAME
[@]
}
-
$
stack_skip
;
i++
))
for
((
i
=
1
;
i <
=
${#
FUNCNAME
[@]
}
-
$
{
stack_skip
}
;
i++
))
do
do
local
frame_no
=
$((
i
-
1
+
stack_skip
))
local
frame_no
=
$((
i
-
1
+
stack_skip
))
local
source_file
=
${
BASH_SOURCE
[
$frame_no
]
}
local
source_file
=
${
BASH_SOURCE
[
$frame_no
]
}
...
@@ -90,7 +90,7 @@ kube::log::error_exit() {
...
@@ -90,7 +90,7 @@ kube::log::error_exit() {
echo
"
${
1
}
"
>
&2
echo
"
${
1
}
"
>
&2
}
}
kube::log::stack
$
stack_skip
kube::log::stack
$
{
stack_skip
}
echo
"Exiting with status
${
code
}
"
>
&2
echo
"Exiting with status
${
code
}
"
>
&2
fi
fi
...
@@ -130,7 +130,7 @@ kube::log::usage_from_stdin() {
...
@@ -130,7 +130,7 @@ kube::log::usage_from_stdin() {
# Print out some info that isn't a top level status line
# Print out some info that isn't a top level status line
kube::log::info
()
{
kube::log::info
()
{
local
V
=
"
${
V
:-
0
}
"
local
V
=
"
${
V
:-
0
}
"
if
[[
$
KUBE_VERBOSE
<
$V
]]
;
then
if
[[
$
{
KUBE_VERBOSE
}
<
${
V
}
]]
;
then
return
return
fi
fi
...
@@ -158,7 +158,7 @@ kube::log::info_from_stdin() {
...
@@ -158,7 +158,7 @@ kube::log::info_from_stdin() {
# Print a status line. Formatted to show up in a stream of output.
# Print a status line. Formatted to show up in a stream of output.
kube::log::status
()
{
kube::log::status
()
{
local
V
=
"
${
V
:-
0
}
"
local
V
=
"
${
V
:-
0
}
"
if
[[
$
KUBE_VERBOSE
<
$V
]]
;
then
if
[[
$
{
KUBE_VERBOSE
}
<
${
V
}
]]
;
then
return
return
fi
fi
...
...
hack/lib/protoc.sh
View file @
a5d0616b
...
@@ -83,7 +83,7 @@ function kube::protoc::format() {
...
@@ -83,7 +83,7 @@ function kube::protoc::format() {
function
kube::protoc::diff
()
{
function
kube::protoc::diff
()
{
local
ret
=
0
local
ret
=
0
diff
-I
"gzipped FileDescriptorProto"
-I
"0x"
-Naupr
${
1
}
${
2
}
||
ret
=
$?
diff
-I
"gzipped FileDescriptorProto"
-I
"0x"
-Naupr
${
1
}
${
2
}
||
ret
=
$?
if
[[
$
ret
-ne
0
]]
;
then
if
[[
$
{
ret
}
-ne
0
]]
;
then
echo
${
3
}
echo
${
3
}
exit
1
exit
1
fi
fi
...
...
hack/local-up-cluster.sh
View file @
a5d0616b
...
@@ -169,7 +169,7 @@ function guess_built_binary_path {
...
@@ -169,7 +169,7 @@ function guess_built_binary_path {
GO_OUT
=
${
GO_OUT
:-}
GO_OUT
=
${
GO_OUT
:-}
while
getopts
"ho:O"
OPTION
while
getopts
"ho:O"
OPTION
do
do
case
$
OPTION
in
case
$
{
OPTION
}
in
o
)
o
)
echo
"skipping build"
echo
"skipping build"
GO_OUT
=
"
$OPTARG
"
GO_OUT
=
"
$OPTARG
"
...
@@ -263,20 +263,20 @@ function test_apiserver_off {
...
@@ -263,20 +263,20 @@ function test_apiserver_off {
# For the common local scenario, fail fast if server is already running.
# For the common local scenario, fail fast if server is already running.
# this can happen if you run local-up-cluster.sh twice and kill etcd in between.
# this can happen if you run local-up-cluster.sh twice and kill etcd in between.
if [[ "${API_PORT}" -gt "0" ]]; then
if [[ "${API_PORT}" -gt "0" ]]; then
curl --silent -g $
API_HOST:$API_PORT
curl --silent -g $
{API_HOST}:${API_PORT}
if [ ! $? -eq 0 ]; then
if [ ! $? -eq 0 ]; then
echo "API SERVER insecure port is free, proceeding..."
echo "API SERVER insecure port is free, proceeding..."
else
else
echo "ERROR starting API SERVER, exiting. Some process on $
API_HOST is serving already on $API_PORT
"
echo "ERROR starting API SERVER, exiting. Some process on $
{API_HOST} is serving already on ${API_PORT}
"
exit 1
exit 1
fi
fi
fi
fi
curl --silent -k -g $
API_HOST:$API_SECURE_PORT
curl --silent -k -g $
{API_HOST}:${API_SECURE_PORT}
if [ ! $? -eq 0 ]; then
if [ ! $? -eq 0 ]; then
echo "API SERVER secure port is free, proceeding..."
echo "API SERVER secure port is free, proceeding..."
else
else
echo "ERROR starting API SERVER, exiting. Some process on $
API_HOST is serving already on $API_SECURE_PORT
"
echo "ERROR starting API SERVER, exiting. Some process on $
{API_HOST} is serving already on ${API_SECURE_PORT}
"
exit 1
exit 1
fi
fi
}
}
...
@@ -335,9 +335,9 @@ function detect_binary {
...
@@ -335,9 +335,9 @@ function detect_binary {
cleanup_dockerized_kubelet()
cleanup_dockerized_kubelet()
{
{
if [[ -e $
KUBELET_CIDFILE
]]; then
if [[ -e $
{KUBELET_CIDFILE}
]]; then
docker kill $(<$
KUBELET_CIDFILE
) > /dev/null
docker kill $(<$
{KUBELET_CIDFILE}
) > /dev/null
rm -f $
KUBELET_CIDFILE
rm -f $
{KUBELET_CIDFILE}
# Save the docker logs
# Save the docker logs
if [[ -f /var/log/docker.log ]]; then
if [[ -f /var/log/docker.log ]]; then
...
@@ -841,7 +841,7 @@ function start_kubelet {
...
@@ -841,7 +841,7 @@ function start_kubelet {
--pid=host
\
--pid=host
\
--privileged=true
\
--privileged=true
\
-i
\
-i
\
--cidfile=
$
KUBELET_CIDFILE
\
--cidfile=
$
{
KUBELET_CIDFILE
}
\
"
${
KUBELET_IMAGE
}
"
\
"
${
KUBELET_IMAGE
}
"
\
/kubelet "
${
all_kubelet_flags
[@]
}
" >"
${
KUBELET_LOG
}
" 2>&1 &
/kubelet "
${
all_kubelet_flags
[@]
}
" >"
${
KUBELET_LOG
}
" 2>&1 &
# Get PID of kubelet container.
# Get PID of kubelet container.
...
@@ -858,7 +858,7 @@ function start_kubelet {
...
@@ -858,7 +858,7 @@ function start_kubelet {
done
done
fi
fi
# Quick check that kubelet is running.
# Quick check that kubelet is running.
if [ -n "
$KUBELET_PID
" ] && ps -p
$
KUBELET_PID
> /dev/null; then
if [ -n "
$KUBELET_PID
" ] && ps -p
$
{
KUBELET_PID
}
> /dev/null; then
echo "
kubelet
(
$KUBELET_PID
) is running.
"
echo "
kubelet
(
$KUBELET_PID
) is running.
"
else
else
cat
${
KUBELET_LOG
}
; exit 1
cat
${
KUBELET_LOG
}
; exit 1
...
@@ -882,7 +882,7 @@ EOF
...
@@ -882,7 +882,7 @@ EOF
# foo: true
# foo: true
# bar: false
# bar: false
for gate in
$(
echo
${
FEATURE_GATES
}
|
tr
','
' '
)
; do
for gate in
$(
echo
${
FEATURE_GATES
}
|
tr
','
' '
)
; do
echo
$
gate
|
${
SED
}
-e 's/
\(
.*
\)
=
\(
.*
\)
/
\1
:
\2
/'
echo
$
{
gate
}
|
${
SED
}
-e 's/
\(
.*
\)
=
\(
.*
\)
/
\1
:
\2
/'
done
done
fi >>/tmp/kube-proxy.yaml
fi >>/tmp/kube-proxy.yaml
...
@@ -953,9 +953,9 @@ function create_storage_class {
...
@@ -953,9 +953,9 @@ function create_storage_class {
CLASS_FILE=
${
KUBE_ROOT
}
/cluster/addons/storage-class/
${
CLOUD_PROVIDER
}
/default.yaml
CLASS_FILE=
${
KUBE_ROOT
}
/cluster/addons/storage-class/
${
CLOUD_PROVIDER
}
/default.yaml
fi
fi
if [ -e
$
CLASS_FILE
]; then
if [ -e
$
{
CLASS_FILE
}
]; then
echo "
Create default storage class
for
$CLOUD_PROVIDER
"
echo "
Create default storage class
for
$CLOUD_PROVIDER
"
${
KUBECTL
}
--kubeconfig="
${
CERT_DIR
}
/admin.kubeconfig
" create -f
$
CLASS_FILE
${
KUBECTL
}
--kubeconfig="
${
CERT_DIR
}
/admin.kubeconfig
" create -f
$
{
CLASS_FILE
}
else
else
echo "
No storage class available
for
$CLOUD_PROVIDER
.
"
echo "
No storage class available
for
$CLOUD_PROVIDER
.
"
fi
fi
...
...
hack/make-rules/make-help.sh
View file @
a5d0616b
...
@@ -28,15 +28,15 @@ CMD_FLAG=false
...
@@ -28,15 +28,15 @@ CMD_FLAG=false
PLUGIN_CMD_FLAG
=
false
PLUGIN_CMD_FLAG
=
false
echo
"--------------------------------------------------------------------------------"
echo
"--------------------------------------------------------------------------------"
for
tar
in
$
ALL_TARGETS
;
do
for
tar
in
$
{
ALL_TARGETS
}
;
do
for
cmdtar
in
$
CMD_TARGETS
;
do
for
cmdtar
in
$
{
CMD_TARGETS
}
;
do
if
[
$
tar
=
$cmdtar
]
;
then
if
[
$
{
tar
}
=
${
cmdtar
}
]
;
then
if
[
$
CMD_FLAG
=
true
]
;
then
if
[
$
{
CMD_FLAG
}
=
true
]
;
then
continue
2
;
continue
2
;
fi
fi
echo
-e
"
${
red
}${
CMD_TARGETS
}${
reset
}
"
echo
-e
"
${
red
}${
CMD_TARGETS
}${
reset
}
"
make
-C
"
${
KUBE_ROOT
}
"
$
tar
PRINT_HELP
=
y
make
-C
"
${
KUBE_ROOT
}
"
$
{
tar
}
PRINT_HELP
=
y
echo
"---------------------------------------------------------------------------------"
echo
"---------------------------------------------------------------------------------"
CMD_FLAG
=
true
CMD_FLAG
=
true
...
@@ -45,6 +45,6 @@ for tar in $ALL_TARGETS; do
...
@@ -45,6 +45,6 @@ for tar in $ALL_TARGETS; do
done
done
echo
-e
"
${
red
}${
tar
}${
reset
}
"
echo
-e
"
${
red
}${
tar
}${
reset
}
"
make
-C
"
${
KUBE_ROOT
}
"
$
tar
PRINT_HELP
=
y
make
-C
"
${
KUBE_ROOT
}
"
$
{
tar
}
PRINT_HELP
=
y
echo
"---------------------------------------------------------------------------------"
echo
"---------------------------------------------------------------------------------"
done
done
hack/make-rules/test-e2e-node.sh
View file @
a5d0616b
...
@@ -37,20 +37,20 @@ system_spec_name=${SYSTEM_SPEC_NAME:-}
...
@@ -37,20 +37,20 @@ system_spec_name=${SYSTEM_SPEC_NAME:-}
# Parse the flags to pass to ginkgo
# Parse the flags to pass to ginkgo
ginkgoflags
=
""
ginkgoflags
=
""
if
[[
$
parallelism
>
1
]]
;
then
if
[[
$
{
parallelism
}
>
1
]]
;
then
ginkgoflags
=
"
$
ginkgoflags
-nodes=
$parallelism
"
ginkgoflags
=
"
$
{
ginkgoflags
}
-nodes=
${
parallelism
}
"
fi
fi
if
[[
$
focus
!=
""
]]
;
then
if
[[
$
{
focus
}
!=
""
]]
;
then
ginkgoflags
=
"
$
ginkgoflags
-focus=
\"
$focus
\"
"
ginkgoflags
=
"
$
{
ginkgoflags
}
-focus=
\"
${
focus
}
\"
"
fi
fi
if
[[
$
skip
!=
""
]]
;
then
if
[[
$
{
skip
}
!=
""
]]
;
then
ginkgoflags
=
"
$
ginkgoflags
-skip=
\"
$skip
\"
"
ginkgoflags
=
"
$
{
ginkgoflags
}
-skip=
\"
${
skip
}
\"
"
fi
fi
if
[[
$
run_until_failure
!=
""
]]
;
then
if
[[
$
{
run_until_failure
}
!=
""
]]
;
then
ginkgoflags
=
"
$
ginkgoflags
-untilItFails=
$run_until_failure
"
ginkgoflags
=
"
$
{
ginkgoflags
}
-untilItFails=
${
run_until_failure
}
"
fi
fi
# Setup the directory to copy test artifacts (logs, junit.xml, etc) from remote host to local host
# Setup the directory to copy test artifacts (logs, junit.xml, etc) from remote host to local host
...
@@ -60,34 +60,34 @@ if [ ! -d "${artifacts}" ]; then
...
@@ -60,34 +60,34 @@ if [ ! -d "${artifacts}" ]; then
fi
fi
echo
"Test artifacts will be written to
${
artifacts
}
"
echo
"Test artifacts will be written to
${
artifacts
}
"
if
[[
$
runtime
==
"remote"
]]
;
then
if
[[
$
{
runtime
}
==
"remote"
]]
;
then
if
[[
!
-z
$
container_runtime_endpoint
]]
;
then
if
[[
!
-z
$
{
container_runtime_endpoint
}
]]
;
then
test_args
=
"--container-runtime-endpoint=
${
container_runtime_endpoint
}
$
test_args
"
test_args
=
"--container-runtime-endpoint=
${
container_runtime_endpoint
}
$
{
test_args
}
"
fi
fi
if
[[
!
-z
$
image_service_endpoint
]]
;
then
if
[[
!
-z
$
{
image_service_endpoint
}
]]
;
then
test_args
=
"--image-service-endpoint=
$
image_service_endpoint
$test_args
"
test_args
=
"--image-service-endpoint=
$
{
image_service_endpoint
}
${
test_args
}
"
fi
fi
fi
fi
if
[
$
remote
=
true
]
;
then
if
[
$
{
remote
}
=
true
]
;
then
# The following options are only valid in remote run.
# The following options are only valid in remote run.
images
=
${
IMAGES
:-
""
}
images
=
${
IMAGES
:-
""
}
hosts
=
${
HOSTS
:-
""
}
hosts
=
${
HOSTS
:-
""
}
image_project
=
${
IMAGE_PROJECT
:-
"kubernetes-node-e2e-images"
}
image_project
=
${
IMAGE_PROJECT
:-
"kubernetes-node-e2e-images"
}
metadata
=
${
INSTANCE_METADATA
:-
""
}
metadata
=
${
INSTANCE_METADATA
:-
""
}
list_images
=
${
LIST_IMAGES
:-
false
}
list_images
=
${
LIST_IMAGES
:-
false
}
if
[[
$
list_images
==
"true"
]]
;
then
if
[[
$
{
list_images
}
==
"true"
]]
;
then
gcloud compute images list
--project
=
"
${
image_project
}
"
|
grep
"e2e-node"
gcloud compute images list
--project
=
"
${
image_project
}
"
|
grep
"e2e-node"
exit
0
exit
0
fi
fi
gubernator
=
${
GUBERNATOR
:-
"false"
}
gubernator
=
${
GUBERNATOR
:-
"false"
}
image_config_file
=
${
IMAGE_CONFIG_FILE
:-
""
}
image_config_file
=
${
IMAGE_CONFIG_FILE
:-
""
}
if
[[
$
hosts
==
""
&&
$images
==
""
&&
$image_config_file
==
""
]]
;
then
if
[[
$
{
hosts
}
==
""
&&
${
images
}
==
""
&&
${
image_config_file
}
==
""
]]
;
then
image_project
=
${
IMAGE_PROJECT
:-
"cos-cloud"
}
image_project
=
${
IMAGE_PROJECT
:-
"cos-cloud"
}
gci_image
=
$(
gcloud compute images list
--project
$
image_project
\
gci_image
=
$(
gcloud compute images list
--project
$
{
image_project
}
\
--no-standard-images
--filter
=
"name ~ 'cos-beta.*'"
--format
=
"table[no-heading](name)"
)
--no-standard-images
--filter
=
"name ~ 'cos-beta.*'"
--format
=
"table[no-heading](name)"
)
images
=
$
gci_image
images
=
$
{
gci_image
}
metadata
=
"user-data<
${
KUBE_ROOT
}
/test/e2e_node/jenkins/gci-init.yaml,gci-update-strategy=update_disabled"
metadata
=
"user-data<
${
KUBE_ROOT
}
/test/e2e_node/jenkins/gci-init.yaml,gci-update-strategy=update_disabled"
fi
fi
instance_prefix
=
${
INSTANCE_PREFIX
:-
"test"
}
instance_prefix
=
${
INSTANCE_PREFIX
:-
"test"
}
...
@@ -97,58 +97,58 @@ if [ $remote = true ] ; then
...
@@ -97,58 +97,58 @@ if [ $remote = true ] ; then
# Get the compute zone
# Get the compute zone
zone
=
${
ZONE
:-
"
$(
gcloud info
--format
=
'value(config.properties.compute.zone)'
)
"
}
zone
=
${
ZONE
:-
"
$(
gcloud info
--format
=
'value(config.properties.compute.zone)'
)
"
}
if
[[
$
zone
==
""
]]
;
then
if
[[
$
{
zone
}
==
""
]]
;
then
echo
"Could not find gcloud compute/zone when running:
\`
gcloud info --format='value(config.properties.compute.zone)'
\`
"
echo
"Could not find gcloud compute/zone when running:
\`
gcloud info --format='value(config.properties.compute.zone)'
\`
"
exit
1
exit
1
fi
fi
# Get the compute project
# Get the compute project
project
=
$(
gcloud info
--format
=
'value(config.project)'
)
project
=
$(
gcloud info
--format
=
'value(config.project)'
)
if
[[
$
project
==
""
]]
;
then
if
[[
$
{
project
}
==
""
]]
;
then
echo
"Could not find gcloud project when running:
\`
gcloud info --format='value(config.project)'
\`
"
echo
"Could not find gcloud project when running:
\`
gcloud info --format='value(config.project)'
\`
"
exit
1
exit
1
fi
fi
# Check if any of the images specified already have running instances. If so reuse those instances
# Check if any of the images specified already have running instances. If so reuse those instances
# by moving the IMAGE to a HOST
# by moving the IMAGE to a HOST
if
[[
$
images
!=
""
]]
;
then
if
[[
$
{
images
}
!=
""
]]
;
then
IFS
=
','
read
-ra
IM
<<<
"
$
images
"
IFS
=
','
read
-ra
IM
<<<
"
$
{
images
}
"
images
=
""
images
=
""
for
i
in
"
${
IM
[@]
}
"
;
do
for
i
in
"
${
IM
[@]
}
"
;
do
if
[[
$(
gcloud compute instances list
"
${
instance_prefix
}
-
$i
"
|
grep
$
i
)
]]
;
then
if
[[
$(
gcloud compute instances list
"
${
instance_prefix
}
-
$i
"
|
grep
$
{
i
}
)
]]
;
then
if
[[
$
hosts
!=
""
]]
;
then
if
[[
$
{
hosts
}
!=
""
]]
;
then
hosts
=
"
$
hosts
,"
hosts
=
"
$
{
hosts
}
,"
fi
fi
echo
"Reusing host
${
instance_prefix
}
-
$i
"
echo
"Reusing host
${
instance_prefix
}
-
$i
"
hosts
=
"
${
hosts
}${
instance_prefix
}
-
${
i
}
"
hosts
=
"
${
hosts
}${
instance_prefix
}
-
${
i
}
"
else
else
if
[[
$
images
!=
""
]]
;
then
if
[[
$
{
images
}
!=
""
]]
;
then
images
=
"
$
images
,"
images
=
"
$
{
images
}
,"
fi
fi
images
=
"
$
images$i
"
images
=
"
$
{
images
}${
i
}
"
fi
fi
done
done
fi
fi
# Output the configuration we will try to run
# Output the configuration we will try to run
echo
"Running tests remotely using"
echo
"Running tests remotely using"
echo
"Project:
$
project
"
echo
"Project:
$
{
project
}
"
echo
"Image Project:
$
image_project
"
echo
"Image Project:
$
{
image_project
}
"
echo
"Compute/Zone:
$
zone
"
echo
"Compute/Zone:
$
{
zone
}
"
echo
"Images:
$
images
"
echo
"Images:
$
{
images
}
"
echo
"Hosts:
$
hosts
"
echo
"Hosts:
$
{
hosts
}
"
echo
"Ginkgo Flags:
$
ginkgoflags
"
echo
"Ginkgo Flags:
$
{
ginkgoflags
}
"
echo
"Instance Metadata:
$
metadata
"
echo
"Instance Metadata:
$
{
metadata
}
"
echo
"Image Config File:
$
image_config_file
"
echo
"Image Config File:
$
{
image_config_file
}
"
# Invoke the runner
# Invoke the runner
go run
test
/e2e_node/runner/remote/run_remote.go
--logtostderr
--vmodule
=
*
=
4
--ssh-env
=
"gce"
\
go run
test
/e2e_node/runner/remote/run_remote.go
--logtostderr
--vmodule
=
*
=
4
--ssh-env
=
"gce"
\
--zone
=
"
$
zone
"
--project
=
"
$project
"
--gubernator
=
"
$gubernator
"
\
--zone
=
"
$
{
zone
}
"
--project
=
"
${
project
}
"
--gubernator
=
"
${
gubernator
}
"
\
--hosts
=
"
$
hosts
"
--images
=
"
$images
"
--cleanup
=
"
$cleanup
"
\
--hosts
=
"
$
{
hosts
}
"
--images
=
"
${
images
}
"
--cleanup
=
"
${
cleanup
}
"
\
--results-dir
=
"
$
artifacts
"
--ginkgo-flags
=
"
$ginkgoflags
"
\
--results-dir
=
"
$
{
artifacts
}
"
--ginkgo-flags
=
"
${
ginkgoflags
}
"
\
--image-project
=
"
$
image_project
"
--instance-name-prefix
=
"
$instance_prefix
"
\
--image-project
=
"
$
{
image_project
}
"
--instance-name-prefix
=
"
${
instance_prefix
}
"
\
--delete-instances
=
"
$
delete_instances
"
--test_args
=
"
$test_args
"
--instance-metadata
=
"
$metadata
"
\
--delete-instances
=
"
$
{
delete_instances
}
"
--test_args
=
"
${
test_args
}
"
--instance-metadata
=
"
${
metadata
}
"
\
--image-config-file
=
"
$
image_config_file
"
--system-spec-name
=
"
$system_spec_name
"
\
--image-config-file
=
"
$
{
image_config_file
}
"
--system-spec-name
=
"
${
system_spec_name
}
"
\
--test-suite
=
"
$
test_suite
"
\
--test-suite
=
"
$
{
test_suite
}
"
\
2>&1 |
tee
-i
"
${
artifacts
}
/build-log.txt"
2>&1 |
tee
-i
"
${
artifacts
}
/build-log.txt"
exit
$?
exit
$?
...
@@ -161,10 +161,10 @@ else
...
@@ -161,10 +161,10 @@ else
# Do not use any network plugin by default. User could override the flags with
# Do not use any network plugin by default. User could override the flags with
# test_args.
# test_args.
test_args
=
'--kubelet-flags="--network-plugin= --cni-bin-dir=" '
$
test_args
test_args
=
'--kubelet-flags="--network-plugin= --cni-bin-dir=" '
$
{
test_args
}
# Runtime flags
# Runtime flags
test_args
=
'--kubelet-flags="--container-runtime='
$
runtime
'" '
$test_args
test_args
=
'--kubelet-flags="--container-runtime='
$
{
runtime
}
'" '
${
test_args
}
# Test using the host the script was run on
# Test using the host the script was run on
# Provided for backwards compatibility
# Provided for backwards compatibility
...
@@ -172,6 +172,6 @@ else
...
@@ -172,6 +172,6 @@ else
--system-spec-name
=
"
$system_spec_name
"
--ginkgo-flags
=
"
$ginkgoflags
"
\
--system-spec-name
=
"
$system_spec_name
"
--ginkgo-flags
=
"
$ginkgoflags
"
\
--test-flags
=
"--container-runtime=
${
runtime
}
\
--test-flags
=
"--container-runtime=
${
runtime
}
\
--alsologtostderr --v 4 --report-dir=
${
artifacts
}
--node-name
$(
hostname
)
\
--alsologtostderr --v 4 --report-dir=
${
artifacts
}
--node-name
$(
hostname
)
\
$
test_args
"
--build-dependencies
=
true
2>&1 |
tee
-i
"
${
artifacts
}
/build-log.txt"
$
{
test_args
}
"
--build-dependencies
=
true
2>&1 |
tee
-i
"
${
artifacts
}
/build-log.txt"
exit
$?
exit
$?
fi
fi
hack/make-rules/test.sh
View file @
a5d0616b
...
@@ -143,7 +143,7 @@ isnum() {
...
@@ -143,7 +143,7 @@ isnum() {
PARALLEL
=
"
${
PARALLEL
:-
1
}
"
PARALLEL
=
"
${
PARALLEL
:-
1
}
"
while
getopts
"hp:i:"
opt
;
do
while
getopts
"hp:i:"
opt
;
do
case
$
opt
in
case
$
{
opt
}
in
h
)
h
)
kube::test::usage
kube::test::usage
exit
0
exit
0
...
@@ -316,12 +316,12 @@ runTests() {
...
@@ -316,12 +316,12 @@ runTests() {
# vendor/k8s.io/client-go/1.4/rest: causes cover internal errors
# vendor/k8s.io/client-go/1.4/rest: causes cover internal errors
# https://github.com/golang/go/issues/16540
# https://github.com/golang/go/issues/16540
cover_ignore_dirs
=
"vendor/k8s.io/code-generator/cmd/generator|vendor/k8s.io/client-go/1.4/rest"
cover_ignore_dirs
=
"vendor/k8s.io/code-generator/cmd/generator|vendor/k8s.io/client-go/1.4/rest"
for
path
in
$(
echo
$
cover_ignore_dirs
|
sed
's/|/ /g'
)
;
do
for
path
in
$(
echo
$
{
cover_ignore_dirs
}
|
sed
's/|/ /g'
)
;
do
echo
-e
"skipped
\t
k8s.io/kubernetes/
$path
"
echo
-e
"skipped
\t
k8s.io/kubernetes/
$path
"
done
done
printf
"%s
\n
"
"
${
@
}
"
\
printf
"%s
\n
"
"
${
@
}
"
\
|
grep
-Ev
$
cover_ignore_dirs
\
|
grep
-Ev
$
{
cover_ignore_dirs
}
\
| xargs
-I
{}
-n
1
-P
${
KUBE_COVERPROCS
}
\
| xargs
-I
{}
-n
1
-P
${
KUBE_COVERPROCS
}
\
bash
-c
"set -o pipefail; _pkg=
\"\$
0
\"
; _pkg_out=
\$
{_pkg//
\/
/_};
\
bash
-c
"set -o pipefail; _pkg=
\"\$
0
\"
; _pkg_out=
\$
{_pkg//
\/
/_};
\
go test
${
goflags
[@]
:+
${
goflags
[@]
}}
\
go test
${
goflags
[@]
:+
${
goflags
[@]
}}
\
...
@@ -349,7 +349,7 @@ runTests() {
...
@@ -349,7 +349,7 @@ runTests() {
# Include all coverage reach data in the combined profile, but exclude the
# Include all coverage reach data in the combined profile, but exclude the
# 'mode' lines, as there should be only one.
# 'mode' lines, as there should be only one.
for x in
`
find
"
${
cover_report_dir
}
"
-name
"
${
cover_profile
}
"
`
; do
for x in
`
find
"
${
cover_report_dir
}
"
-name
"
${
cover_profile
}
"
`
; do
cat
$
x
| grep -h -v "
^mode:
" || true
cat
$
{
x
}
| grep -h -v "
^mode:
" || true
done
done
} >"
${
COMBINED_COVER_PROFILE
}
"
} >"
${
COMBINED_COVER_PROFILE
}
"
...
@@ -374,8 +374,8 @@ checkFDs() {
...
@@ -374,8 +374,8 @@ checkFDs() {
# several unittests panic when httptest cannot open more sockets
# several unittests panic when httptest cannot open more sockets
# due to the low default files limit on OS X. Warn about low limit.
# due to the low default files limit on OS X. Warn about low limit.
local fileslimit="
$(
ulimit
-n
)
"
local fileslimit="
$(
ulimit
-n
)
"
if [[
$
fileslimit
-lt 1000 ]]; then
if [[
$
{
fileslimit
}
-lt 1000 ]]; then
echo "
WARNING:
ulimit
-n
(
files
)
should be at least 1000, is
$
fileslimit
, may cause
test
failure
";
echo "
WARNING:
ulimit
-n
(
files
)
should be at least 1000, is
$
{
fileslimit
}
, may cause
test
failure
";
fi
fi
}
}
...
@@ -387,7 +387,7 @@ IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
...
@@ -387,7 +387,7 @@ IFS=';' read -a apiVersions <<< "${KUBE_TEST_API_VERSIONS}"
apiVersionsCount=
${#
apiVersions
[@]
}
apiVersionsCount=
${#
apiVersions
[@]
}
for (( i=0; i<
${
apiVersionsCount
}
; i++ )); do
for (( i=0; i<
${
apiVersionsCount
}
; i++ )); do
apiVersion=
${
apiVersions
[i]
}
apiVersion=
${
apiVersions
[i]
}
echo "
Running tests
for
APIVersion:
$
apiVersion
"
echo "
Running tests
for
APIVersion:
$
{
apiVersion
}
"
# KUBE_TEST_API sets the version of each group to be tested.
# KUBE_TEST_API sets the version of each group to be tested.
KUBE_TEST_API="
${
apiVersion
}
" runTests "
$@
"
KUBE_TEST_API="
${
apiVersion
}
" runTests "
$@
"
done
done
...
...
hack/update-gofmt.sh
View file @
a5d0616b
...
@@ -44,4 +44,4 @@ find_files() {
...
@@ -44,4 +44,4 @@ find_files() {
}
}
GOFMT
=
"gofmt -s -w"
GOFMT
=
"gofmt -s -w"
find_files | xargs
$
GOFMT
find_files | xargs
$
{
GOFMT
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment