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

feat: Add --context flag to choose specific context from kubeconfig #1234

Merged
merged 7 commits into from
Feb 23, 2021

Conversation

dsimansk
Copy link
Contributor

@dsimansk dsimansk commented Feb 20, 2021

Description

I've noticed new comments on the issue and though it should be pretty straightforward and great addition to kn. Most of the changes are docs (in separate commit).

Changes

  • Add --context flag to choose specific context from kubeconfig

Reference

Fixes #925

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Feb 20, 2021
Copy link
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@dsimansk: 0 warnings.

In response to this:

Description

I've noticed new comments on the issue and though it should be pretty straightforward and great addition to kn. Most of the changes are docs (in separate commit).

Changes

  • Add --context flag to choose specific context from kubeconfig
  • Changelog entry TBD

Reference

Fixes #925

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 20, 2021
@rhuss
Copy link
Contributor

rhuss commented Feb 20, 2021

Let try to get this in for 0.21, too.

@@ -183,8 +188,8 @@ func (params *KnParams) GetClientConfig() (clientcmd.ClientConfig, error) {

paths := filepath.SplitList(params.KubeCfgPath)
if len(paths) > 1 {
return nil, fmt.Errorf("Can not find config file. '%s' looks like a path. "+
return nil, fmt.Errorf("can not find config file. '%s' looks like a path. "+
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Error messages are changed due to lint warning "Error string should not be capitalized or end with punctuation".

@dsimansk
Copy link
Contributor Author

/retest

 Error from server (InternalError): error when creating "https://storage.googleapis.com/knative-releases/eventing/previous/v0.20.0/eventing.yaml": Internal error occurred: failed calling webhook "config.webhook.eventing.knative.dev": Post https://eventing-webhook.knative-eventing.svc:443/config-validation?timeout=2s: no endpoints available for service "eventing-webhook"
Waiting until all pods in namespace knative-eventing are up......................................................................................................................................................

Copy link
Collaborator

@navidshaikh navidshaikh left a comment

Choose a reason for hiding this comment

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

/lgtm
/assign @rhuss
/hold

@knative-prow-robot knative-prow-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Feb 22, 2021
@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 22, 2021
Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

Looks good, I wonder whether we should also add --cluster like for kubectl in one go ?

Or should this be better done in a separate PR ?

Co-authored-by: Roland Huß <rhuss@redhat.com>
@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 22, 2021
@dsimansk
Copy link
Contributor Author

Looks good, I wonder whether we should also add --cluster like for kubectl in one go ?

Or should this be better done in a separate PR ?

Well, probably makes sense to add it together. I'll take a look right now.

@@ -17,9 +17,14 @@
|===
| | Description | PR

| 🎁
| Add `--context` and `--cluster` flags to choose specific context from kubeconfig
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I couldn't decide if that shouldn't be split to 2 entries per flag. Please let me know wdyt.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is fine

@knative-metrics-robot
Copy link

The following is the coverage report on the affected files.
Say /test pull-knative-client-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/kn/commands/types.go 51.6% 53.6% 2.1
pkg/kn/root/root.go 89.7% 90.2% 0.5

@dsimansk
Copy link
Contributor Author

Infra issue
/retest

Copy link
Contributor

@rhuss rhuss left a comment

Choose a reason for hiding this comment

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

thanks !

/lgtm
/unhold
/approve

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Feb 23, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: navidshaikh, rhuss

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

@knative-prow-robot knative-prow-robot merged commit 671ee22 into knative:master Feb 23, 2021
@dsimansk dsimansk deleted the pr/add-context-flag branch February 23, 2021 15:55
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. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

add support for --context flag like kubectl
5 participants