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
29da889b
Commit
29da889b
authored
Aug 12, 2015
by
Eric Tune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add generic master detector; simplify conformance.
Add detect-master-from-kubeconfig bash function. Use it to no longer require conformance test user to specify KUBE_MASTER_IP.
parent
ed36bfa8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
32 additions
and
5 deletions
+32
-5
common.sh
cluster/common.sh
+26
-0
conformance-test.sh
hack/conformance-test.sh
+1
-4
ginkgo-e2e.sh
hack/ginkgo-e2e.sh
+5
-1
No files found.
cluster/common.sh
View file @
29da889b
...
@@ -171,6 +171,32 @@ function get-kubeconfig-bearertoken() {
...
@@ -171,6 +171,32 @@ function get-kubeconfig-bearertoken() {
fi
fi
}
}
# Get the master IP for the current-context in kubeconfig if one exists.
#
# Assumed vars:
# KUBECONFIG # if unset, defaults to global
#
# Vars set:
# KUBE_MASTER_URL
#
# KUBE_MASTER_URL will be empty if no current-context is set, or the
# current-context user does not exist or contain a server entry.
function
detect-master-from-kubeconfig
()
{
export
KUBECONFIG
=
${
KUBECONFIG
:-
$DEFAULT_KUBECONFIG
}
# Template to safely extract the server for the current-context cluster.
# The long chain of 'with' commands avoids indexing nil if any of the
# entries ("current-context", "contexts"."current-context", "users", etc)
# is missing.
# Note: we save dot ('.') to $root because the 'with' action overrides it.
# See http://golang.org/pkg/text/template/.
local
server_tpl
=
'{{$dot := .}}{{with $ctx := index $dot "current-context"}}{{range $element := (index $dot "contexts")}}{{ if eq .name $ctx }}{{ with $cluster := .context.cluster }}{{range $element := (index $dot "clusters")}}{{ if eq .name $cluster }}{{ index . "cluster" "server" }}{{end}}{{end}}{{end}}{{end}}{{end}}{{end}}'
KUBE_MASTER_URL
=
$(
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
config view
-o
template
--template
=
"
${
server_tpl
}
"
)
# Handle empty/missing server
if
[[
"
${
KUBE_MASTER_URL
}
"
==
'<no value>'
]]
;
then
KUBE_MASTER_URL
=
''
fi
}
# Sets KUBE_VERSION variable to the version passed in as an argument, or if argument is
# Sets KUBE_VERSION variable to the version passed in as an argument, or if argument is
# latest_stable, latest_release, or latest_ci fetches and sets the corresponding version number
# latest_stable, latest_release, or latest_ci fetches and sets the corresponding version number
#
#
...
...
hack/conformance-test.sh
View file @
29da889b
...
@@ -23,8 +23,6 @@
...
@@ -23,8 +23,6 @@
# cluster to be tested, and with suitable auth setting.
# cluster to be tested, and with suitable auth setting.
# - Specify the location of that kubeconfig with, e.g.:
# - Specify the location of that kubeconfig with, e.g.:
# declare -x KUBECONFIG="$HOME/.kube/config"
# declare -x KUBECONFIG="$HOME/.kube/config"
# - Specify the location of the master with, e.g.:
# declare -x KUBE_MASTER_IP="1.2.3.4"
# - Make sure only essential pods are running and there are no failed/pending pods.
# - Make sure only essential pods are running and there are no failed/pending pods.
# - Go to a git tree that contains the kubernetes source.
# - Go to a git tree that contains the kubernetes source.
# - git clone git://github.com/kubernetes/kubernetes.git
# - git clone git://github.com/kubernetes/kubernetes.git
...
@@ -65,8 +63,7 @@
...
@@ -65,8 +63,7 @@
:
${
KUBECONFIG
:?
"Must set KUBECONFIG before running conformance test."
}
:
${
KUBECONFIG
:?
"Must set KUBECONFIG before running conformance test."
}
:
${
KUBE_MASTER_IP
:?
"Must set KUBE_MASTER_IP before running conformance test."
}
echo
"Conformance test using current-context of
${
KUBECONFIG
}
"
echo
"Conformance test using
${
KUBECONFIG
}
against master at
${
KUBE_MASTER_IP
}
"
echo
-n
"Conformance test run date:"
echo
-n
"Conformance test run date:"
date
date
echo
-n
"Conformance test SHA:"
echo
-n
"Conformance test SHA:"
...
...
hack/ginkgo-e2e.sh
View file @
29da889b
...
@@ -45,6 +45,9 @@ source "${KUBE_ROOT}/cluster/kube-env.sh"
...
@@ -45,6 +45,9 @@ source "${KUBE_ROOT}/cluster/kube-env.sh"
if
[[
-n
"
${
KUBERNETES_CONFORMANCE_TEST
:-}
"
]]
;
then
if
[[
-n
"
${
KUBERNETES_CONFORMANCE_TEST
:-}
"
]]
;
then
echo
"Conformance test: not doing test setup."
echo
"Conformance test: not doing test setup."
KUBERNETES_PROVIDER
=
""
KUBERNETES_PROVIDER
=
""
detect-master-from-kubeconfig
auth_config
=(
auth_config
=(
"--kubeconfig=
${
KUBECONFIG
}
"
"--kubeconfig=
${
KUBECONFIG
}
"
)
)
...
@@ -56,6 +59,7 @@ else
...
@@ -56,6 +59,7 @@ else
prepare-e2e
prepare-e2e
detect-master
>
/dev/null
detect-master
>
/dev/null
KUBE_MASTER_URL
=
"
${
KUBE_MASTER_URL
:-
https
://
${
KUBE_MASTER_IP
:-}}
"
auth_config
=(
auth_config
=(
"--kubeconfig=
${
KUBECONFIG
:-
$DEFAULT_KUBECONFIG
}
"
"--kubeconfig=
${
KUBECONFIG
:-
$DEFAULT_KUBECONFIG
}
"
...
@@ -89,7 +93,7 @@ fi
...
@@ -89,7 +93,7 @@ fi
export
PATH
=
$(
dirname
"
${
e2e_test
}
"
)
:
"
${
PATH
}
"
export
PATH
=
$(
dirname
"
${
e2e_test
}
"
)
:
"
${
PATH
}
"
"
${
ginkgo
}
"
"
${
ginkgo_args
[@]
:+
${
ginkgo_args
[@]
}}
"
"
${
e2e_test
}
"
--
\
"
${
ginkgo
}
"
"
${
ginkgo_args
[@]
:+
${
ginkgo_args
[@]
}}
"
"
${
e2e_test
}
"
--
\
"
${
auth_config
[@]
:+
${
auth_config
[@]
}}
"
\
"
${
auth_config
[@]
:+
${
auth_config
[@]
}}
"
\
--host
=
"
https://
${
KUBE_MASTER_IP
:-
}
"
\
--host
=
"
${
KUBE_MASTER_URL
}
"
\
--provider
=
"
${
KUBERNETES_PROVIDER
}
"
\
--provider
=
"
${
KUBERNETES_PROVIDER
}
"
\
--gce-project
=
"
${
PROJECT
:-}
"
\
--gce-project
=
"
${
PROJECT
:-}
"
\
--gce-zone
=
"
${
ZONE
:-}
"
\
--gce-zone
=
"
${
ZONE
:-}
"
\
...
...
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