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
596b9ebc
Commit
596b9ebc
authored
Apr 21, 2017
by
Isaac Hollander McCreery
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add comments and change function name
parent
7f599dc5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
9 deletions
+10
-9
configure-helper.sh
cluster/gce/gci/configure-helper.sh
+10
-9
No files found.
cluster/gce/gci/configure-helper.sh
View file @
596b9ebc
...
@@ -182,11 +182,11 @@ function mount-master-pd {
...
@@ -182,11 +182,11 @@ function mount-master-pd {
chgrp
-R
etcd
"
${
mount_point
}
/var/etcd"
chgrp
-R
etcd
"
${
mount_point
}
/var/etcd"
}
}
# replace_prefixed_line ensures:
#
append_or_
replace_prefixed_line ensures:
# 1. the specified file exists
# 1. the specified file exists
# 2. existing lines with the specified ${prefix} are removed
# 2. existing lines with the specified ${prefix} are removed
# 3. a new line with the specified ${prefix}${suffix} is appended
# 3. a new line with the specified ${prefix}${suffix} is appended
function
replace_prefixed_line
{
function
append_or_
replace_prefixed_line
{
local
-r
file
=
"
${
1
:-}
"
local
-r
file
=
"
${
1
:-}
"
local
-r
prefix
=
"
${
2
:-}
"
local
-r
prefix
=
"
${
2
:-}
"
local
-r
suffix
=
"
${
3
:-}
"
local
-r
suffix
=
"
${
3
:-}
"
...
@@ -286,29 +286,30 @@ function create-master-auth {
...
@@ -286,29 +286,30 @@ function create-master-auth {
local
-r
auth_dir
=
"/etc/srv/kubernetes"
local
-r
auth_dir
=
"/etc/srv/kubernetes"
local
-r
basic_auth_csv
=
"
${
auth_dir
}
/basic_auth.csv"
local
-r
basic_auth_csv
=
"
${
auth_dir
}
/basic_auth.csv"
if
[[
-n
"
${
KUBE_PASSWORD
:-}
"
&&
-n
"
${
KUBE_USER
:-}
"
]]
;
then
if
[[
-n
"
${
KUBE_PASSWORD
:-}
"
&&
-n
"
${
KUBE_USER
:-}
"
]]
;
then
# Remove basic_auth_csv because we will rewrite it.
if
[[
-e
"
${
basic_auth_csv
}
"
&&
"
${
METADATA_CLOBBERS_CONFIG
:-
false
}
"
==
"true"
]]
;
then
if
[[
-e
"
${
basic_auth_csv
}
"
&&
"
${
METADATA_CLOBBERS_CONFIG
:-
false
}
"
==
"true"
]]
;
then
rm
"
${
basic_auth_csv
}
"
rm
"
${
basic_auth_csv
}
"
fi
fi
replace_prefixed_line
"
${
basic_auth_csv
}
"
"
${
KUBE_PASSWORD
}
,
${
KUBE_USER
}
,"
"admin,system:masters"
append_or_replace_prefixed_line
"
${
basic_auth_csv
}
"
"
${
KUBE_PASSWORD
}
,
${
KUBE_USER
}
,"
"admin,system:masters"
fi
fi
local
-r
known_tokens_csv
=
"
${
auth_dir
}
/known_tokens.csv"
local
-r
known_tokens_csv
=
"
${
auth_dir
}
/known_tokens.csv"
if
[[
-n
"
${
KUBE_BEARER_TOKEN
:-}
"
]]
;
then
if
[[
-n
"
${
KUBE_BEARER_TOKEN
:-}
"
]]
;
then
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_BEARER_TOKEN
}
,"
"admin,admin,system:masters"
append_or_
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_BEARER_TOKEN
}
,"
"admin,admin,system:masters"
fi
fi
if
[[
-n
"
${
KUBE_CONTROLLER_MANAGER_TOKEN
:-}
"
]]
;
then
if
[[
-n
"
${
KUBE_CONTROLLER_MANAGER_TOKEN
:-}
"
]]
;
then
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_CONTROLLER_MANAGER_TOKEN
}
,"
"system:kube-controller-manager,uid:system:kube-controller-manager"
append_or_
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_CONTROLLER_MANAGER_TOKEN
}
,"
"system:kube-controller-manager,uid:system:kube-controller-manager"
fi
fi
if
[[
-n
"
${
KUBE_SCHEDULER_TOKEN
:-}
"
]]
;
then
if
[[
-n
"
${
KUBE_SCHEDULER_TOKEN
:-}
"
]]
;
then
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_SCHEDULER_TOKEN
}
,"
"system:kube-scheduler,uid:system:kube-scheduler"
append_or_
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_SCHEDULER_TOKEN
}
,"
"system:kube-scheduler,uid:system:kube-scheduler"
fi
fi
if
[[
-n
"
${
KUBELET_TOKEN
:-}
"
]]
;
then
if
[[
-n
"
${
KUBELET_TOKEN
:-}
"
]]
;
then
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBELET_TOKEN
}
,"
"kubelet,uid:kubelet,system:nodes"
append_or_
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBELET_TOKEN
}
,"
"kubelet,uid:kubelet,system:nodes"
fi
fi
if
[[
-n
"
${
KUBE_PROXY_TOKEN
:-}
"
]]
;
then
if
[[
-n
"
${
KUBE_PROXY_TOKEN
:-}
"
]]
;
then
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_PROXY_TOKEN
}
,"
"system:kube-proxy,uid:kube_proxy"
append_or_
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_PROXY_TOKEN
}
,"
"system:kube-proxy,uid:kube_proxy"
fi
fi
if
[[
-n
"
${
NODE_PROBLEM_DETECTOR_TOKEN
:-}
"
]]
;
then
if
[[
-n
"
${
NODE_PROBLEM_DETECTOR_TOKEN
:-}
"
]]
;
then
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
NODE_PROBLEM_DETECTOR_TOKEN
}
,"
"system:node-problem-detector,uid:node-problem-detector"
append_or_
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
NODE_PROBLEM_DETECTOR_TOKEN
}
,"
"system:node-problem-detector,uid:node-problem-detector"
fi
fi
local
use_cloud_config
=
"false"
local
use_cloud_config
=
"false"
cat
<<
EOF
>/etc/gce.conf
cat
<<
EOF
>/etc/gce.conf
...
...
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