Skip to content

Use InClusterConfig when CreateKubeClient() was called without args#293

Merged
mogren merged 1 commit intoaws:masterfrom
nak3:flagerror
Jan 21, 2019
Merged

Use InClusterConfig when CreateKubeClient() was called without args#293
mogren merged 1 commit intoaws:masterfrom
nak3:flagerror

Conversation

@nak3
Copy link
Copy Markdown
Contributor

@nak3 nak3 commented Jan 19, 2019

When BuildConfigFromFlags(apiserver, kubeconfig) was called with
empty apiserver and kubeconfig, it fallbacks to
rest.InClusterConfig(). When it happened, amazon-k8s-agent outputs
following error/warning message.

ERROR: logging before flag.Parse: W1217 10:37:25.707719      13 client_config.go:533] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.

Although this error is harmless, it causes some confusion.

Hence this patch changes to use InClusterConfig() when
BuildConfigFromFlags was called with empty args.

P.S logging before flag.Parse is also solved by this patch, as glog
is not called.

Fixes #270

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

When `BuildConfigFromFlags(apiserver, kubeconfig)` was called with
empty apiserver and kubeconfig, it fallback to
rest.InClusterConfig(). When it happened, amazon-k8s-agent outputs
following warning message.

```
ERROR: logging before flag.Parse: W1217 10:37:25.707719      13 client_config.go:533] Neither --kubeconfig nor --master was specified.  Using the inClusterConfig.  This might not work.
```

Although this error is harmless, it causes some confusion.

This patch changes to use `InClusterConfig()` when
`BuildConfigFromFlags` was called with empty args.

P.S `logging before flag.Parse` is also gone by this patch, as glog
is not called.
Copy link
Copy Markdown
Contributor

@mogren mogren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this. 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants