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
d5c6499d
Commit
d5c6499d
authored
Nov 07, 2014
by
Daniel Smith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update scripts to expect versioned output in templates.
parent
b8aa87ed
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
21 additions
and
21 deletions
+21
-21
util.sh
cluster/vagrant/util.sh
+1
-1
validate-cluster.sh
cluster/validate-cluster.sh
+1
-1
basic.sh
hack/e2e-suite/basic.sh
+3
-3
guestbook.sh
hack/e2e-suite/guestbook.sh
+2
-2
services.sh
hack/e2e-suite/services.sh
+6
-6
update.sh
hack/e2e-suite/update.sh
+5
-5
test-cmd.sh
hack/test-cmd.sh
+3
-3
No files found.
cluster/vagrant/util.sh
View file @
d5c6499d
...
...
@@ -92,7 +92,7 @@ function kube-up {
local
count
=
"0"
until
[[
"
$count
"
==
"1"
]]
;
do
local
minions
minions
=
$(
"
${
KUBE_ROOT
}
/cluster/kubecfg.sh"
-template
'{{range.
Items}}{{.Name
}}:{{end}}'
list minions
)
minions
=
$(
"
${
KUBE_ROOT
}
/cluster/kubecfg.sh"
-template
'{{range.
items}}{{.id
}}:{{end}}'
list minions
)
count
=
$(
echo
$minions
|
grep
-c
"
${
MINION_NAMES
[i]
}
"
)
||
{
printf
"."
sleep
2
...
...
cluster/validate-cluster.sh
View file @
d5c6499d
...
...
@@ -33,7 +33,7 @@ detect-master > /dev/null
detect-minions
>
/dev/null
MINIONS_FILE
=
/tmp/minions
"
${
KUBE_ROOT
}
/cluster/kubecfg.sh"
-template
$'{{range.
Items}}{{.Name
}}
\n
{{end}}'
list minions
>
${
MINIONS_FILE
}
"
${
KUBE_ROOT
}
/cluster/kubecfg.sh"
-template
$'{{range.
items}}{{.id
}}
\n
{{end}}'
list minions
>
${
MINIONS_FILE
}
# On vSphere, use minion IPs as their names
if
[[
"
${
KUBERNETES_PROVIDER
}
"
==
"vsphere"
]]
;
then
...
...
hack/e2e-suite/basic.sh
View file @
d5c6499d
...
...
@@ -37,7 +37,7 @@ function teardown() {
trap
"teardown"
EXIT
pod_id_list
=
$(
$KUBECFG
'-template={{range.
Items}}{{.Name
}} {{end}}'
-l
replicationController
=
my-hostname list pods
)
pod_id_list
=
$(
$KUBECFG
'-template={{range.
items}}{{.id
}} {{end}}'
-l
replicationController
=
my-hostname list pods
)
# Pod turn up on a clean cluster can take a while for the docker image pull.
all_running
=
0
for
i
in
$(
seq
1 24
)
;
do
...
...
@@ -45,7 +45,7 @@ for i in $(seq 1 24); do
sleep
5
all_running
=
1
for
id
in
$pod_id_list
;
do
current_status
=
$(
$KUBECFG
-template
'{{.
CurrentState.S
tatus}}'
get pods/
$id
)
||
true
current_status
=
$(
$KUBECFG
-template
'{{.
currentState.s
tatus}}'
get pods/
$id
)
||
true
if
[[
"
$current_status
"
!=
"Running"
]]
;
then
all_running
=
0
break
...
...
@@ -69,7 +69,7 @@ sleep 5
# Verify that something is listening.
for
id
in
${
pod_id_list
}
;
do
ip
=
$(
$KUBECFG
-template
'{{.
CurrentState.H
ostIP}}'
get pods/
$id
)
ip
=
$(
$KUBECFG
-template
'{{.
currentState.h
ostIP}}'
get pods/
$id
)
echo
"Trying to reach server that should be running at
${
ip
}
:8080..."
ok
=
0
for
i
in
$(
seq
1 5
)
;
do
...
...
hack/e2e-suite/guestbook.sh
View file @
d5c6499d
...
...
@@ -35,7 +35,7 @@ $KUBECFG -c "${GUESTBOOK}/redis-slave-controller.json" create /replicationContro
sleep
5
POD_LIST_1
=
$(
$KUBECFG
'-template={{range.
Items}}{{.Name
}} {{end}}'
list pods
)
POD_LIST_1
=
$(
$KUBECFG
'-template={{range.
items}}{{.id
}} {{end}}'
list pods
)
echo
"Pods running:
${
POD_LIST_1
}
"
$KUBECFG
stop redisSlaveController
...
...
@@ -45,7 +45,7 @@ $KUBECFG rm redisSlaveController
$KUBECFG
delete services/redismaster
$KUBECFG
delete pods/redis-master-2
POD_LIST_2
=
$(
$KUBECFG
'-template={{range.
Items}}{{.Name
}} {{end}}'
list pods
)
POD_LIST_2
=
$(
$KUBECFG
'-template={{range.
items}}{{.id
}} {{end}}'
list pods
)
echo
"Pods running after shutdown:
${
POD_LIST_2
}
"
exit
0
hack/e2e-suite/services.sh
View file @
d5c6499d
...
...
@@ -69,7 +69,7 @@ function query_pods() {
local
i
for
i
in
$(
seq
1 10
)
;
do
pods_unsorted
=(
$(${
KUBECFG
}
\
'-template={{range.
Items}}{{.Name
}} {{end}}'
\
'-template={{range.
items}}{{.id
}} {{end}}'
\
-l
name
=
"
$1
"
list pods
)
)
found
=
"
${#
pods_unsorted
[*]
}
"
if
[[
"
${
found
}
"
==
"
$2
"
]]
;
then
...
...
@@ -103,7 +103,7 @@ function wait_for_pods() {
echo
"Waiting for
${
pods_needed
}
pods to become 'running'"
pods_needed
=
"
$2
"
for
id
in
${
pods_sorted
}
;
do
status
=
$(${
KUBECFG
}
-template
'{{.
CurrentState.S
tatus}}'
get
"pods/
${
id
}
"
)
status
=
$(${
KUBECFG
}
-template
'{{.
currentState.s
tatus}}'
get
"pods/
${
id
}
"
)
if
[[
"
${
status
}
"
==
"Running"
]]
;
then
pods_needed
=
$((
pods_needed-1
))
fi
...
...
@@ -213,9 +213,9 @@ svc1_pods=$(query_pods "${svc1_name}" "${svc1_count}")
svc2_pods
=
$(
query_pods
"
${
svc2_name
}
"
"
${
svc2_count
}
"
)
# Get the portal IPs.
svc1_ip
=
$(${
KUBECFG
}
-template
'{{.
P
ortalIP}}'
get
"services/
${
svc1_name
}
"
)
svc1_ip
=
$(${
KUBECFG
}
-template
'{{.
p
ortalIP}}'
get
"services/
${
svc1_name
}
"
)
test
-n
"
${
svc1_ip
}
"
||
error
"Service1 IP is blank"
svc2_ip
=
$(${
KUBECFG
}
-template
'{{.
P
ortalIP}}'
get
"services/
${
svc2_name
}
"
)
svc2_ip
=
$(${
KUBECFG
}
-template
'{{.
p
ortalIP}}'
get
"services/
${
svc2_name
}
"
)
test
-n
"
${
svc2_ip
}
"
||
error
"Service2 IP is blank"
if
[[
"
${
svc1_ip
}
"
==
"
${
svc2_ip
}
"
]]
;
then
error
"Portal IPs conflict:
${
svc1_ip
}
"
...
...
@@ -272,7 +272,7 @@ wait_for_pods "${svc3_name}" "${svc3_count}"
svc3_pods
=
$(
query_pods
"
${
svc3_name
}
"
"
${
svc3_count
}
"
)
# Get the portal IP.
svc3_ip
=
$(${
KUBECFG
}
-template
'{{.
P
ortalIP}}'
get
"services/
${
svc3_name
}
"
)
svc3_ip
=
$(${
KUBECFG
}
-template
'{{.
p
ortalIP}}'
get
"services/
${
svc3_name
}
"
)
test
-n
"
${
svc3_ip
}
"
||
error
"Service3 IP is blank"
if
[[
"
${
svc3_ip
}
"
!=
"
${
svc1_ip
}
"
]]
;
then
error
"Portal IPs not resued:
${
svc3_ip
}
!=
${
svc1_ip
}
"
...
...
@@ -325,7 +325,7 @@ wait_for_pods "${svc4_name}" "${svc4_count}"
svc4_pods
=
$(
query_pods
"
${
svc4_name
}
"
"
${
svc4_count
}
"
)
# Get the portal IP.
svc4_ip
=
$(${
KUBECFG
}
-template
'{{.
P
ortalIP}}'
get
"services/
${
svc4_name
}
"
)
svc4_ip
=
$(${
KUBECFG
}
-template
'{{.
p
ortalIP}}'
get
"services/
${
svc4_name
}
"
)
test
-n
"
${
svc4_ip
}
"
||
error
"Service4 IP is blank"
if
[[
"
${
svc4_ip
}
"
==
"
${
svc2_ip
}
"
||
"
${
svc4_ip
}
"
==
"
${
svc3_ip
}
"
]]
;
then
error
"Portal IPs conflict:
${
svc4_ip
}
"
...
...
hack/e2e-suite/update.sh
View file @
d5c6499d
...
...
@@ -38,7 +38,7 @@ function validate() {
sleep
2
local
pod_id_list
pod_id_list
=(
$(
$KUBECFG
-template
=
'{{range.
Items}}{{.Name
}} {{end}}'
-l
name
=
"
${
CONTROLLER_NAME
}
"
list pods
)
)
pod_id_list
=(
$(
$KUBECFG
-template
=
'{{range.
items}}{{.id
}} {{end}}'
-l
name
=
"
${
CONTROLLER_NAME
}
"
list pods
)
)
echo
"
${#
pod_id_list
[@]
}
out of
${
num_replicas
}
created"
...
...
@@ -61,7 +61,7 @@ function validate() {
# currently always set to a zero time.
#
# You can read about the syntax here: http://golang.org/pkg/text/template/
template_string
=
"{{and ((index .
CurrentState.Info
\"
${
CONTROLLER_NAME
}
\"
).State.Running) .CurrentState.Info.net.State.Running
}}"
template_string
=
"{{and ((index .
currentState.info
\"
${
CONTROLLER_NAME
}
\"
).state.running.startedAt) .currentState.info.net.state.running.startedAt
}}"
current_status
=
$(
$KUBECFG
-template
=
"
${
template_string
}
"
get
"pods/
$id
"
)
||
{
if
[[
$current_status
=
~
"pod
\"
${
id
}
\"
not found"
]]
;
then
echo
"
$id
no longer exists"
...
...
@@ -73,12 +73,12 @@ function validate() {
fi
}
if
[[
"
$current_status
"
!=
"
{0001-01-01 00:00:00 +0000 UTC}
"
]]
;
then
if
[[
"
$current_status
"
!=
"
0001-01-01T00:00:00Z
"
]]
;
then
echo
"
$id
is created but not running"
continue
fi
template_string
=
"{{(index .
CurrentState.Info
\"
${
CONTROLLER_NAME
}
\"
).I
mage}}"
template_string
=
"{{(index .
currentState.info
\"
${
CONTROLLER_NAME
}
\"
).i
mage}}"
current_image
=
$(
$KUBECFG
-template
=
"
${
template_string
}
"
get
"pods/
$id
"
)
if
[[
"
$current_image
"
!=
"
${
DOCKER_HUB_USER
}
/update-demo:
${
container_image_version
}
"
]]
;
then
echo
"
${
id
}
is created but running wrong image"
...
...
@@ -86,7 +86,7 @@ function validate() {
fi
host_ip
=
$(
$KUBECFG
-template
=
'{{.
CurrentState.H
ostIP}}'
get pods/
$id
)
host_ip
=
$(
$KUBECFG
-template
=
'{{.
currentState.h
ostIP}}'
get pods/
$id
)
curl
-s
--max-time
5
--fail
http://
${
host_ip
}
:8080/data.json
\
|
grep
-q
${
container_image_version
}
||
{
echo
"
${
id
}
is running the right image but curl to contents failed or returned wrong info"
...
...
hack/test-cmd.sh
View file @
d5c6499d
...
...
@@ -100,12 +100,12 @@ kube::log::status "Testing kubectl(pods)"
"
${
kube_cmd
[@]
}
"
create
-f
examples/guestbook/redis-master.json
"
${
kube_flags
[@]
}
"
"
${
kube_cmd
[@]
}
"
get pods
"
${
kube_flags
[@]
}
"
"
${
kube_cmd
[@]
}
"
get pod redis-master-2
"
${
kube_flags
[@]
}
"
[[
"
$(
"
${
kube_cmd
[@]
}
"
get pod redis-master-2
-o
template
--output-version
=
v1beta1
-t
'{{ .
ID
}}'
"
${
kube_flags
[@]
}
"
)
"
==
"redis-master-2"
]]
[[
"
$(
"
${
kube_cmd
[@]
}
"
get pod redis-master-2
-o
template
--output-version
=
v1beta1
-t
'{{ .
id
}}'
"
${
kube_flags
[@]
}
"
)
"
==
"redis-master-2"
]]
output_pod
=
$(
"
${
kube_cmd
[@]
}
"
get pod redis-master-2
-o
json
--output-version
=
v1beta1
"
${
kube_flags
[@]
}
"
)
"
${
kube_cmd
[@]
}
"
delete pod redis-master-2
"
${
kube_flags
[@]
}
"
[[
$(
"
${
kube_cmd
[@]
}
"
get pods
-o
template
-t
'{{ len .
I
tems }}'
"
${
kube_flags
[@]
}
"
)
-eq
0
]]
[[
$(
"
${
kube_cmd
[@]
}
"
get pods
-o
template
-t
'{{ len .
i
tems }}'
"
${
kube_flags
[@]
}
"
)
-eq
0
]]
echo
$output_pod
|
"
${
kube_cmd
[@]
}
"
create
-f
-
"
${
kube_flags
[@]
}
"
[[
$(
"
${
kube_cmd
[@]
}
"
get pods
-o
template
-t
'{{ len .
I
tems }}'
"
${
kube_flags
[@]
}
"
)
-eq
1
]]
[[
$(
"
${
kube_cmd
[@]
}
"
get pods
-o
template
-t
'{{ len .
i
tems }}'
"
${
kube_flags
[@]
}
"
)
-eq
1
]]
"
${
kube_cmd
[@]
}
"
get pods
-o
yaml
"
${
kube_flags
[@]
}
"
|
grep
-q
"id: redis-master-2"
"
${
kube_cmd
[@]
}
"
describe pod redis-master-2
"
${
kube_flags
[@]
}
"
|
grep
-q
'Name:.*redis-master-2'
"
${
kube_cmd
[@]
}
"
delete
-f
examples/guestbook/redis-master.json
"
${
kube_flags
[@]
}
"
...
...
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