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
7536e776
Commit
7536e776
authored
Nov 18, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16931 from mikedanese/inclustercomponent
Auto commit by PR queue bot
parents
5b2e339b
fb056c47
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
20 deletions
+23
-20
controllermanager.go
cmd/kube-controller-manager/app/controllermanager.go
+1
-10
client_config.go
pkg/client/unversioned/clientcmd/client_config.go
+21
-0
server.go
plugin/cmd/kube-scheduler/app/server.go
+1
-10
No files found.
cmd/kube-controller-manager/app/controllermanager.go
View file @
7536e776
...
...
@@ -35,7 +35,6 @@ import (
"k8s.io/kubernetes/pkg/api/unversioned"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
clientcmdapi
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
"k8s.io/kubernetes/pkg/cloudprovider"
"k8s.io/kubernetes/pkg/controller/daemon"
"k8s.io/kubernetes/pkg/controller/deployment"
...
...
@@ -234,15 +233,7 @@ func (s *CMServer) ResyncPeriod() time.Duration {
// Run runs the CMServer. This should never exit.
func
(
s
*
CMServer
)
Run
(
_
[]
string
)
error
{
if
s
.
Kubeconfig
==
""
&&
s
.
Master
==
""
{
glog
.
Warningf
(
"Neither --kubeconfig nor --master was specified. Using default API client. This might not work."
)
}
// This creates a client, first loading any specified kubeconfig
// file, and then overriding the Master flag, if non-empty.
kubeconfig
,
err
:=
clientcmd
.
NewNonInteractiveDeferredLoadingClientConfig
(
&
clientcmd
.
ClientConfigLoadingRules
{
ExplicitPath
:
s
.
Kubeconfig
},
&
clientcmd
.
ConfigOverrides
{
ClusterInfo
:
clientcmdapi
.
Cluster
{
Server
:
s
.
Master
}})
.
ClientConfig
()
kubeconfig
,
err
:=
clientcmd
.
BuildConfigFromFlags
(
s
.
Master
,
s
.
Kubeconfig
)
if
err
!=
nil
{
return
err
}
...
...
pkg/client/unversioned/clientcmd/client_config.go
View file @
7536e776
...
...
@@ -22,6 +22,7 @@ import (
"net/url"
"os"
"github.com/golang/glog"
"github.com/imdario/mergo"
"k8s.io/kubernetes/pkg/api"
...
...
@@ -335,3 +336,23 @@ func (inClusterClientConfig) Possible() bool {
os
.
Getenv
(
"KUBERNETES_SERVICE_PORT"
)
!=
""
&&
err
==
nil
&&
!
fi
.
IsDir
()
}
// BuildConfigFromFlags is a helper function that builds configs from a master
// url or a kubeconfig filepath. These are passed in as command line flags for cluster
// components. Warnings should reflect this usage. If neither masterUrl or kubeconfigPath
// are passed in we fallback to inClusterConfig. If inClusterConfig fails, we fallback
// to the default config.
func
BuildConfigFromFlags
(
masterUrl
,
kubeconfigPath
string
)
(
*
client
.
Config
,
error
)
{
if
kubeconfigPath
==
""
&&
masterUrl
==
""
{
glog
.
Warningf
(
"Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work."
)
kubeconfig
,
err
:=
client
.
InClusterConfig
()
if
err
==
nil
{
return
kubeconfig
,
nil
}
glog
.
Warning
(
"error creating inClusterConfig, falling back to default config: %v"
,
err
)
}
return
NewNonInteractiveDeferredLoadingClientConfig
(
&
ClientConfigLoadingRules
{
ExplicitPath
:
kubeconfigPath
},
&
ConfigOverrides
{
ClusterInfo
:
clientcmdapi
.
Cluster
{
Server
:
masterUrl
}})
.
ClientConfig
()
}
plugin/cmd/kube-scheduler/app/server.go
View file @
7536e776
...
...
@@ -30,7 +30,6 @@ import (
"k8s.io/kubernetes/pkg/client/record"
client
"k8s.io/kubernetes/pkg/client/unversioned"
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd"
clientcmdapi
"k8s.io/kubernetes/pkg/client/unversioned/clientcmd/api"
"k8s.io/kubernetes/pkg/healthz"
"k8s.io/kubernetes/pkg/master/ports"
"k8s.io/kubernetes/pkg/util"
...
...
@@ -112,15 +111,7 @@ func (s *SchedulerServer) AddFlags(fs *pflag.FlagSet) {
// Run runs the specified SchedulerServer. This should never exit.
func
(
s
*
SchedulerServer
)
Run
(
_
[]
string
)
error
{
if
s
.
Kubeconfig
==
""
&&
s
.
Master
==
""
{
glog
.
Warningf
(
"Neither --kubeconfig nor --master was specified. Using default API client. This might not work."
)
}
// This creates a client, first loading any specified kubeconfig
// file, and then overriding the Master flag, if non-empty.
kubeconfig
,
err
:=
clientcmd
.
NewNonInteractiveDeferredLoadingClientConfig
(
&
clientcmd
.
ClientConfigLoadingRules
{
ExplicitPath
:
s
.
Kubeconfig
},
&
clientcmd
.
ConfigOverrides
{
ClusterInfo
:
clientcmdapi
.
Cluster
{
Server
:
s
.
Master
}})
.
ClientConfig
()
kubeconfig
,
err
:=
clientcmd
.
BuildConfigFromFlags
(
s
.
Master
,
s
.
Kubeconfig
)
if
err
!=
nil
{
return
err
}
...
...
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