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 --output parameter to plan status to allow json/yaml output #1634

Merged
merged 5 commits into from
Aug 10, 2020

Conversation

ANeumann82
Copy link
Member

Signed-off-by: Andreas Neumann aneumann@mesosphere.com

What this PR does / why we need it:

Add --output parameter to kudo plan status to allow json/yaml output instead of human readable format

Fixes #

Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Copy link
Contributor

@zen-dog zen-dog left a comment

Choose a reason for hiding this comment

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

One nit but otherwise lgtm

pkg/kudoctl/cmd/plan/plan_status.go Outdated Show resolved Hide resolved
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 would like to see a test here :) at least I can see how the output actually look like


var o []byte
if strings.ToLower(options.Output) == "yaml" {
o, err = yaml.Marshal(instance.Status)
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't we aim for something more user friendly then just serialized CRD status? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

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

That's a good question. I'm not sure what would be more user friendly though...

Copy link
Contributor

Choose a reason for hiding this comment

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

the rest of k8s simply outputs the resource yaml - why would we convert? I'd rather leave it as is

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 would like to see a test here :) at least I can see how the output actually look like

@alenkacz Added tests :) And ended up refactoring this quite a bit. The output for yaml/json plan status is still the instance.status though.

It might be a good idea to use a separate data structure so we don't break clients if we end up changing the instance.status....

Add json output for kudo init
Add tests for plan status with json/yaml output

Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
…pe is given

Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
Signed-off-by: Andreas Neumann <aneumann@mesosphere.com>
@alenkacz alenkacz self-requested a review August 7, 2020 13:10
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.

beautiful 🤟

@zen-dog zen-dog merged commit 8f8ce28 into main Aug 10, 2020
@zen-dog zen-dog deleted the an/formatted-plan-status branch August 10, 2020 16:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants