-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore(deps): update actions/setup-go digest to 93397be (#194) Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * feat: remote config rework wip Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * feat: updating readme and secret env vars Signed-off-by: Alex Jones <alexsimonjones@gmail.com> * feat: updating readme and secret env vars Signed-off-by: Alex Jones <alexsimonjones@gmail.com> --------- Signed-off-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Signed-off-by: Alex Jones <alexsimonjones@gmail.com> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
- Loading branch information
1 parent
d01b5a9
commit 44e7c6b
Showing
13 changed files
with
256 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package client | ||
|
||
import ( | ||
"context" | ||
"encoding/json" | ||
"fmt" | ||
|
||
rpc "buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go/schema/v1/schemav1grpc" | ||
schemav1 "buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go/schema/v1" | ||
"github.com/k8sgpt-ai/k8sgpt-operator/api/v1alpha1" | ||
"github.com/k8sgpt-ai/k8sgpt-operator/pkg/common" | ||
v1 "k8s.io/api/apps/v1" | ||
) | ||
|
||
func (c *Client) ProcessAnalysis(deployment v1.Deployment, config *v1alpha1.K8sGPT) (*common.K8sGPTReponse, error) { | ||
|
||
client := rpc.NewServerServiceClient(c.conn) | ||
req := &schemav1.AnalyzeRequest{ | ||
Explain: config.Spec.AI.Enabled, | ||
Nocache: config.Spec.NoCache, | ||
Backend: config.Spec.AI.Backend, | ||
Filters: config.Spec.Filters, | ||
Anonymize: config.Spec.AI.Anonymize, | ||
Language: config.Spec.AI.Language, | ||
} | ||
|
||
res, err := client.Analyze(context.Background(), req) | ||
if err != nil { | ||
return nil, fmt.Errorf("failed to call Analyze RPC: %v", err) | ||
} | ||
|
||
var target []v1alpha1.ResultSpec | ||
|
||
jsonBytes, err := json.Marshal(res.Results) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
err = json.Unmarshal(jsonBytes, &target) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
response := &common.K8sGPTReponse{ | ||
Status: res.Status, | ||
Results: target, | ||
Problems: int(res.Problems), | ||
} | ||
return response, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.