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
9b437f95
Unverified
Commit
9b437f95
authored
Apr 29, 2019
by
Kubernetes Prow Robot
Committed by
GitHub
Apr 29, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #76909 from Huang-Wei/fix-iks-kubemark
kubemark: fix and enhance kubemark scripts for IKS
parents
74a70262
fbec01dc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
47 additions
and
34 deletions
+47
-34
config-default.sh
cluster/kubemark/iks/config-default.sh
+8
-0
startup.sh
test/kubemark/iks/startup.sh
+5
-5
util.sh
test/kubemark/iks/util.sh
+34
-29
No files found.
cluster/kubemark/iks/config-default.sh
View file @
9b437f95
...
@@ -25,8 +25,16 @@ CLUSTER_LOCATION="${CLUSTER_LOCATION:-wdc06}"
...
@@ -25,8 +25,16 @@ CLUSTER_LOCATION="${CLUSTER_LOCATION:-wdc06}"
REGISTRY_LOGIN_URL
=
"
${
REGISTRY_LOGIN_URL
:-
https
://api.ng.bluemix.net
}
"
REGISTRY_LOGIN_URL
=
"
${
REGISTRY_LOGIN_URL
:-
https
://api.ng.bluemix.net
}
"
# User defined
# User defined
# number of real workers in spawnTester cluster
NUM_NODES
=
"
${
NUM_NODES
:-
2
}
"
NUM_NODES
=
"
${
NUM_NODES
:-
2
}
"
# spec of real workers in spawnTester cluster
NODE_SIZE
=
${
NODE_SIZE
:-
u2c
.2x4
}
DESIRED_NODES
=
"
${
DESIRED_NODES
:-
10
}
"
DESIRED_NODES
=
"
${
DESIRED_NODES
:-
10
}
"
# number of hollow nodes
# TODO: once IKS supports `kubetest`, i.e. the base cluster provisioning implemented in `kubetest`
# we can use NUM_NODES=${KUBEMARK_NUM_NODES:-10} to avoid usage of KUBEMARK_NUM_NODES
# more context, see https://github.com/kubernetes/kubernetes/pull/76909#discussion_r277735942
KUBEMARK_NUM_NODES
=
"
${
KUBEMARK_NUM_NODES
:-
10
}
"
ENABLE_KUBEMARK_CLUSTER_AUTOSCALER
=
"
${
ENABLE_KUBEMARK_CLUSTER_AUTOSCALER
:-
true
}
"
ENABLE_KUBEMARK_CLUSTER_AUTOSCALER
=
"
${
ENABLE_KUBEMARK_CLUSTER_AUTOSCALER
:-
true
}
"
ENABLE_KUBEMARK_KUBE_DNS
=
"
${
ENABLE_KUBEMARK_KUBE_DNS
:-
false
}
"
ENABLE_KUBEMARK_KUBE_DNS
=
"
${
ENABLE_KUBEMARK_KUBE_DNS
:-
false
}
"
KUBELET_TEST_LOG_LEVEL
=
"
${
KUBELET_TEST_LOG_LEVEL
:-
"--v=2"
}
"
KUBELET_TEST_LOG_LEVEL
=
"
${
KUBELET_TEST_LOG_LEVEL
:-
"--v=2"
}
"
...
...
test/kubemark/iks/startup.sh
View file @
9b437f95
...
@@ -227,7 +227,7 @@ EOF
...
@@ -227,7 +227,7 @@ EOF
# Create the replication controller for hollow-nodes.
# Create the replication controller for hollow-nodes.
# We allow to override the NUM_REPLICAS when running Cluster Autoscaler.
# We allow to override the NUM_REPLICAS when running Cluster Autoscaler.
NUM_REPLICAS
=
${
NUM_REPLICAS
:-${
NUM_NODES
}}
NUM_REPLICAS
=
${
NUM_REPLICAS
:-${
KUBEMARK_
NUM_NODES
}}
sed
"s/{{numreplicas}}/
${
NUM_REPLICAS
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node_template.yaml"
>
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
"s/{{numreplicas}}/
${
NUM_REPLICAS
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node_template.yaml"
>
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
proxy_cpu
=
20
proxy_cpu
=
20
if
[
"
${
NUM_NODES
}
"
-gt
1000
]
;
then
if
[
"
${
NUM_NODES
}
"
-gt
1000
]
;
then
...
@@ -240,9 +240,8 @@ EOF
...
@@ -240,9 +240,8 @@ EOF
sed
-i
''
-e
"s'{{kubemark_image_registry}}'
${
KUBEMARK_IMAGE_REGISTRY
}${
KUBE_NAMESPACE
}
'g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s'{{kubemark_image_registry}}'
${
KUBEMARK_IMAGE_REGISTRY
}${
KUBE_NAMESPACE
}
'g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{kubemark_image_tag}}/
${
KUBEMARK_IMAGE_TAG
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{kubemark_image_tag}}/
${
KUBEMARK_IMAGE_TAG
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{master_ip}}/
${
MASTER_IP
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{master_ip}}/
${
MASTER_IP
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{kubelet_verbosity_level}}/
${
KUBELET_TEST_LOG_LEVEL
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{hollow_kubelet_params}}/
${
HOLLOW_KUBELET_TEST_ARGS
:-}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{kubeproxy_verbosity_level}}/
${
KUBEPROXY_TEST_LOG_LEVEL
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{hollow_proxy_params}}/
${
HOLLOW_PROXY_TEST_ARGS
:-}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s/{{use_real_proxier}}/
${
USE_REAL_PROXIER
}
/g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s'{{kubemark_mig_config}}'
${
KUBEMARK_MIG_CONFIG
:-}
'g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
sed
-i
''
-e
"s'{{kubemark_mig_config}}'
${
KUBEMARK_MIG_CONFIG
:-}
'g"
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
"
${
KUBECTL
}
"
create
-f
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
--namespace
=
"kubemark"
"
${
KUBECTL
}
"
create
-f
"
${
RESOURCE_DIRECTORY
}
/hollow-node.yaml"
--namespace
=
"kubemark"
...
@@ -253,7 +252,8 @@ EOF
...
@@ -253,7 +252,8 @@ EOF
function
wait-for-hollow-nodes-to-run-or-timeout
{
function
wait-for-hollow-nodes-to-run-or-timeout
{
echo
-n
"Waiting for all hollow-nodes to become Running"
echo
-n
"Waiting for all hollow-nodes to become Running"
start
=
$(
date
+%s
)
start
=
$(
date
+%s
)
nodes
=
$(
"
${
KUBECTL
}
"
--kubeconfig
=
"
${
KUBECONFIG
}
"
get node 2> /dev/null
)
||
true
# IKS uses a real cluster for hollow master, so need to exclude the real worker nodes
nodes
=
$(
"
${
KUBECTL
}
"
--kubeconfig
=
"
${
KUBECONFIG
}
"
get node |
grep
hollow-node 2> /dev/null
)
||
true
ready
=
$(($(
echo
"
${
nodes
}
"
|
grep
-vc
"NotReady"
)
-
1
))
ready
=
$(($(
echo
"
${
nodes
}
"
|
grep
-vc
"NotReady"
)
-
1
))
until
[[
"
${
ready
}
"
-ge
"
${
NUM_REPLICAS
}
"
]]
;
do
until
[[
"
${
ready
}
"
-ge
"
${
NUM_REPLICAS
}
"
]]
;
do
echo
-n
"."
echo
-n
"."
...
...
test/kubemark/iks/util.sh
View file @
9b437f95
...
@@ -20,39 +20,44 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../..
...
@@ -20,39 +20,44 @@ KUBE_ROOT=$(dirname "${BASH_SOURCE[0]}")/../../..
function
create-clusters
{
function
create-clusters
{
# shellcheck disable=SC2154 # Color defined in sourced script
# shellcheck disable=SC2154 # Color defined in sourced script
echo
-e
"
${
color_yellow
}
CHECKING CLUSTERS
${
color_norm
}
"
echo
-e
"
${
color_yellow
}
CHECKING CLUSTERS
${
color_norm
}
"
if
bx c
s clusters |
grep
-Fq
'deleting'
;
then
if
ibmcloud k
s clusters |
grep
-Fq
'deleting'
;
then
echo
-n
"Deleting old clusters"
echo
-n
"Deleting old clusters"
fi
fi
while
bx c
s clusters |
grep
-Fq
'deleting'
while
ibmcloud k
s clusters |
grep
-Fq
'deleting'
do
do
echo
-n
"."
echo
-n
"."
sleep
10
sleep
10
done
done
echo
""
echo
""
bx c
s region-set us-east
>
/dev/null
ibmcloud k
s region-set us-east
>
/dev/null
bx c
s vlans wdc06
>
/dev/null
ibmcloud k
s vlans wdc06
>
/dev/null
PRIVLAN
=
$(
bx c
s vlans wdc06
--json
| jq
'. | .[] | select(.type == "private") | .id'
|
sed
-e
"s/
\"
//g"
)
PRIVLAN
=
$(
ibmcloud k
s vlans wdc06
--json
| jq
'. | .[] | select(.type == "private") | .id'
|
sed
-e
"s/
\"
//g"
)
PUBVLAN
=
$(
bx c
s vlans wdc06
--json
| jq
'. | .[] | select(.type == "public") | .id'
|
sed
-e
"s/
\"
//g"
)
PUBVLAN
=
$(
ibmcloud k
s vlans wdc06
--json
| jq
'. | .[] | select(.type == "public") | .id'
|
sed
-e
"s/
\"
//g"
)
if
!
bx c
s clusters |
grep
-Fq
'kubeSpawnTester'
;
then
if
!
ibmcloud k
s clusters |
grep
-Fq
'kubeSpawnTester'
;
then
echo
"Creating spawning cluster"
echo
"Creating spawning cluster"
bx cs cluster-create
--location
"
${
CLUSTER_LOCATION
}
"
--public-vlan
"
${
PUBVLAN
}
"
--private-vlan
"
${
PRIVLAN
}
"
--workers
2
--machine-type
u2c.2x4
--name
kubeSpawnTester
# make number and spec of node workers configurable
# otherwise it can't afford tests like kubemark-5000
# TODO: dynamically adjust the number and spec
ibmcloud ks cluster-create
--location
"
${
CLUSTER_LOCATION
}
"
--public-vlan
"
${
PUBVLAN
}
"
--private-vlan
"
${
PRIVLAN
}
"
--workers
"
${
NUM_NODES
:-
2
}
"
--machine-type
"
${
NODE_SIZE
}
"
--name
kubeSpawnTester
fi
fi
if
!
bx c
s clusters |
grep
-Fq
'kubeMasterTester'
;
then
if
!
ibmcloud k
s clusters |
grep
-Fq
'kubeMasterTester'
;
then
echo
"Creating master cluster"
echo
"Creating master cluster"
bx cs cluster-create
--location
"
${
CLUSTER_LOCATION
}
"
--public-vlan
"
${
PUBVLAN
}
"
--private-vlan
"
${
PRIVLAN
}
"
--workers
2
--machine-type
u2c.2x4
--name
kubeMasterTester
# if we can't make it a bare master (workers = 0)
# then make workers = 1 with the smallest machine spec
ibmcloud ks cluster-create
--location
"
${
CLUSTER_LOCATION
}
"
--public-vlan
"
${
PUBVLAN
}
"
--private-vlan
"
${
PRIVLAN
}
"
--workers
1
--machine-type
u2c.2x4
--name
kubeMasterTester
fi
fi
push-image
push-image
if
!
bx c
s clusters |
grep
'kubeSpawnTester'
|
grep
-Fq
'normal'
;
then
if
!
ibmcloud k
s clusters |
grep
'kubeSpawnTester'
|
grep
-Fq
'normal'
;
then
# shellcheck disable=SC2154 # Color defined in sourced script
# shellcheck disable=SC2154 # Color defined in sourced script
echo
-e
"
${
color_cyan
}
Warning: new clusters may take up to 60 minutes to be ready
${
color_norm
}
"
echo
-e
"
${
color_cyan
}
Warning: new clusters may take up to 60 minutes to be ready
${
color_norm
}
"
echo
-n
"Clusters loading"
echo
-n
"Clusters loading"
fi
fi
while
!
bx c
s clusters |
grep
'kubeSpawnTester'
|
grep
-Fq
'normal'
while
!
ibmcloud k
s clusters |
grep
'kubeSpawnTester'
|
grep
-Fq
'normal'
do
do
echo
-n
"."
echo
-n
"."
sleep
5
sleep
5
done
done
while
!
bx c
s clusters |
grep
'kubeMasterTester'
|
grep
-Fq
'normal'
while
!
ibmcloud k
s clusters |
grep
'kubeMasterTester'
|
grep
-Fq
'normal'
do
do
echo
-n
"."
echo
-n
"."
sleep
5
sleep
5
...
@@ -63,17 +68,17 @@ function create-clusters {
...
@@ -63,17 +68,17 @@ function create-clusters {
# Builds and pushes image to registry
# Builds and pushes image to registry
function
push-image
{
function
push-image
{
if
[[
"
${
ISBUILD
}
"
=
"y"
]]
;
then
if
[[
"
${
ISBUILD
}
"
=
"y"
]]
;
then
if
!
bx
cr namespaces |
grep
-Fq
"
${
KUBE_NAMESPACE
}
"
;
then
if
!
ibmcloud
cr namespaces |
grep
-Fq
"
${
KUBE_NAMESPACE
}
"
;
then
echo
"Creating registry namespace"
echo
"Creating registry namespace"
bx
cr namespace-add
"
${
KUBE_NAMESPACE
}
"
ibmcloud
cr namespace-add
"
${
KUBE_NAMESPACE
}
"
echo
"
bx
cr namespace-rm
${
KUBE_NAMESPACE
}
"
>>
"
${
RESOURCE_DIRECTORY
}
/iks-namespacelist.sh"
echo
"
ibmcloud
cr namespace-rm
${
KUBE_NAMESPACE
}
"
>>
"
${
RESOURCE_DIRECTORY
}
/iks-namespacelist.sh"
fi
fi
docker build
-t
"
${
KUBEMARK_INIT_TAG
}
"
"
${
KUBEMARK_IMAGE_LOCATION
}
"
docker build
-t
"
${
KUBEMARK_INIT_TAG
}
"
"
${
KUBEMARK_IMAGE_LOCATION
}
"
docker tag
"
${
KUBEMARK_INIT_TAG
}
"
"
${
KUBEMARK_IMAGE_REGISTRY
}${
KUBE_NAMESPACE
}
/
${
PROJECT
}
:
${
KUBEMARK_IMAGE_TAG
}
"
docker tag
"
${
KUBEMARK_INIT_TAG
}
"
"
${
KUBEMARK_IMAGE_REGISTRY
}${
KUBE_NAMESPACE
}
/
${
PROJECT
}
:
${
KUBEMARK_IMAGE_TAG
}
"
docker push
"
${
KUBEMARK_IMAGE_REGISTRY
}${
KUBE_NAMESPACE
}
/
${
PROJECT
}
:
${
KUBEMARK_IMAGE_TAG
}
"
docker push
"
${
KUBEMARK_IMAGE_REGISTRY
}${
KUBE_NAMESPACE
}
/
${
PROJECT
}
:
${
KUBEMARK_IMAGE_TAG
}
"
echo
"Image pushed"
echo
"Image pushed"
else
else
KUBEMARK_IMAGE_REGISTRY
=
"
brandondr96
"
KUBEMARK_IMAGE_REGISTRY
=
"
${
KUBEMARK_IMAGE_REGISTRY
:-
brandondr96
}
"
KUBE_NAMESPACE
=
""
KUBE_NAMESPACE
=
""
fi
fi
}
}
...
@@ -122,7 +127,7 @@ function master-config {
...
@@ -122,7 +127,7 @@ function master-config {
if
[[
"
${
USE_EXISTING
}
"
=
"y"
]]
;
then
if
[[
"
${
USE_EXISTING
}
"
=
"y"
]]
;
then
export
KUBECONFIG
=
${
CUSTOM_MASTER_CONFIG
}
export
KUBECONFIG
=
${
CUSTOM_MASTER_CONFIG
}
else
else
eval
"
$(
bx c
s cluster-config kubeMasterTester
--admin
|
grep export
)
"
eval
"
$(
ibmcloud k
s cluster-config kubeMasterTester
--admin
|
grep export
)
"
fi
fi
}
}
...
@@ -133,20 +138,20 @@ function spawn-config {
...
@@ -133,20 +138,20 @@ function spawn-config {
if
[[
"
${
USE_EXISTING
}
"
=
"y"
]]
;
then
if
[[
"
${
USE_EXISTING
}
"
=
"y"
]]
;
then
export
KUBECONFIG
=
${
CUSTOM_SPAWN_CONFIG
}
export
KUBECONFIG
=
${
CUSTOM_SPAWN_CONFIG
}
else
else
eval
"
$(
bx c
s cluster-config kubeSpawnTester
--admin
|
grep export
)
"
eval
"
$(
ibmcloud k
s cluster-config kubeSpawnTester
--admin
|
grep export
)
"
fi
fi
}
}
# Deletes existing clusters
# Deletes existing clusters
function
delete-clusters
{
function
delete-clusters
{
echo
"DELETING CLUSTERS"
echo
"DELETING CLUSTERS"
bx c
s cluster-rm kubeSpawnTester
ibmcloud k
s cluster-rm kubeSpawnTester
bx c
s cluster-rm kubeMasterTester
ibmcloud k
s cluster-rm kubeMasterTester
while
!
bx c
s clusters |
grep
'kubeSpawnTester'
|
grep
-Fq
'deleting'
while
!
ibmcloud k
s clusters |
grep
'kubeSpawnTester'
|
grep
-Fq
'deleting'
do
do
sleep
5
sleep
5
done
done
while
!
bx c
s clusters |
grep
'kubeMasterTester'
|
grep
-Fq
'deleting'
while
!
ibmcloud k
s clusters |
grep
'kubeMasterTester'
|
grep
-Fq
'deleting'
do
do
sleep
5
sleep
5
done
done
...
@@ -159,14 +164,14 @@ function complete-login {
...
@@ -159,14 +164,14 @@ function complete-login {
echo
-n
-e
"Do you have a federated IBM cloud login? [y/N]
${
color_cyan
}
>
${
color_norm
}
"
echo
-n
-e
"Do you have a federated IBM cloud login? [y/N]
${
color_cyan
}
>
${
color_norm
}
"
read
-r
ISFED
read
-r
ISFED
if
[[
"
${
ISFED
}
"
=
"y"
]]
;
then
if
[[
"
${
ISFED
}
"
=
"y"
]]
;
then
bx
login
--sso
-a
"
${
REGISTRY_LOGIN_URL
}
"
ibmcloud
login
--sso
-a
"
${
REGISTRY_LOGIN_URL
}
"
elif
[[
"
${
ISFED
}
"
=
"N"
]]
;
then
elif
[[
"
${
ISFED
}
"
=
"N"
]]
;
then
bx
login
-a
"
${
REGISTRY_LOGIN_URL
}
"
ibmcloud
login
-a
"
${
REGISTRY_LOGIN_URL
}
"
else
else
echo
-e
"
${
color_red
}
Invalid response, please try again:
${
color_norm
}
"
echo
-e
"
${
color_red
}
Invalid response, please try again:
${
color_norm
}
"
complete-login
complete-login
fi
fi
bx
cr login
ibmcloud
cr login
}
}
# Generate values to fill the hollow-node configuration templates.
# Generate values to fill the hollow-node configuration templates.
...
...
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