From 6c01390c5e3a0e61d487357ba0e408b6da45178c Mon Sep 17 00:00:00 2001 From: Alex Jones Date: Thu, 15 Aug 2024 14:58:47 +0100 Subject: [PATCH] feat: supporting new schema refactor (#494) Signed-off-by: AlexsJones --- chart/operator/templates/k8sgpt-crd.yaml | 2 ++ go.mod | 6 ++++-- go.sum | 8 ++++++++ pkg/client/analysis.go | 2 +- pkg/client/config.go | 4 ++-- pkg/client/integration.go | 2 +- 6 files changed, 18 insertions(+), 6 deletions(-) diff --git a/chart/operator/templates/k8sgpt-crd.yaml b/chart/operator/templates/k8sgpt-crd.yaml index 252c0ea6..de2e36c0 100644 --- a/chart/operator/templates/k8sgpt-crd.yaml +++ b/chart/operator/templates/k8sgpt-crd.yaml @@ -212,3 +212,5 @@ status: plural: "" conditions: [] storedVersions: [] + + diff --git a/go.mod b/go.mod index 66f9ed3b..9351206e 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/k8sgpt-ai/k8sgpt-operator go 1.21 require ( - buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.4.0-20240406062209-1cc152efbf5c.1 - buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.34.2-20240720172138-1b9bcd834f17.2 + buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.5.1-20240807134501-ea98c104104d.1 + buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.34.2-20240807134501-ea98c104104d.2 github.com/onsi/ginkgo/v2 v2.19.1 github.com/onsi/gomega v1.34.0 github.com/prometheus/client_golang v1.19.1 @@ -25,6 +25,8 @@ require ( ) require ( + buf.build/gen/go/k8sgpt-ai/k8sgpt/connectrpc/go v1.16.2-20240807134501-ea98c104104d.1 // indirect + buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc-ecosystem/gateway/v2 v2.21.0-20240807134501-ea98c104104d.1 // indirect github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect github.com/MakeNowJust/heredoc v1.0.0 // indirect github.com/beorn7/perks v1.0.1 // indirect diff --git a/go.sum b/go.sum index 3e23715f..0292bd69 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,16 @@ +buf.build/gen/go/k8sgpt-ai/k8sgpt/connectrpc/go v1.16.2-20240807134501-ea98c104104d.1 h1:hA8myZHNZ/d5R4F5sNl3auXCbTZS7d9h0i2Gx2ERrMs= +buf.build/gen/go/k8sgpt-ai/k8sgpt/connectrpc/go v1.16.2-20240807134501-ea98c104104d.1/go.mod h1:mOKqBBRmen05DAepoy/4yOEyYINzsXTWLZV54U/mbEE= +buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc-ecosystem/gateway/v2 v2.21.0-20240807134501-ea98c104104d.1 h1:9N1IZQO0qFyb3x4HrDE8xNP0McvdVOn+5v16iN5m1P4= +buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc-ecosystem/gateway/v2 v2.21.0-20240807134501-ea98c104104d.1/go.mod h1:8XgN3APjjxe21HsGV4pb2cOgzItgDvhoGfOE+PTtLGU= buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.4.0-20240406062209-1cc152efbf5c.1 h1:LgzSBB4q8qpgOqpTJoUKEbsDMddSuMK/ccdCuyQkOV8= buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.4.0-20240406062209-1cc152efbf5c.1/go.mod h1:8O5QQzJX72VEsoGtQvjBYwA25KrvIN7unx+ahHfxPpc= +buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.5.1-20240807134501-ea98c104104d.1 h1:W/4o/wizyw9oBry0PRZFDH9i55u8MLxmODUSZHW7krU= +buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go v1.5.1-20240807134501-ea98c104104d.1/go.mod h1:cJGWJGXgaTTqiPaZAuQPvkjkxQCWoAlCWte3/ZrpU8s= buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.34.1-20240406062209-1cc152efbf5c.1/go.mod h1:qEarbrHjaZEQ5GeUH6XqSqqJMvtPwAGFpAc0nkSBzrQ= buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.34.2-20240720172138-1b9bcd834f17.2 h1:IGBeVvzzeoEl0Ck0uxWXIUn8/my/ZeBvQEIaXCLteOc= buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.34.2-20240720172138-1b9bcd834f17.2/go.mod h1:1wq1qVxvJkTEUQsF5/XjmhQYXYhbVoLSGhKnzS3ie54= +buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.34.2-20240807134501-ea98c104104d.2 h1:D3HPkRDfG1F4/yjNYTYkVgnh6aa1Fj14tiP5sBJ0pfA= +buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go v1.34.2-20240807134501-ea98c104104d.2/go.mod h1:1wq1qVxvJkTEUQsF5/XjmhQYXYhbVoLSGhKnzS3ie54= 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= diff --git a/pkg/client/analysis.go b/pkg/client/analysis.go index 01816fb3..a195985e 100644 --- a/pkg/client/analysis.go +++ b/pkg/client/analysis.go @@ -14,7 +14,7 @@ import ( func (c *Client) ProcessAnalysis(deployment v1.Deployment, config *v1alpha1.K8sGPT, allowAIRequest bool) (*common.K8sGPTReponse, error) { - client := rpc.NewServerServiceClient(c.conn) + client := rpc.NewServerAnalyzerServiceClient(c.conn) req := &schemav1.AnalyzeRequest{ Explain: config.Spec.AI.Enabled && allowAIRequest, Nocache: config.Spec.NoCache, diff --git a/pkg/client/config.go b/pkg/client/config.go index 5ca0db09..3a6b8363 100644 --- a/pkg/client/config.go +++ b/pkg/client/config.go @@ -11,7 +11,7 @@ import ( ) func (c *Client) AddConfig(config *v1alpha1.K8sGPT) error { - client := rpc.NewServerServiceClient(c.conn) + client := rpc.NewServerConfigServiceClient(c.conn) req := &schemav1.AddConfigRequest{} // If multiple caches are configured we pick S3 // which emulates the behaviour of K8sGPT cli @@ -66,7 +66,7 @@ func (c *Client) AddConfig(config *v1alpha1.K8sGPT) error { } func (c *Client) RemoveConfig(config *v1alpha1.K8sGPT) error { - client := rpc.NewServerServiceClient(c.conn) + client := rpc.NewServerConfigServiceClient(c.conn) req := &schemav1.RemoveConfigRequest{ Cache: &schemav1.Cache{}, Integrations: nil, diff --git a/pkg/client/integration.go b/pkg/client/integration.go index b1180d81..25e54548 100644 --- a/pkg/client/integration.go +++ b/pkg/client/integration.go @@ -12,7 +12,7 @@ import ( func (c *Client) AddIntegration(config *v1alpha1.K8sGPT) error { // Check if the integration is active already - client := rpc.NewServerServiceClient(c.conn) + client := rpc.NewServerConfigServiceClient(c.conn) req := &schemav1.ListIntegrationsRequest{} resp, err := client.ListIntegrations(context.Background(),