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 domain list command #3

Merged
merged 4 commits into from
Nov 11, 2020

Conversation

ZhuangYuZY
Copy link
Contributor

@ZhuangYuZY ZhuangYuZY commented Oct 16, 2020

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Oct 16, 2020
@knative-prow-robot
Copy link

Welcome @ZhuangYuZY! It looks like this is your first PR to knative-sandbox/kn-plugin-admin 🎉

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 16, 2020
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, this feature makes totally sense. Find my review comments below.

func DomainListHandlers(h hprinters.PrintHandler) {
kDomainColumnDefinitions := []metav1beta1.TableColumnDefinition{
{Name: "Custom-Domain", Type: "string", Description: "Name of Knative custom domain.", Priority: 1},
{Name: "Selector", Type: "string", Description: "Selector of the Knative custom domain.", Priority: 1},
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
{Name: "Selector", Type: "string", Description: "Selector of the Knative custom domain.", Priority: 1},
{Name: "Selector", Type: "string", Description: "Selector for Knative custom domains.", Priority: 1},

Copy link
Contributor Author

@ZhuangYuZY ZhuangYuZY Oct 26, 2020

Choose a reason for hiding this comment

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

agree, code changed. Thank you.

parts := strings.Split(strings.ReplaceAll(strings.TrimSpace(selector), ":", "="), "\n")
selectorForPrint := ""
for i, v := range parts {
if i == 0 && strings.Compare(v, "selector=") != 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe better use StartsWith instead of Compare ? Compare looks a bit strange in this context and is not easy to understand.

Copy link
Contributor

Choose a reason for hiding this comment

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

But maybe I just don't understand this special case for i=0. Could you please elaborate a bit on the reasoning for this handling ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Agree, code changed, and also add some comment. Thank you.

input string
output string
}{
{"normal case with one selector key value", "selector:\n key1: value1\n", "key1=value1; "},
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also trim the final ; + the trailing space ? I think this looks more streamlined

Copy link
Contributor Author

Choose a reason for hiding this comment

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

You are right. Code changed. Thank you.

pkg/command/domain/human_readable_flags.go Outdated Show resolved Hide resolved
@@ -0,0 +1,64 @@
// Copyright © 2019 The Knative Authors

Choose a reason for hiding this comment

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

@ZhuangYuZY I think the license should be 2020.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, code change.

Copy link

Choose a reason for hiding this comment

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

Hi @ZhuangYuZY , looks like this one is missed?

Copy link
Contributor Author

@ZhuangYuZY ZhuangYuZY Nov 3, 2020

Choose a reason for hiding this comment

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

Hi @zhanggbj , In Conversation, the file is outdated. Please check "Files changed" tab. I already made the change of 2019 --> 2020. Thank you.

@@ -0,0 +1,41 @@
// Copyright © 2019 The Knative Authors
//

Choose a reason for hiding this comment

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

Same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

agree, code changed. Thank you.

Copy link

Choose a reason for hiding this comment

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

Same as above.

Copy link
Contributor Author

@ZhuangYuZY ZhuangYuZY Nov 3, 2020

Choose a reason for hiding this comment

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

Hi @zhanggbj , In Conversation, the file is outdated. Please check "Files changed" tab. I already made the change of 2019 --> 2020. Thank you.

domainListFlags := flags.NewListPrintFlags(DomainListHandlers)
domainListCommand := &cobra.Command{
Use: "list",
Short: "List custom domain",

Choose a reason for hiding this comment

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

Same as above, I think we can use domain instead of custom domain here.

Copy link

Choose a reason for hiding this comment

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

How about this one, what do you think? Thanks!

Copy link
Contributor Author

@ZhuangYuZY ZhuangYuZY Nov 3, 2020

Choose a reason for hiding this comment

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

Hi @zhanggbj , In Conversation, the file is outdated. Please check "Files changed" tab. Thank you.

@zhanggbj
Copy link

@ZhuangYuZY Thanks for the PR! I just left some minor comments. Thanks!

@ZhuangYuZY
Copy link
Contributor Author

ZhuangYuZY commented Oct 23, 2020

Thank you all, I will address your comment next week.

@ZhuangYuZY
Copy link
Contributor Author

@rhuss and @zhanggbj thank you for your comments. All addressed.

@zhanggbj
Copy link

zhanggbj commented Nov 5, 2020

/approve
@ZhuangYuZY Thanks for the PR! Waiting for @rhuss if any further comments!

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 5, 2020

"github.com/spf13/cobra"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"knative.dev/client-contrib/plugins/admin/pkg"
Copy link

Choose a reason for hiding this comment

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

Hi @ZhuangYuZY
Same situation with this new issue #11, would you please help to update the import path, otherwise it will break. Thanks!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed. Thank you.

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
k8sfake "k8s.io/client-go/kubernetes/fake"
"knative.dev/client-contrib/plugins/admin/pkg"
Copy link

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed. Thank you.

"knative.dev/client-contrib/plugins/admin/pkg"
"knative.dev/client/pkg/util"

"knative.dev/client-contrib/plugins/admin/pkg/testutil"
Copy link

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed. Thank you.

@zhanggbj
Copy link

zhanggbj commented Nov 5, 2020

@ZhuangYuZY Sorry for requesting changes again, there's an issue filed today #11, would you please help to update the import path here? Thanks!

@ZhuangYuZY
Copy link
Contributor Author

@zhanggbj import path fixed. Thank you.

@knative-prow-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: zhanggbj, ZhuangYuZY

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

@zhanggbj
Copy link

/lgtm

@ZhuangYuZY Thanks for the PR! Merging it

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Nov 11, 2020
@knative-prow-robot knative-prow-robot merged commit 2092070 into knative-extensions:master Nov 11, 2020
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.

4 participants