Skip to content

Commit

Permalink
feat: add filters parameter to client API (#96)
Browse files Browse the repository at this point in the history
* feat: add filters parameter to client API

The commit introduces a new feature to the client API by adding the filters parameter. This enhancement allows clients to specify filters during API calls, enabling more specific analysis based on the provided filters. This feature improves the flexibility and customization options available to clients using the API.

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

* feat: update yaml example

Signed-off-by: Matthis Holleville <matthish29@gmail.com>

---------

Signed-off-by: Matthis Holleville <matthish29@gmail.com>
  • Loading branch information
matthisholleville committed May 14, 2023
1 parent e228349 commit 6c41ac5
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 7 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ spec:
noCache: false
version: v0.3.0
enableAI: true
# filters:
# - Ingress
secret:
name: k8sgpt-sample-secret
key: openai-api-key
Expand Down
1 change: 1 addition & 0 deletions api/v1alpha1/k8sgpt_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ type K8sGPTSpec struct {
Version string `json:"version,omitempty"`
EnableAI bool `json:"enableAI,omitempty"`
NoCache bool `json:"noCache,omitempty"`
Filters []string `json:"filters,omitempty"`
}

// K8sGPTStatus defines the observed state of K8sGPT
Expand Down
5 changes: 5 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions config/crd/bases/core.k8sgpt.ai_k8sgpts.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ spec:
type: boolean
engine:
type: string
filters:
items:
type: string
type: array
model:
default: gpt-3.5-turbo
type: string
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ module github.com/k8sgpt-ai/k8sgpt-operator
go 1.19

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
github.com/onsi/ginkgo/v2 v2.9.4
github.com/onsi/gomega v1.27.6
github.com/prometheus/client_golang v1.15.1
Expand Down
10 changes: 5 additions & 5 deletions go.sum
Original file line number Diff line number Diff line change
@@ -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=
Expand Down
1 change: 1 addition & 0 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ func (c *Client) ProcessAnalysis(deployment v1.Deployment, config *v1alpha1.K8sG
Explain: config.Spec.EnableAI,
Nocache: config.Spec.NoCache,
Backend: config.Spec.Backend,
Filters: config.Spec.Filters,
}

res, err := client.Analyze(context.Background(), req)
Expand Down

0 comments on commit 6c41ac5

Please sign in to comment.