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
49610655
Commit
49610655
authored
Jan 19, 2018
by
Mike Danese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cluster: remove unused functions
parent
47091405
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
99 deletions
+11
-99
common.sh
cluster/common.sh
+0
-44
util.sh
cluster/gce/util.sh
+0
-55
ginkgo-e2e.sh
hack/ginkgo-e2e.sh
+11
-0
No files found.
cluster/common.sh
View file @
49610655
...
...
@@ -159,15 +159,6 @@ function clear-kubeconfig() {
echo
"Cleared config for
${
CONTEXT
}
from
${
KUBECONFIG
}
"
}
function
tear_down_alive_resources
()
{
local
kubectl
=
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
"
${
kubectl
}
"
delete deployments
--all
||
true
"
${
kubectl
}
"
delete rc
--all
||
true
"
${
kubectl
}
"
delete pods
--all
||
true
"
${
kubectl
}
"
delete svc
--all
||
true
"
${
kubectl
}
"
delete pvc
--all
||
true
}
# Gets username, password for the current-context in kubeconfig, if they exist.
# Assumed vars:
# KUBECONFIG # if unset, defaults to global
...
...
@@ -253,17 +244,6 @@ function gen-kube-bearertoken() {
KUBE_BEARER_TOKEN
=
$(
dd
if
=
/dev/urandom
bs
=
128
count
=
1 2>/dev/null |
base64
|
tr
-d
"=+/"
|
dd
bs
=
32
count
=
1 2>/dev/null
)
}
# Generate uid
# This function only works on systems with python. It generates a time based
# UID instead of a UUID because GCE has a name length limit.
#
# Vars set:
# KUBE_UID
function
gen-uid
{
KUBE_UID
=
$(
python
-c
'import uuid; print(uuid.uuid1().fields[0])'
)
}
function
load-or-gen-kube-basicauth
()
{
if
[[
!
-z
"
${
KUBE_CONTEXT
:-}
"
]]
;
then
get-kubeconfig-basicauth
...
...
@@ -293,28 +273,6 @@ function load-or-gen-kube-bearertoken() {
fi
}
# Get the master IP for the current-context in kubeconfig if one exists.
#
# Assumed vars:
# KUBECONFIG # if unset, defaults to global
# KUBE_CONTEXT # if unset, defaults to current-context
#
# 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
}
local
cc
=
$(
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
config view
-o
jsonpath
=
"{.current-context}"
)
if
[[
!
-z
"
${
KUBE_CONTEXT
:-}
"
]]
;
then
cc
=
"
${
KUBE_CONTEXT
}
"
fi
local
cluster
=
$(
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
config view
-o
jsonpath
=
"{.contexts[?(@.name ==
\"
${
cc
}
\"
)].context.cluster}"
)
KUBE_MASTER_URL
=
$(
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
config view
-o
jsonpath
=
"{.clusters[?(@.name ==
\"
${
cluster
}
\"
)].cluster.server}"
)
}
# Sets KUBE_VERSION variable to the proper version number (e.g. "v1.0.6",
# "v1.2.0-alpha.1.881+376438b69c7612") or a version' publication of the form
# <path>/<version> (e.g. "release/stable",' "ci/latest-1").
...
...
@@ -569,7 +527,6 @@ function build-kube-env {
fi
build-runtime-config
gen-uid
rm
-f
${
file
}
cat
>
$file
<<
EOF
...
...
@@ -633,7 +590,6 @@ KUBE_DOCKER_REGISTRY: $(yaml-quote ${KUBE_DOCKER_REGISTRY:-})
KUBE_ADDON_REGISTRY:
$(
yaml-quote
${
KUBE_ADDON_REGISTRY
:-})
MULTIZONE:
$(
yaml-quote
${
MULTIZONE
:-})
NON_MASQUERADE_CIDR:
$(
yaml-quote
${
NON_MASQUERADE_CIDR
:-})
KUBE_UID:
$(
yaml-quote
${
KUBE_UID
:-})
ENABLE_DEFAULT_STORAGE_CLASS:
$(
yaml-quote
${
ENABLE_DEFAULT_STORAGE_CLASS
:-})
ENABLE_APISERVER_BASIC_AUDIT:
$(
yaml-quote
${
ENABLE_APISERVER_BASIC_AUDIT
:-})
ENABLE_APISERVER_ADVANCED_AUDIT:
$(
yaml-quote
${
ENABLE_APISERVER_ADVANCED_AUDIT
:-})
...
...
cluster/gce/util.sh
View file @
49610655
...
...
@@ -677,61 +677,6 @@ function create-node-template() {
done
}
# Robustly try to add metadata on an instance.
# $1: The name of the instance.
# $2...$n: The metadata key=value pairs to add.
function
add-instance-metadata
()
{
local
-r
instance
=
$1
shift
1
local
-r
kvs
=(
"
$@
"
)
detect-project
local
attempt
=
0
while
true
;
do
if
!
gcloud compute instances add-metadata
"
${
instance
}
"
\
--project
"
${
PROJECT
}
"
\
--zone
"
${
ZONE
}
"
\
--metadata
"
${
kvs
[@]
}
"
;
then
if
((
attempt
>
5
))
;
then
echo
-e
"
${
color_red
}
Failed to add instance metadata in
${
instance
}
${
color_norm
}
"
>
&2
exit
2
fi
echo
-e
"
${
color_yellow
}
Attempt
$((
$attempt
+
1
))
failed to add metadata in
${
instance
}
. Retrying.
${
color_norm
}
"
>
&2
attempt
=
$((
$attempt
+
1
))
sleep
$((
5
*
$attempt
))
else
break
fi
done
}
# Robustly try to add metadata on an instance, from a file.
# $1: The name of the instance.
# $2...$n: The metadata key=file pairs to add.
function
add-instance-metadata-from-file
()
{
local
-r
instance
=
$1
shift
1
local
-r
kvs
=(
"
$@
"
)
detect-project
local
attempt
=
0
while
true
;
do
echo
"
${
kvs
[@]
}
"
if
!
gcloud compute instances add-metadata
"
${
instance
}
"
\
--project
"
${
PROJECT
}
"
\
--zone
"
${
ZONE
}
"
\
--metadata-from-file
"
$(
join_csv
${
kvs
[@]
})
"
;
then
if
((
attempt
>
5
))
;
then
echo
-e
"
${
color_red
}
Failed to add instance metadata in
${
instance
}
${
color_norm
}
"
>
&2
exit
2
fi
echo
-e
"
${
color_yellow
}
Attempt
$((
$attempt
+
1
))
failed to add metadata in
${
instance
}
. Retrying.
${
color_norm
}
"
>
&2
attempt
=
$((
$attempt
+
1
))
sleep
$((
$attempt
*
5
))
else
break
fi
done
}
# Instantiate a kubernetes cluster
#
# Assumed vars
...
...
hack/ginkgo-e2e.sh
View file @
49610655
...
...
@@ -45,6 +45,17 @@ export KUBECTL KUBE_CONFIG_FILE
source
"
${
KUBE_ROOT
}
/cluster/kube-util.sh"
function
detect-master-from-kubeconfig
()
{
export
KUBECONFIG
=
${
KUBECONFIG
:-
$DEFAULT_KUBECONFIG
}
local
cc
=
$(
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
config view
-o
jsonpath
=
"{.current-context}"
)
if
[[
!
-z
"
${
KUBE_CONTEXT
:-}
"
]]
;
then
cc
=
"
${
KUBE_CONTEXT
}
"
fi
local
cluster
=
$(
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
config view
-o
jsonpath
=
"{.contexts[?(@.name ==
\"
${
cc
}
\"
)].context.cluster}"
)
KUBE_MASTER_URL
=
$(
"
${
KUBE_ROOT
}
/cluster/kubectl.sh"
config view
-o
jsonpath
=
"{.clusters[?(@.name ==
\"
${
cluster
}
\"
)].cluster.server}"
)
}
# ---- Do cloud-provider-specific setup
if
[[
-n
"
${
KUBERNETES_CONFORMANCE_TEST
:-}
"
]]
;
then
echo
"Conformance test: not doing test setup."
...
...
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