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

The patch command should not require a KUBECONFIG when using --local #523

Closed
juanvallejo opened this issue Aug 20, 2018 · 1 comment
Closed
Labels
sig/cli Categorizes an issue or PR as relevant to SIG CLI.

Comments

@juanvallejo
Copy link

The kubectl patch command currently fails when there is no kubeconfig present, no --config flag is provided, and --local is given:

# ensure no kubeconfig exists
$ rm ~/.kube/config
# run patch without hitting the server
$ kubectl patch /path/to/obj.yaml --local --type=json -o json
error: Missing or incomplete configuration info.  Please login or point to an existing, complete config file:

  1. Via the command-line flag --config
  2. Via the KUBECONFIG environment variable
  3. In your home directory as ~/.kube/config

To view or setup config directly use the 'config' command.

Since we are not hitting the server, no kubeconfig should be needed.
This error occurs here when attempting to retrieve a namespace in the command's Complete method.

We should be looking up the namespace much later in the command, and only if not running as --local.
We could consider adding a NamespaceFunc field to the command's options struct that is called when needed in the Run method.

cc @deads2k @soltysh
/sig cli

@k8s-ci-robot k8s-ci-robot added the sig/cli Categorizes an issue or PR as relevant to SIG CLI. label Aug 20, 2018
@soltysh
Copy link
Contributor

soltysh commented Aug 24, 2018

This is fixed in kubernetes/kubernetes#67399.

@soltysh soltysh closed this as completed Aug 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/cli Categorizes an issue or PR as relevant to SIG CLI.
Projects
None yet
Development

No branches or pull requests

3 participants