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
8565ee89
Commit
8565ee89
authored
Nov 19, 2017
by
xiangpengzhao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Write marshalled kubeletconfig object to init-config-dir
parent
5322cc5e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
0 deletions
+21
-0
constants.go
cmd/kubeadm/app/constants/constants.go
+8
-0
kubelet.go
cmd/kubeadm/app/phases/kubelet/kubelet.go
+13
-0
No files found.
cmd/kubeadm/app/constants/constants.go
View file @
8565ee89
...
...
@@ -155,6 +155,14 @@ const (
// after https://github.com/kubernetes/kubernetes/pull/53833 being merged.
KubeletBaseConfigurationConfigMapKey
=
"kubelet"
// KubeletBaseConfigurationDir specifies the directory on the node where stores the initial remote configuration of kubelet
KubeletBaseConfigurationDir
=
"/var/lib/kubelet/config/init"
// KubeletBaseConfigurationFile specifies the file name on the node which stores initial remote configuration of kubelet
// TODO: Use the constant ("kubelet.config.k8s.io") defined in pkg/kubelet/kubeletconfig/util/keys/keys.go
// after https://github.com/kubernetes/kubernetes/pull/53833 being merged.
KubeletBaseConfigurationFile
=
"kubelet"
// MinExternalEtcdVersion indicates minimum external etcd version which kubeadm supports
MinExternalEtcdVersion
=
"3.0.14"
...
...
cmd/kubeadm/app/phases/kubelet/kubelet.go
View file @
8565ee89
...
...
@@ -19,6 +19,10 @@ package kubelet
import
(
"encoding/json"
"fmt"
"io/ioutil"
"path/filepath"
"github.com/ghodss/yaml"
"k8s.io/api/core/v1"
rbac
"k8s.io/api/rbac/v1"
...
...
@@ -92,6 +96,15 @@ func UpdateNodeWithConfigMap(client clientset.Interface, nodeName string) error
return
false
,
nil
}
baseCongfig
,
err
:=
yaml
.
Marshal
(
kubeletCfg
.
Data
[
kubeadmconstants
.
KubeletBaseConfigurationConfigMapKey
])
if
err
!=
nil
{
return
false
,
err
}
baseCongfigFile
:=
filepath
.
Join
(
kubeadmconstants
.
KubeletBaseConfigurationDir
,
kubeadmconstants
.
KubeletBaseConfigurationFile
)
if
err
:=
ioutil
.
WriteFile
(
baseCongfigFile
,
baseCongfig
,
0644
);
err
!=
nil
{
return
false
,
fmt
.
Errorf
(
"failed to write initial remote configuration of kubelet into file %q for node %s: %v"
,
baseCongfigFile
,
nodeName
,
err
)
}
node
.
Spec
.
ConfigSource
=
&
v1
.
NodeConfigSource
{
ConfigMapRef
:
&
v1
.
ObjectReference
{
Name
:
kubeadmconstants
.
KubeletBaseConfigurationConfigMap
,
...
...
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