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
4b88af14
Commit
4b88af14
authored
Jan 19, 2019
by
Roy Lenferink
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bash syntax improvements
parent
a5d0616b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
23 deletions
+23
-23
local-up-cluster.sh
hack/local-up-cluster.sh
+23
-23
No files found.
hack/local-up-cluster.sh
View file @
4b88af14
...
@@ -129,7 +129,7 @@ fi
...
@@ -129,7 +129,7 @@ fi
# set feature gates if enable Pod priority and preemption
# set feature gates if enable Pod priority and preemption
if
[
"
${
ENABLE_POD_PRIORITY_PREEMPTION
}
"
==
true
]
;
then
if
[
"
${
ENABLE_POD_PRIORITY_PREEMPTION
}
"
==
true
]
;
then
FEATURE_GATES
=
"
$
FEATURE_GATES
,PodPriority=true"
FEATURE_GATES
=
"
$
{
FEATURE_GATES
}
,PodPriority=true"
fi
fi
# warn if users are running with swap allowed
# warn if users are running with swap allowed
...
@@ -172,12 +172,12 @@ do
...
@@ -172,12 +172,12 @@ do
case
${
OPTION
}
in
case
${
OPTION
}
in
o
)
o
)
echo
"skipping build"
echo
"skipping build"
GO_OUT
=
"
$
OPTARG
"
GO_OUT
=
"
$
{
OPTARG
}
"
echo
"using source
$
GO_OUT
"
echo
"using source
$
{
GO_OUT
}
"
;;
;;
O
)
O
)
GO_OUT
=
$(
guess_built_binary_path
)
GO_OUT
=
$(
guess_built_binary_path
)
if
[
"
$
GO_OUT
"
==
""
]
;
then
if
[
"
$
{
GO_OUT
}
"
==
""
]
;
then
echo
"Could not guess the correct output directory to use."
echo
"Could not guess the correct output directory to use."
exit
1
exit
1
fi
fi
...
@@ -193,7 +193,7 @@ do
...
@@ -193,7 +193,7 @@ do
esac
esac
done
done
if
[
"x
$
GO_OUT
"
==
"x"
]
;
then
if
[
"x
$
{
GO_OUT
}
"
==
"x"
]
;
then
make
-C
"
${
KUBE_ROOT
}
"
WHAT
=
"cmd/kubectl cmd/hyperkube"
make
-C
"
${
KUBE_ROOT
}
"
WHAT
=
"cmd/kubectl cmd/hyperkube"
else
else
echo
"skipped the build."
echo
"skipped the build."
...
@@ -367,7 +367,7 @@ cleanup()
...
@@ -367,7 +367,7 @@ cleanup()
[[ -n "${CTLRMGR_PID-}" ]] && CTLRMGR_PIDS=$(pgrep -P ${CTLRMGR_PID} ; ps -o pid= -p ${CTLRMGR_PID})
[[ -n "${CTLRMGR_PID-}" ]] && CTLRMGR_PIDS=$(pgrep -P ${CTLRMGR_PID} ; ps -o pid= -p ${CTLRMGR_PID})
[[ -n "${CTLRMGR_PIDS-}" ]] && sudo kill ${CTLRMGR_PIDS} 2>/dev/null
[[ -n "${CTLRMGR_PIDS-}" ]] && sudo kill ${CTLRMGR_PIDS} 2>/dev/null
if [[ -n "$
DOCKERIZE_KUBELET
" ]]; then
if [[ -n "$
{DOCKERIZE_KUBELET}
" ]]; then
cleanup_dockerized_kubelet
cleanup_dockerized_kubelet
else
else
# Check if the kubelet is still running
# Check if the kubelet is still running
...
@@ -404,7 +404,7 @@ function healthcheck {
...
@@ -404,7 +404,7 @@ function healthcheck {
CTLRMGR_PID=
CTLRMGR_PID=
fi
fi
if [[ -n "$
DOCKERIZE_KUBELET
" ]]; then
if [[ -n "$
{DOCKERIZE_KUBELET}
" ]]; then
# TODO (https://github.com/kubernetes/kubernetes/issues/62474): check health also in this case
# TODO (https://github.com/kubernetes/kubernetes/issues/62474): check health also in this case
:
:
elif [[ -n "${KUBELET_PID-}" ]] && ! sudo kill -0 ${KUBELET_PID} 2>/dev/null; then
elif [[ -n "${KUBELET_PID-}" ]] && ! sudo kill -0 ${KUBELET_PID} 2>/dev/null; then
...
@@ -648,11 +648,11 @@ function start_controller_manager {
...
@@ -648,11 +648,11 @@ function start_controller_manager {
--pvclaimbinder-sync-period="${CLAIM_BINDER_SYNC_PERIOD}" \
--pvclaimbinder-sync-period="${CLAIM_BINDER_SYNC_PERIOD}" \
--feature-gates="${FEATURE_GATES}" \
--feature-gates="${FEATURE_GATES}" \
${cloud_config_arg} \
${cloud_config_arg} \
--kubeconfig "$
CERT_DIR
"/controller.kubeconfig \
--kubeconfig "$
{CERT_DIR}
"/controller.kubeconfig \
--use-service-account-credentials \
--use-service-account-credentials \
--controllers="${KUBE_CONTROLLERS}" \
--controllers="${KUBE_CONTROLLERS}" \
--leader-elect=false \
--leader-elect=false \
--cert-dir="$
CERT_DIR
" \
--cert-dir="$
{CERT_DIR}
" \
--master="https://${API_HOST}:${API_SECURE_PORT}" >"${CTLRMGR_LOG}" 2>&1 &
--master="https://${API_HOST}:${API_SECURE_PORT}" >"${CTLRMGR_LOG}" 2>&1 &
CTLRMGR_PID=$!
CTLRMGR_PID=$!
}
}
...
@@ -680,7 +680,7 @@ function start_cloud_controller_manager {
...
@@ -680,7 +680,7 @@ function start_cloud_controller_manager {
--feature-gates="
${
FEATURE_GATES
}
"
\
--feature-gates="
${
FEATURE_GATES
}
"
\
--cloud-provider=
${
CLOUD_PROVIDER
}
\
--cloud-provider=
${
CLOUD_PROVIDER
}
\
--cloud-config=
${
CLOUD_CONFIG
}
\
--cloud-config=
${
CLOUD_CONFIG
}
\
--kubeconfig "
$
CERT_DIR
"/controller.kubeconfig
\
--kubeconfig "
$
{
CERT_DIR
}
"/controller.kubeconfig
\
--use-service-account-credentials
\
--use-service-account-credentials
\
--leader-elect=false
\
--leader-elect=false
\
--master="
https
://
${
API_HOST
}
:
${
API_SECURE_PORT
}
" >"
${
CLOUD_CTLRMGR_LOG
}
" 2>&1 &
--master="
https
://
${
API_HOST
}
:
${
API_SECURE_PORT
}
" >"
${
CLOUD_CTLRMGR_LOG
}
" 2>&1 &
...
@@ -763,7 +763,7 @@ function start_kubelet {
...
@@ -763,7 +763,7 @@ function start_kubelet {
--hostname-override="
${
HOSTNAME_OVERRIDE
}
"
--hostname-override="
${
HOSTNAME_OVERRIDE
}
"
${
cloud_config_arg
}
${
cloud_config_arg
}
--address="
${
KUBELET_HOST
}
"
--address="
${
KUBELET_HOST
}
"
--kubeconfig "
$
CERT_DIR
"/kubelet.kubeconfig
--kubeconfig "
$
{
CERT_DIR
}
"/kubelet.kubeconfig
--feature-gates="
${
FEATURE_GATES
}
"
--feature-gates="
${
FEATURE_GATES
}
"
--cpu-cfs-quota="
${
CPU_CFS_QUOTA
}
"
--cpu-cfs-quota="
${
CPU_CFS_QUOTA
}
"
--enable-controller-attach-detach="
${
ENABLE_CONTROLLER_ATTACH_DETACH
}
"
--enable-controller-attach-detach="
${
ENABLE_CONTROLLER_ATTACH_DETACH
}
"
...
@@ -782,7 +782,7 @@ function start_kubelet {
...
@@ -782,7 +782,7 @@ function start_kubelet {
${
net_plugin_args
}
${
net_plugin_args
}
${
container_runtime_endpoint_args
}
${
container_runtime_endpoint_args
}
${
image_service_endpoint_args
}
${
image_service_endpoint_args
}
--port="
$
KUBELET_PORT
"
--port="
$
{
KUBELET_PORT
}
"
${
KUBELET_FLAGS
}
${
KUBELET_FLAGS
}
)
)
...
@@ -792,7 +792,7 @@ function start_kubelet {
...
@@ -792,7 +792,7 @@ function start_kubelet {
else
else
# Build the hyperkube container image if necessary
# Build the hyperkube container image if necessary
if [[ -z "
$
KUBELET_IMAGE
" && -n "
$DOCKERIZE_KUBELET
" ]]; then
if [[ -z "
$
{
KUBELET_IMAGE
}
" && -n "
${
DOCKERIZE_KUBELET
}
" ]]; then
HYPERKUBE_BIN="
${
GO_OUT
}
/hyperkube
" REGISTRY="
k8s
.gcr.io
" VERSION="
latest
" make -C "
${
KUBE_ROOT
}
/cluster/images/hyperkube
" build
HYPERKUBE_BIN="
${
GO_OUT
}
/hyperkube
" REGISTRY="
k8s
.gcr.io
" VERSION="
latest
" make -C "
${
KUBE_ROOT
}
/cluster/images/hyperkube
" build
KUBELET_IMAGE="
k8s
.gcr.io/hyperkube-amd64
:latest
"
KUBELET_IMAGE="
k8s
.gcr.io/hyperkube-amd64
:latest
"
fi
fi
...
@@ -849,7 +849,7 @@ function start_kubelet {
...
@@ -849,7 +849,7 @@ function start_kubelet {
echo -n "
Trying
to get PID of kubelet container...
"
echo -n "
Trying
to get PID of kubelet container...
"
KUBELET_PID=
$(
docker inspect kubelet
-f
'{{.State.Pid}}'
2>/dev/null
||
true
)
KUBELET_PID=
$(
docker inspect kubelet
-f
'{{.State.Pid}}'
2>/dev/null
||
true
)
if [[ -n
${
KUBELET_PID
}
&&
${
KUBELET_PID
}
-gt 0 ]]; then
if [[ -n
${
KUBELET_PID
}
&&
${
KUBELET_PID
}
-gt 0 ]]; then
echo "
ok,
$
KUBELET_PID
.
"
echo "
ok,
$
{
KUBELET_PID
}
.
"
break
break
else
else
echo "
failed, retry in 1 second.
"
echo "
failed, retry in 1 second.
"
...
@@ -858,8 +858,8 @@ function start_kubelet {
...
@@ -858,8 +858,8 @@ 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
fi
fi
...
@@ -896,7 +896,7 @@ EOF
...
@@ -896,7 +896,7 @@ EOF
${
CONTROLPLANE_SUDO
}
"
${
GO_OUT
}
/hyperkube
" scheduler
\
${
CONTROLPLANE_SUDO
}
"
${
GO_OUT
}
/hyperkube
" scheduler
\
--v=
${
LOG_LEVEL
}
\
--v=
${
LOG_LEVEL
}
\
--leader-elect=false
\
--leader-elect=false
\
--kubeconfig "
$
CERT_DIR
"/scheduler.kubeconfig
\
--kubeconfig "
$
{
CERT_DIR
}
"/scheduler.kubeconfig
\
--feature-gates="
${
FEATURE_GATES
}
"
\
--feature-gates="
${
FEATURE_GATES
}
"
\
--master="
https
://
${
API_HOST
}
:
${
API_SECURE_PORT
}
" >"
${
SCHEDULER_LOG
}
" 2>&1 &
--master="
https
://
${
API_HOST
}
:
${
API_SECURE_PORT
}
" >"
${
SCHEDULER_LOG
}
" 2>&1 &
SCHEDULER_PID=
$!
SCHEDULER_PID=
$!
...
@@ -947,17 +947,17 @@ function create_psp_policy {
...
@@ -947,17 +947,17 @@ function create_psp_policy {
}
}
function create_storage_class {
function create_storage_class {
if [ -z "
$
CLOUD_PROVIDER
" ]; then
if [ -z "
$
{
CLOUD_PROVIDER
}
" ]; then
CLASS_FILE=
${
KUBE_ROOT
}
/cluster/addons/storage-class/local/default.yaml
CLASS_FILE=
${
KUBE_ROOT
}
/cluster/addons/storage-class/local/default.yaml
else
else
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
}
}
...
@@ -1053,11 +1053,11 @@ kube::util::test_openssl_installed
...
@@ -1053,11 +1053,11 @@ kube::util::test_openssl_installed
kube::util::ensure-cfssl
kube::util::ensure-cfssl
### IF the user didn't supply an output/ for the build... Then we detect.
### IF the user didn't supply an output/ for the build... Then we detect.
if [ "
$
GO_OUT
" == "" ]; then
if [ "
$
{
GO_OUT
}
" == "" ]; then
detect_binary
detect_binary
fi
fi
echo "
Detected host and ready to start services. Doing some housekeeping first...
"
echo "
Detected host and ready to start services. Doing some housekeeping first...
"
echo "
Using GO_OUT
$
GO_OUT
"
echo "
Using GO_OUT
$
{
GO_OUT
}
"
KUBELET_CIDFILE=/tmp/kubelet.cid
KUBELET_CIDFILE=/tmp/kubelet.cid
if [[ "
${
ENABLE_DAEMON
}
" = false ]]; then
if [[ "
${
ENABLE_DAEMON
}
" = false ]]; then
trap cleanup EXIT
trap cleanup EXIT
...
@@ -1101,7 +1101,7 @@ if [[ -n "${PSP_ADMISSION}" && "${AUTHORIZATION_MODE}" = *RBAC* ]]; then
...
@@ -1101,7 +1101,7 @@ if [[ -n "${PSP_ADMISSION}" && "${AUTHORIZATION_MODE}" = *RBAC* ]]; then
create_psp_policy
create_psp_policy
fi
fi
if [[ "
$
DEFAULT_STORAGE_CLASS
" = "
true
" ]]; then
if [[ "
$
{
DEFAULT_STORAGE_CLASS
}
" = "
true
" ]]; then
create_storage_class
create_storage_class
fi
fi
...
...
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