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
968b0b30
Unverified
Commit
968b0b30
authored
Jan 06, 2017
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update token users if needed
parent
21b422fc
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
40 additions
and
16 deletions
+40
-16
configure-helper.sh
cluster/gce/container-linux/configure-helper.sh
+20
-8
configure-helper.sh
cluster/gce/gci/configure-helper.sh
+20
-8
No files found.
cluster/gce/container-linux/configure-helper.sh
View file @
968b0b30
...
...
@@ -127,6 +127,20 @@ function mount-master-pd {
chgrp
-R
etcd
"
${
mount_point
}
/var/etcd"
}
# replace_prefixed_line ensures:
# 1. the specified file exists
# 2. existing lines with the specified ${prefix} are removed
# 3. a new line with the specified ${prefix}${suffix} is appended
function
replace_prefixed_line
{
local
-r
file
=
"
${
1
:-}
"
local
-r
prefix
=
"
${
2
:-}
"
local
-r
suffix
=
"
${
3
:-}
"
touch
"
${
file
}
"
awk
"substr(
\$
0,0,length(
\"
${
prefix
}
\"
)) !=
\"
${
prefix
}
\"
{ print }"
"
${
file
}
"
>
"
${
file
}
.filtered"
&&
mv
"
${
file
}
.filtered"
"
${
file
}
"
echo
"
${
prefix
}${
suffix
}
"
>>
"
${
file
}
"
}
# After the first boot and on upgrade, these files exist on the master-pd
# and should never be touched again (except perhaps an additional service
# account, see NB below.)
...
...
@@ -139,16 +153,14 @@ function create-master-auth {
echo
"
${
MASTER_KEY
}
"
|
base64
--decode
>
"
${
auth_dir
}
/server.key"
fi
local
-r
basic_auth_csv
=
"
${
auth_dir
}
/basic_auth.csv"
if
[[
!
-e
"
${
basic_auth_csv
}
"
&&
-n
"
${
KUBE_PASSWORD
:-}
"
&&
-n
"
${
KUBE_USER
:-}
"
]]
;
then
echo
"
${
KUBE_PASSWORD
}
,
${
KUBE_USER
}
,admin,system:masters"
>
"
${
basic_auth_csv
}
"
if
[[
-n
"
${
KUBE_PASSWORD
:-}
"
&&
-n
"
${
KUBE_USER
:-}
"
]]
;
then
replace_prefixed_line
"
${
basic_auth_csv
}
"
"
${
KUBE_PASSWORD
}
,
${
KUBE_USER
}
,"
"admin,system:masters
"
fi
local
-r
known_tokens_csv
=
"
${
auth_dir
}
/known_tokens.csv"
if
[[
!
-e
"
${
known_tokens_csv
}
"
]]
;
then
echo
"
${
KUBE_BEARER_TOKEN
}
,admin,admin,system:masters"
>
"
${
known_tokens_csv
}
"
echo
"
${
KUBE_CONTROLLER_MANAGER_TOKEN
}
,system:kube-controller-manager,uid:system:kube-controller-manager"
>>
"
${
known_tokens_csv
}
"
echo
"
${
KUBELET_TOKEN
}
,system:node:node-name,uid:kubelet,system:nodes"
>>
"
${
known_tokens_csv
}
"
echo
"
${
KUBE_PROXY_TOKEN
}
,system:kube-proxy,uid:kube_proxy"
>>
"
${
known_tokens_csv
}
"
fi
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_BEARER_TOKEN
}
"
"admin,admin,system:masters"
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_CONTROLLER_MANAGER_TOKEN
}
"
"system:kube-controller-manager,uid:system:kube-controller-manager"
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBELET_TOKEN
}
"
"system:node:node-name,uid:kubelet,system:nodes"
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_PROXY_TOKEN
}
"
"system:kube-proxy,uid:kube_proxy"
local
use_cloud_config
=
"false"
cat
<<
EOF
>/etc/gce.conf
[global]
...
...
cluster/gce/gci/configure-helper.sh
View file @
968b0b30
...
...
@@ -190,6 +190,20 @@ function mount-master-pd {
chgrp
-R
etcd
"
${
mount_point
}
/var/etcd"
}
# replace_prefixed_line ensures:
# 1. the specified file exists
# 2. existing lines with the specified ${prefix} are removed
# 3. a new line with the specified ${prefix}${suffix} is appended
function
replace_prefixed_line
{
local
-r
file
=
"
${
1
:-}
"
local
-r
prefix
=
"
${
2
:-}
"
local
-r
suffix
=
"
${
3
:-}
"
touch
"
${
file
}
"
awk
"substr(
\$
0,0,length(
\"
${
prefix
}
\"
)) !=
\"
${
prefix
}
\"
{ print }"
"
${
file
}
"
>
"
${
file
}
.filtered"
&&
mv
"
${
file
}
.filtered"
"
${
file
}
"
echo
"
${
prefix
}${
suffix
}
"
>>
"
${
file
}
"
}
# After the first boot and on upgrade, these files exist on the master-pd
# and should never be touched again (except perhaps an additional service
# account, see NB below.)
...
...
@@ -206,16 +220,14 @@ function create-master-auth {
echo
"
${
KUBEAPISERVER_KEY
}
"
|
base64
--decode
>
"
${
auth_dir
}
/kubeapiserver.key"
fi
local
-r
basic_auth_csv
=
"
${
auth_dir
}
/basic_auth.csv"
if
[[
!
-e
"
${
basic_auth_csv
}
"
&&
-n
"
${
KUBE_PASSWORD
:-}
"
&&
-n
"
${
KUBE_USER
:-}
"
]]
;
then
echo
"
${
KUBE_PASSWORD
}
,
${
KUBE_USER
}
,admin,system:masters"
>
"
${
basic_auth_csv
}
"
if
[[
-n
"
${
KUBE_PASSWORD
:-}
"
&&
-n
"
${
KUBE_USER
:-}
"
]]
;
then
replace_prefixed_line
"
${
basic_auth_csv
}
"
"
${
KUBE_PASSWORD
}
,
${
KUBE_USER
}
,"
"admin,system:masters
"
fi
local
-r
known_tokens_csv
=
"
${
auth_dir
}
/known_tokens.csv"
if
[[
!
-e
"
${
known_tokens_csv
}
"
]]
;
then
echo
"
${
KUBE_BEARER_TOKEN
}
,admin,admin,system:masters"
>
"
${
known_tokens_csv
}
"
echo
"
${
KUBE_CONTROLLER_MANAGER_TOKEN
}
,system:kube-controller-manager,uid:system:kube-controller-manager"
>>
"
${
known_tokens_csv
}
"
echo
"
${
KUBELET_TOKEN
}
,system:node:node-name,uid:kubelet,system:nodes"
>>
"
${
known_tokens_csv
}
"
echo
"
${
KUBE_PROXY_TOKEN
}
,system:kube-proxy,uid:kube_proxy"
>>
"
${
known_tokens_csv
}
"
fi
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_BEARER_TOKEN
}
,"
"admin,admin,system:masters"
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_CONTROLLER_MANAGER_TOKEN
}
,"
"system:kube-controller-manager,uid:system:kube-controller-manager"
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBELET_TOKEN
}
,"
"system:node:node-name,uid:kubelet,system:nodes"
replace_prefixed_line
"
${
known_tokens_csv
}
"
"
${
KUBE_PROXY_TOKEN
}
,"
"system:kube-proxy,uid:kube_proxy"
local
use_cloud_config
=
"false"
cat
<<
EOF
>/etc/gce.conf
[global]
...
...
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