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

✨ add GetConfigWithContext to retrieve a config with a specific context #489

Merged

Conversation

sbueringer
Copy link
Member

@sbueringer sbueringer commented Jun 14, 2019

This PR adds a new function to the config package. Before it was only possible to retrieve the current context of a kubeconfig file via GetConfig. Now there's an additional GetConfigWithContext where a specific context can be retrieved.

The advantage is when developing locally (run controllers via IDE) with a specified context, the controller is not dependent on whatever the current context is of the used kubeconfig file.

Fixes #479

@k8s-ci-robot
Copy link
Contributor

Welcome @sbueringer!

It looks like this is your first PR to kubernetes-sigs/controller-runtime 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/controller-runtime has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jun 14, 2019
@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 14, 2019
@sbueringer
Copy link
Member Author

/assign @DirectXMan12

@sbueringer
Copy link
Member Author

sbueringer commented Jun 16, 2019

@DirectXMan12 How do I fix the following build error? Couldn't find anything in the docs. dep ensure changes a lot in Gpkg.lock, go.mod & go.sum.

k8s.io/client-go/tools/clientcmd/api: imported or required, but missing from Gopkg.lock's input-imports
The command "GO111MODULE=on TRACE=1 ./hack/check-everything.sh" exited with 1.

EDIT: okay I fixed it by adding the line manually to Gopkg.locks then I tried hack/check-everything.sh and it worked (but it also lead to changes in go.mod & go.sum which I didn't checked in). What would have been the right/automated way to fix it?

@DirectXMan12
Copy link
Contributor

dep ensure --no-vendor should fix dep, and go mod tidy should fix go.mod.

@DirectXMan12
Copy link
Contributor

Can you add a bit more details to the PR message beyond just the fixes? It's useful when going through with git log.

@DirectXMan12
Copy link
Contributor

otherwise looks reasonable

@sbueringer
Copy link
Member Author

sbueringer commented Jun 19, 2019

Can you add a bit more details to the PR message beyond just the fixes? It's useful when going through with git log.

I added some more text here in the PR. The commit message itself already is: add GetConfigWithContext to retrieve a config with a specific context. Do I have to squash the fix gopkg check commit by myself or is that done by the automation?

EDIT: I squashed the commit by myself, but just out of curiosity for the next time. Is it done automatically?

@DirectXMan12
Copy link
Contributor

We don't automatically squash, no. It's up to the submitter to produce a chain of logical commits (we don't enforce 1 commit per PR -- we just prefer that each commit stands on its own).

@DirectXMan12
Copy link
Contributor

/lgtm
/approve

thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 28, 2019
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: DirectXMan12, sbueringer

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 28, 2019
@k8s-ci-robot k8s-ci-robot merged commit 4c81828 into kubernetes-sigs:master Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Helper to fetch config using a particular kubeconfig context
3 participants