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

Refactoring of "get instances" CLI command #553

Merged
merged 7 commits into from
Jul 11, 2019
Merged

Conversation

fabianbaier
Copy link
Member

What type of PR is this?

Uncomment only one /kind <> line, hit enter to put that in a new line, and remove leading whitespaces from that line:

/component kudoctl

What this PR does / why we need it:

This PR refactors the kubectl kudo get instances command. We are moving away from the dynamicClient for listing Instances and start using our own KUDO client similar to the install command.

Which issue(s) this PR fixes:

Fixes #548

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@fabianbaier fabianbaier added the component/cli kubectl kudo a.k.a. kudoctl label Jul 11, 2019
@fabianbaier fabianbaier added this to the v0.4.0 milestone Jul 11, 2019
Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

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

I think I am a bit confused around some parts of the PR as a lot seems like a dead code to me 🤔 either I am not understanding the purpose of this or we copy-pasted a lot from install?

pkg/kudoctl/cmd/get.go Outdated Show resolved Hide resolved
)

// Options defines configuration options for the install command
type Options struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

is this copy-paste error? How is skipInstance relevant to get instances? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

I wouldn't call it that. More good intensions to make parts of the CLI following same patterns/look alike.

@fabianbaier
Copy link
Member Author

I think I am a bit confused around some parts of the PR as a lot seems like a dead code to me 🤔 either I am not understanding the purpose of this or we copy-pasted a lot from install?

The purpose of this is and was intended to bring the get command back in sync with the rest of the CLI. I see a lot of changes we made that haven't been made to the get part itself. E.g. we use no longer the dynamicClient, we follow a certain pattern in install (I use btw install as the gold standard for other components in the CLI and think we should use similar patterns to make the code look more homogenous).

There is also the lack of testing in get that I tried to kick off and start fixing.

Overall, I am more interested in creating patterns within our CLI, like using the Options struct within each command, having same patterns for parsing of parameters or validation of arguments before we go into more business logic that lives in private functions. Then standardizing in each component the error handling and log output, maybe with having -o yaml as option and so on. How do we get there, I don't know. I just would like to get there. Thought this PR would be the first step towards those goal.

@jbarrick-mesosphere
Copy link
Member

I'm all for making this more testable 👍

Copy link
Contributor

@alenkacz alenkacz left a comment

Choose a reason for hiding this comment

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

Yeah, now it makes sense, when you removed the options that don't make sense for get instances and were just taken over from install.

Now one last copy-pasted line, if we remove that it's good to go :) YAY

pkg/kudoctl/cmd/get.go Outdated Show resolved Hide resolved
Copy link
Member

@kensipe kensipe left a comment

Choose a reason for hiding this comment

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

lgtm

@fabianbaier fabianbaier merged commit 66b4240 into master Jul 11, 2019
@fabianbaier fabianbaier deleted the fb/get-instances-fix branch July 11, 2019 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/cli kubectl kudo a.k.a. kudoctl
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI failed to find kubeconfig when kubectl kudo get instances is run
4 participants