Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 21, 2019
Merged

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

merged 1 commit into from
Jan 21, 2019

Conversation

nak3
Copy link
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
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