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

feat: added FailedMount event reason to get the failure in pod analyzer #883

Merged
merged 3 commits into from
Feb 1, 2024
Merged

feat: added FailedMount event reason to get the failure in pod analyzer #883

merged 3 commits into from
Feb 1, 2024

Conversation

lili-wan
Copy link
Contributor

@lili-wan lili-wan commented Jan 22, 2024

📑 Description

The FailedMount failure is a common Kubernetes issue when a engineer wants to attach volume to the pod. I was not be able to capture this pod event when I run analyzer with filter Pod. Therefore, I added the event reason FailedMount to be included in failure messages

Before:

./k8sgpt analyze --filter Pod --namespace  my-namespace
AI Provider: openai

No problems detected

After:

./k8sgpt analyze --filter Pod --namespace my-namespace
AI Provider: AI not used; --explain not set

0  my-namespace/efs-csi-app(efs-csi-app)
- Error: Unable to attach or mount volumes: unmounted volumes=[efs-storage], unattached volumes=[efs-storage kube-api-access-n44mc]: timed out waiting for the condition

✅ Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

ℹ Additional Information

@lili-wan lili-wan requested review from a team as code owners January 22, 2024 23:37
Signed-off-by: lwan3 <lili_wan@intuit.com>
@lili-wan
Copy link
Contributor Author

@AlexsJones Hi Alex, thanks for reviewing the PR, could you please trigger the workflow as well? I resolved the conflict and the pipeline got re-triggered, thanks

@lili-wan
Copy link
Contributor Author

@AlexsJones Hi Alex, looks like the linter failed with some other files

/home/runner/work/_temp/reviewdog-Lgzh1S/golangci-lint-1.55.2-linux-amd64/golangci-lint run --out-format line-number --timeout=120s
  pkg/analyzer/gateway_test.go:95:29: Error return value is not checked (errcheck)
  	apiextensionsv1.AddToScheme(scheme)
  	                           ^
  pkg/analyzer/gateway_test.go:127:16: Error return value is not checked (errcheck)
  	gtwapi.Install(scheme)
  	              ^
  pkg/analyzer/gateway_test.go:128:29: Error return value is not checked (errcheck)
  	apiextensionsv1.AddToScheme(scheme)
  	                           ^
  pkg/server/server_test.go:36:25: Error return value of `server_config.Shutdown` is not checked (errcheck)
  		server_config.Shutdown()
  		                      ^
  cmd/serve/serve.go:123:20: Error return value of `logger.Sync` is not checked (errcheck)
  		defer logger.Sync()
  		                 ^
  pkg/server/integration.go:40:6: ineffectual assignment to err (ineffassign)
  	var err error = status.Error(codes.OK, "")
  	    ^
  pkg/server/integration.go:127:8: ineffectual assignment to err (ineffassign)
  			in, err := integrationProvider.Get(i)
  			    ^
  pkg/server/server_test.go:31:3: SA2000: should call wg.Add(1) before starting the goroutine to avoid a race (staticcheck)
  		wg.Add(1)
  		^
  pkg/integration/prometheus/config_analyzer.go:1[95](https://github.com/k8sgpt-ai/k8sgpt/actions/runs/7629324462/job/20811494870?pr=883#step:3:100):34: SA1024: cutset contains duplicate characters (staticcheck)
  				path = strings.TrimLeft(arg, prometheusConfigFlag)
  				                             ^
  pkg/integration/prometheus/config_analyzer.go:1[98](https://github.com/k8sgpt-ai/k8sgpt/actions/runs/7629324462/job/20811494870?pr=883#step:3:103):34: SA[102](https://github.com/k8sgpt-ai/k8sgpt/actions/runs/7629324462/job/20811494870?pr=883#step:3:107)4: cutset contains duplicate characters (staticcheck)
  				path = strings.TrimLeft(arg, configReloaderConfigFlag)
  				                             ^
  pkg/analyzer/mutating_webhook.go:64:5: SA4006: this value of `failures` is never used (staticcheck)
  				failures = append(failures, common.Failure{
  				^
  pkg/analyzer/validating_webhook.go:62:5: SA4006: this value of `failures` is never used (staticcheck)
  				failures = append(failures, common.Failure{
  				^
  level=error msg="Timeout exceeded: try increasing it by passing --timeout option"

Not related to my changes, what's the recommendation steps here? thanks

@AlexsJones AlexsJones merged commit 78126b2 into k8sgpt-ai:main Feb 1, 2024
7 checks passed
@lili-wan lili-wan deleted the fail-mount branch February 6, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants