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

support json response as cli output #37

Merged
merged 4 commits into from
Aug 31, 2023
Merged

Conversation

Yuni-sa
Copy link
Contributor

@Yuni-sa Yuni-sa commented Aug 29, 2023

to solve #35
@yonahd

@Yuni-sa
Copy link
Contributor Author

Yuni-sa commented Aug 29, 2023

only problem i've noticed when testing is that the json output for hpas is different when no unused hpas are found because of a difference in the JSON functions.

output for no unused hpas is:

{}

all other resources when there none unused return something like:

{
  "kor": {
    "Deployments": null
  }
}

refactoring the json outputs to one standard should probably be discussed in a different issue.

@Yuni-sa
Copy link
Contributor Author

Yuni-sa commented Aug 29, 2023

refactoring the json outputs to one standard should probably be discussed in a different issue.

also some returning null and some returning an empty array:

{
  "default": {
    "ConfigMap": [],
    "Deployment": null,
    "Hpa": null,
    "Ingress": [],
    "Pvc": [],
    "Role": [],
    "Secret": [],
    "Service": null,
    "ServiceAccount": [],
    "Statefulset": null
  }
}

@Yuni-sa
Copy link
Contributor Author

Yuni-sa commented Aug 29, 2023

I can also add fmt.Fprintf(os.Stderr, "Failed to process namespace %s: %v\n", namespace, err) to the cmd functions for better formatting.
@yonahd update me on what you think.

@yonahd
Copy link
Owner

yonahd commented Aug 30, 2023

only problem i've noticed when testing is that the json output for hpas is different when no unused hpas are found because of a difference in the JSON functions.

output for no unused hpas is:

{}

all other resources when there none unused return something like:

{
  "kor": {
    "Deployments": null
  }
}

refactoring the json outputs to one standard should probably be discussed in a different issue.

Won't this be cleaned up by the MR?

@yonahd
Copy link
Owner

yonahd commented Aug 30, 2023

I'll open an issue to align the json responses

@yonahd
Copy link
Owner

yonahd commented Aug 30, 2023

I can also add fmt.Fprintf(os.Stderr, "Failed to process namespace %s: %v\n", namespace, err) to the cmd functions for better formatting. @yonahd update me on what you think.

@Yuni-sa
You mean the tabular response command?

@yonahd
Copy link
Owner

yonahd commented Aug 30, 2023

@Yuni-sa would you like to add this to the MR or should I leave it as a separate issue? #44

@Yuni-sa
Copy link
Contributor Author

Yuni-sa commented Aug 31, 2023

Won't this be cleaned up by the MR?

no because only GetUnusedHpasJson() uses if len(diff) > 0 before adding the response to the map while all of the other json functions don't.

I think we should handle everything else in different issues and close this one.
@yonahd

@yonahd
Copy link
Owner

yonahd commented Aug 31, 2023

@Yuni-sa would you like to add this to the MR or should I leave it as a separate issue? #44

Keeping as separate issue

@Yuni-sa
Copy link
Contributor Author

Yuni-sa commented Aug 31, 2023

I'll open an issue to align the json responses

as this got closed by #39

@Yuni-sa would you like to add this to the MR or should I leave it as a separate issue? #44

and this is being handled by #44

@yonahd anything more I should fix/add for this pr to be reviewed and merged?

Copy link
Owner

@yonahd yonahd left a comment

Choose a reason for hiding this comment

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

LGTM

@yonahd yonahd merged commit 1e0a0a2 into yonahd:main Aug 31, 2023
@yonahd yonahd linked an issue Aug 31, 2023 that may be closed by this pull request
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.

kor doesn't output in JSON format
2 participants