k8sgpt
k8sgpt copied to clipboard
[Bug]: Trivy Analyzer has concurrent map write issue
Checklist
- [X] I've searched for similar issues and couldn't find anything matching
- [X] I've included steps to reproduce the behavior
Affected Components
- [X] K8sGPT (CLI)
- [ ] K8sGPT Operator
K8sGPT Version
No response
Kubernetes Version
No response
Host OS and its Version
No response
Steps to reproduce
- Enable Trivy
- Install a KIND Cluster and enabled argocd
- Run alanlyzer
k8sgpt integrations activate trivy k8sgpt analyze
Then it failed with below error:
fatal error: concurrent map writes fatal error: concurrent map writes
goroutine 48 [running]:
k8s.io/apimachinery/pkg/runtime.(*Scheme).AddKnownTypeWithName(0xc00056dd50, {{0x10a763d15, 0x16}, {0x10a7379e5, 0x8}, {0x10aff49c3, 0x1c}}, {0x10b91fcd0, 0xc0005741c0}) /Users/test/go/pkg/mod/k8s.io/[email protected]/pkg/runtime/scheme.go:174 +0x2eb k8s.io/apimachinery/pkg/runtime.(*Scheme).AddKnownTypes(0xc00056dd50, {{0x10a763d15, 0x16}, {0x10a7379e5, 0x8}}, {0xc000eb3b40, 0x16, 0x16}) /Users/test/go/pkg/mod/k8s.io/[email protected]/pkg/runtime/scheme.go:148 +0x2af github.com/aquasecurity/trivy-operator/pkg/apis/aquasecurity/v1alpha1.addKnownTypes(0xc00056dd50) /Users/test/go/pkg/mod/github.com/aquasecurity/[email protected]/pkg/apis/aquasecurity/v1alpha1/register.go:22 +0x12b0 k8s.io/apimachinery/pkg/runtime.(*SchemeBuilder).AddToScheme(0x10d32c040, 0xc00056dd50) /Users/test/go/pkg/mod/k8s.io/[email protected]/pkg/runtime/scheme_builder.go:29 +0x82 github.com/k8sgpt-ai/k8sgpt/pkg/integration/trivy.TrivyAnalyzer.analyzeVulnerabilityReports({0x1, 0x0}, {0xc00087d440, {0x10b9365d0, 0x10d3b4d88}, {0x0, 0x0}, {0x0, 0x0}, 0x0, ...}) /Users/test/A10/k8sgpt/pkg/integration/trivy/analyzer.go:43 +0x102 github.com/k8sgpt-ai/k8sgpt/pkg/integration/trivy.TrivyAnalyzer.Analyze({0x1, 0x0}, {0xc00087d440, {0x10b9365d0, 0x10d3b4d88}, {0x0, 0x0}, {0x0, 0x0}, 0x0, ...}) /Users/test/A10/k8sgpt/pkg/integration/trivy/analyzer.go:161 +0xbe github.com/k8sgpt-ai/k8sgpt/pkg/analysis.(*Analysis).RunAnalysis.func3({0x10b903e80, 0xc000d2721a}, {0xc001494060, 0x13})
/Users/test/A10/k8sgpt/pkg/analysis/analysis.go:271 +0x155
created by github.com/k8sgpt-ai/k8sgpt/pkg/analysis.(*Analysis).RunAnalysis in goroutine 1 /Users/test/A10/k8sgpt/pkg/analysis/analysis.go:269 +0xb74
Expected behaviour
no concurrent map write fatal error.
Actual behaviour
fatal error
Additional Information
No response