Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
k8s-vcl-reloader
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
uplex-varnish
k8s-vcl-reloader
Commits
6b6617e6
Commit
6b6617e6
authored
Dec 11, 2019
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use in-cluster config directly when config flags are not set.
Eliminates a warning message at startup.
parent
4ee9467e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
3 deletions
+11
-3
main.go
cmd/main.go
+11
-3
No files found.
cmd/main.go
View file @
6b6617e6
...
...
@@ -48,6 +48,7 @@ import (
api_v1
"k8s.io/api/core/v1"
"k8s.io/client-go/informers"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/tools/clientcmd"
)
...
...
@@ -245,9 +246,16 @@ func main() {
os
.
Exit
(
-
1
)
}
config
,
err
:=
clientcmd
.
BuildConfigFromFlags
(
*
masterURLF
,
*
kubeconfigF
)
if
err
!=
nil
{
log
.
Fatalf
(
"error creating client configuration: %v"
,
err
)
var
config
*
rest
.
Config
if
*
masterURLF
==
""
&&
*
kubeconfigF
==
""
{
if
config
,
err
=
rest
.
InClusterConfig
();
err
!=
nil
{
log
.
Fatalf
(
"error creating in-cluster config: %v"
,
err
)
}
}
else
if
config
,
err
=
clientcmd
.
BuildConfigFromFlags
(
*
masterURLF
,
*
kubeconfigF
);
err
!=
nil
{
log
.
Fatalf
(
"error creating client config from "
+
"masterURL=%s and kubeconfig=%s: %v"
,
*
masterURLF
,
*
kubeconfigF
,
err
)
}
kubeClient
,
err
:=
kubernetes
.
NewForConfig
(
config
)
if
err
!=
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