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

question: -o json is not returning an entire json structure for some cases #325

Closed
3 tasks done
danilopo opened this issue Apr 25, 2023 · 6 comments · Fixed by #368
Closed
3 tasks done

question: -o json is not returning an entire json structure for some cases #325

danilopo opened this issue Apr 25, 2023 · 6 comments · Fixed by #368
Assignees
Labels
enhancement New feature or request

Comments

@danilopo
Copy link

Checklist:

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the bug.
  • I've included the version of Kubernetes and k8sgpt.

Subject of the issue

Run the comand ./k8sgpt analyze --explain -o json is returning json and text (not just json)

Your environment

Local macbook M2, MacOS, docker, gcp cluster

  • Version of Kubernetes
    v1.26.1
  • Host OS and its version / If windows, is it WSL?
    Mac OS
  • Version of k8sgpt
    v0.2.4

Steps to reproduce

  • Step 1
    Create a cluster in gcp
  • Step 2
    Run analyze using -o json option

Expected behaviour

The system should return a json estructure

Actual behaviour

the system is returning, text lines out of json broking the json dumps

Additional context / screenshots

The problem is here

color.Yellow("Service %s/%s does not exist", ep.Namespace, ep.Name)

The system is returning the line with the text instead add in the failure array together other failures, the byte stream returned both text and the json so is impossible to convert in a right key value structure

@matthisholleville
Copy link
Contributor

matthisholleville commented Apr 25, 2023

Thank you for your feedback. You are right, it would be interesting to rework the output format, especially in case of errors. Maybe you would like to contribute?

@PalAditya
Copy link

Hi, I can help contribute to this if that's okay. Would the scope be the output mentioned in this issue only, or across the codebase?

@matthisholleville
Copy link
Contributor

Sure ! Go ahead !

@AlexsJones
Copy link
Member

How are you getting on with this @PalAditya ?

@PalAditya
Copy link

@AlexsJones - Thanks for asking. Actually, the refactor seems to be more complex than I initially thought, so it won't be quick and my vacation finishes today as well. I don't think I will be able to contribute effectively to this at this point, so please feel unassign me as of now so that someone else can pick it up if they want.

@matthisholleville
Copy link
Contributor

I'll start working on it tomorrow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants