mirror of
https://github.com/k8sgpt-ai/k8sgpt.git
synced 2025-09-07 10:11:08 +00:00
feat: filters api (#407)
* fix: stop execution after matching condition in RunAnalysis() The commit fixes the issue where the RunAnalysis() function continues execution even after matching a condition. The fix ensures that the execution stops at the end of the corresponding if statement, improving the control flow and preventing unnecessary processing. Signed-off-by: Matthis Holleville <matthish29@gmail.com> * feat: include filters parameter in AnalyzeRequest initialization The commit introduces a new feature where the filters parameter is included in the initialization of the AnalyzeRequest. This enhancement allows for more specific analysis by specifying filters during the analysis process. Signed-off-by: Matthis Holleville <matthish29@gmail.com> --------- Signed-off-by: Matthis Holleville <matthish29@gmail.com>
This commit is contained in:
4
go.mod
4
go.mod
@@ -24,8 +24,8 @@ require (
|
||||
require github.com/adrg/xdg v0.4.0
|
||||
|
||||
require (
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.3.0-20230506120742-576a6b5d0a86.1
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.28.1-20230510140658-54288a50e81c.4
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.3.0-20230514071713-3d78cb8bbc06.1
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.30.0-20230514071713-3d78cb8bbc06.1
|
||||
)
|
||||
|
||||
require (
|
||||
|
10
go.sum
10
go.sum
@@ -1,8 +1,8 @@
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.3.0-20230506120742-576a6b5d0a86.1 h1:PQaEhu0fgP6BP2WciRwe9ol9ChEyO7U/lCiHYlwYxRM=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.3.0-20230506120742-576a6b5d0a86.1/go.mod h1:hNUyDnPCFDSlQTEVED8xxZV0WXRcElFSM+LLLbP7zCQ=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.28.1-20230506120742-576a6b5d0a86.4/go.mod h1:i/s4ALHwKvjA1oGNKpoHg0FpEOTbufoOm/NdTE6YQAE=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.28.1-20230510140658-54288a50e81c.4 h1:gcv6/jWv+qlehnaqHIjppNqQiHojZDDvs+NOGkxAUq8=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.28.1-20230510140658-54288a50e81c.4/go.mod h1:i/s4ALHwKvjA1oGNKpoHg0FpEOTbufoOm/NdTE6YQAE=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.3.0-20230514071713-3d78cb8bbc06.1 h1:uu6has8/9E3yVp77PJ/uDsgqhJemqvdfxPFv+pwhQ8M=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.3.0-20230514071713-3d78cb8bbc06.1/go.mod h1:P+Ze553ll8pj8fJatVJw077ODiymvZXai4uayYu7e7M=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.28.1-20230514071713-3d78cb8bbc06.4/go.mod h1:i/s4ALHwKvjA1oGNKpoHg0FpEOTbufoOm/NdTE6YQAE=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.30.0-20230514071713-3d78cb8bbc06.1 h1:V43+hDZXo4WaGqGZjNfaL8ZcAEvhusckIC/JBD/msz0=
|
||||
buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.30.0-20230514071713-3d78cb8bbc06.1/go.mod h1:karV92RruD5davytOQq20lDyAqBnai8ajNolo98nu94=
|
||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
||||
cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU=
|
||||
|
@@ -152,6 +152,7 @@ func (a *Analysis) RunAnalysis() {
|
||||
|
||||
}
|
||||
wg.Wait()
|
||||
return
|
||||
}
|
||||
semaphore = make(chan struct{}, a.MaxConcurrency)
|
||||
// if the filters flag is specified
|
||||
@@ -180,6 +181,7 @@ func (a *Analysis) RunAnalysis() {
|
||||
}
|
||||
}
|
||||
wg.Wait()
|
||||
return
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
@@ -32,7 +32,7 @@ func (h *handler) Analyze(ctx context.Context, i *schemav1.AnalyzeRequest) (
|
||||
config, err := analysis.NewAnalysis(
|
||||
i.Backend,
|
||||
i.Language,
|
||||
[]string{},
|
||||
i.Filters,
|
||||
i.Namespace,
|
||||
i.Nocache,
|
||||
i.Explain,
|
||||
|
Reference in New Issue
Block a user