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

[Bug]: --with-doc flag not working #816

Open
3 of 4 tasks
pavneeta opened this issue Dec 29, 2023 · 5 comments
Open
3 of 4 tasks

[Bug]: --with-doc flag not working #816

pavneeta opened this issue Dec 29, 2023 · 5 comments
Labels
on-hold question Further information is requested

Comments

@pavneeta
Copy link

Checklist

  • I've searched for similar issues and couldn't find anything matching
  • I've included steps to reproduce the behavior

Affected Components

  • K8sGPT (CLI)
  • K8sGPT Operator

K8sGPT Version

No response

Kubernetes Version

No response

Host OS and its Version

Ubunto 2204

Steps to reproduce

  1. Run k8sgpt analyze --explain --with-doc

  2. The output did not have any link or URL .

image

Expected behaviour

There should be a complete or short URl of the k8s docs being referenced for the recommendation or error message.

Actual behaviour

No link provided in the response

Additional Information

No response

@AlexsJones
Copy link
Member

@golgoth31 if I am correct, this actually just checks to see if there is an error from OpenAPIschema right? Do we think there needs to be some more work done to clarify what this command really does?

	// we get the openapi schema from the server only if required by the flag "with-doc"
	openapiSchema := &openapi_v2.Document{}
	if a.WithDoc {
		var openApiErr error

		openapiSchema, openApiErr = a.Client.Client.Discovery().OpenAPISchema()
		if openApiErr != nil {
			a.Errors = append(a.Errors, fmt.Sprintf("[KubernetesDoc] %s", openApiErr))
		}
	}

@AlexsJones AlexsJones added question Further information is requested on-hold labels Dec 29, 2023
@golgoth31
Copy link
Contributor

Hi @AlexsJones , The command you mention is the command to extract the full openapi schema from the target kubernetes cluster only if requested by the "with-doc" flag.

Unfortunatly, this is not used if not requested by an analyser. For exemple, the cronjob analyser:

If the nothing is found or the schema not parsed, the kubernetesDoc string is empty and the output is not shown https://github.com/k8sgpt-ai/k8sgpt/blob/main/pkg/analysis/output.go#L81

We have multiple ways to fix this:

  • always add a kubernetesDoc value to "not available"; replaced by the real value if found
  • update the documentation to say that nothing is displayed if not found

In a first run, I can add all the missing openapi parsing requests to the known objects.

Do you have any guide lines for the analysers writing, if yes, we schould add this part.

@VaibhavMalik4187
Copy link
Contributor

@AlexsJones Can I work on this issue?

@klmsathishkumar
Copy link

@VaibhavMalik4187 Any updates on the fix of this issue ?

@AlexsJones
Copy link
Member

@VaibhavMalik4187 was working on it @klmsathishkumar do you want to take it over?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
on-hold question Further information is requested
Projects
Status: Accepted
Development

No branches or pull requests

5 participants