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]: Panic when analyzing ingress that has no paths (w suggested fix) #653

Closed
3 tasks done
testA113 opened this issue Sep 13, 2023 · 0 comments · Fixed by #726
Closed
3 tasks done

[Bug]: Panic when analyzing ingress that has no paths (w suggested fix) #653

testA113 opened this issue Sep 13, 2023 · 0 comments · Fixed by #726

Comments

@testA113
Copy link
Contributor

testA113 commented Sep 13, 2023

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 Version

v0.3.14

Kubernetes Version

v1.27

Host OS and its Version

MacOS 14 Sonoma

Steps to reproduce

  • Create a ingress that has no paths defined yet (this use case may arise when an expert wants to configure an ingress rule with annotations and TLS secrets, while leaving defining paths for services up to developers).
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: default-ingress-1
spec:
  ingressClassName: nginx
  rules:
  - host: asdf
  • Run k8sgpt analyze --filter Ingress

Expected behaviour

There should be a valid response with error message summaries or no errors.

Actual behaviour

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10410719c]

goroutine 27 [running]:
github.com/k8sgpt-ai/k8sgpt/pkg/analyzer.IngressAnalyzer.Analyze({}, {0x14000703710, {0x104f0bc18, 0x14000126018}, {0x0, 0x0}, {0x104f0c350, 0x106207020}, 0x0, {0x0, ...}, ...})
	/home/runner/work/k8sgpt/k8sgpt/pkg/analyzer/ingress.go:102 +0xc3c
github.com/k8sgpt-ai/k8sgpt/pkg/analysis.(*Analysis).RunAnalysis.func2({0x104eefca0?, 0x10624c6b8?}, {0x14000054240, 0x7})
	/home/runner/work/k8sgpt/k8sgpt/pkg/analysis/analysis.go:198 +0xc0
created by github.com/k8sgpt-ai/k8sgpt/pkg/analysis.(*Analysis).RunAnalysis
	/home/runner/work/k8sgpt/k8sgpt/pkg/analysis/analysis.go:196 +0x7c0

Additional Information

It could be worth checking if rule.HTTP != nil before looping through role.HTTP.Paths at k8sgpt/pkg/analyzer/ingress.go:102

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
1 participant