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
7ae1458a
Commit
7ae1458a
authored
Aug 12, 2016
by
Michael Taufen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove the deprecated AuthPath from KubeletServer
It has been deprecated for two releases (1.2 and 1.3).
parent
0afaeab9
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
37 deletions
+15
-37
options.go
cmd/kubelet/app/options/options.go
+0
-1
server.go
cmd/kubelet/app/server.go
+15
-36
No files found.
cmd/kubelet/app/options/options.go
View file @
7ae1458a
...
...
@@ -67,7 +67,6 @@ func NewKubeletServer() *KubeletServer {
config
:=
componentconfig
.
KubeletConfiguration
{}
api
.
Scheme
.
Convert
(
&
v1alpha1
.
KubeletConfiguration
{},
&
config
,
nil
)
return
&
KubeletServer
{
AuthPath
:
util
.
NewStringFlag
(
"/var/lib/kubelet/kubernetes_auth"
),
// deprecated
KubeConfig
:
util
.
NewStringFlag
(
"/var/lib/kubelet/kubeconfig"
),
RequireKubeConfig
:
false
,
// in 1.5, default to true
KubeletConfiguration
:
config
,
...
...
cmd/kubelet/app/server.go
View file @
7ae1458a
...
...
@@ -505,28 +505,6 @@ func InitializeTLS(kc *componentconfig.KubeletConfiguration) (*server.TLSOptions
return
tlsOptions
,
nil
}
func
authPathClientConfig
(
s
*
options
.
KubeletServer
,
useDefaults
bool
)
(
*
restclient
.
Config
,
error
)
{
authInfo
,
err
:=
clientauth
.
LoadFromFile
(
s
.
AuthPath
.
Value
())
// If loading the default auth path, for backwards compatibility keep going
// with the default auth.
if
err
!=
nil
{
if
!
useDefaults
{
return
nil
,
err
}
glog
.
Warningf
(
"Could not load kubernetes auth path %s: %v. Continuing with defaults."
,
s
.
AuthPath
,
err
)
}
if
authInfo
==
nil
{
// authInfo didn't load correctly - continue with defaults.
authInfo
=
&
clientauth
.
Info
{}
}
authConfig
,
err
:=
authInfo
.
MergeWithConfig
(
restclient
.
Config
{})
if
err
!=
nil
{
return
nil
,
err
}
authConfig
.
Host
=
s
.
APIServerList
[
0
]
return
&
authConfig
,
nil
}
func
kubeconfigClientConfig
(
s
*
options
.
KubeletServer
)
(
*
restclient
.
Config
,
error
)
{
if
s
.
RequireKubeConfig
{
// Ignores the values of s.APIServerList
...
...
@@ -542,11 +520,10 @@ func kubeconfigClientConfig(s *options.KubeletServer) (*restclient.Config, error
}
// createClientConfig creates a client configuration from the command line
// arguments. If either --auth-path or --kubeconfig is explicitly set, it
// will be used (setting both is an error). If neither are set first attempt
// to load the default kubeconfig file, then the default auth path file, and
// fall back to the default auth (none) without an error.
// TODO(roberthbailey): Remove support for --auth-path
// arguments. If --kubeconfig is explicitly set, it will be used. If it is
// not set, we attempt to load the default kubeconfig file, and if we cannot,
// we fall back to the default client with no auth - this fallback does not, in
// and of itself, constitute an error.
func
createClientConfig
(
s
*
options
.
KubeletServer
)
(
*
restclient
.
Config
,
error
)
{
if
s
.
RequireKubeConfig
{
return
kubeconfigClientConfig
(
s
)
...
...
@@ -562,20 +539,22 @@ func createClientConfig(s *options.KubeletServer) (*restclient.Config, error) {
glog
.
Infof
(
"Multiple api servers specified. Picking first one"
)
}
if
s
.
KubeConfig
.
Provided
()
&&
s
.
AuthPath
.
Provided
()
{
return
nil
,
fmt
.
Errorf
(
"cannot specify both --kubeconfig and --auth-path"
)
}
if
s
.
KubeConfig
.
Provided
()
{
return
kubeconfigClientConfig
(
s
)
}
if
s
.
AuthPath
.
Provided
()
{
return
authPathClientConfig
(
s
,
false
)
}
// Try the kubeconfig default first, falling back to the auth path default.
// If KubeConfig was not provided, try to load the default file, then fall back
// to a default auth config.
clientConfig
,
err
:=
kubeconfigClientConfig
(
s
)
if
err
!=
nil
{
glog
.
Warningf
(
"Could not load kubeconfig file %s: %v. Trying auth path instead."
,
s
.
KubeConfig
,
err
)
return
authPathClientConfig
(
s
,
true
)
glog
.
Warningf
(
"Could not load kubeconfig file %s: %v. Using default client config instead."
,
s
.
KubeConfig
,
err
)
authInfo
:=
&
clientauth
.
Info
{}
authConfig
,
err
:=
authInfo
.
MergeWithConfig
(
restclient
.
Config
{})
if
err
!=
nil
{
return
nil
,
err
}
authConfig
.
Host
=
s
.
APIServerList
[
0
]
clientConfig
=
&
authConfig
}
return
clientConfig
,
nil
}
...
...
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