Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat!: migrate api to grpc #386

Merged
merged 4 commits into from
May 9, 2023

Conversation

matthisholleville
Copy link
Contributor

@matthisholleville matthisholleville commented May 6, 2023

Closes #380

πŸ“‘ Description

This PR migrates the k8sgpt AI API from REST to gRPC, which provides a more efficient and scalable communication protocol. The protobuf files are located in the buf.build repository at https://buf.build/k8sgpt-ai/k8sgpt. The new gRPC implementation provides improved performance and reliability, while also enabling easier integration with other gRPC-based services.

βœ… Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

β„Ή Additional Information

Log format :

(matthisholleville) ➜  k8sgpt git:(feat/grpc-api) βœ— go run main.go serve
{"level":"info","ts":1683377823.995384,"caller":"server/server.go:83","msg":"binding metrics to 8081"}
{"level":"info","ts":1683377823.9956539,"caller":"server/server.go:68","msg":"binding api to 8080"}
{"level":"info","ts":1683377830.462864,"caller":"server/log.go:48","msg":"request completed","duration_ms":289,"method":"/schema.v1.Server/Analyze","request":"backend:\"openai\"  namespace:\"k8sgpt\"  max_concurrency:10  output:\"json\"","remote_addr":"[::1]:53589"}

Query with grpcurl

(matthisholleville) ➜  k8sgpt git:(feat/grpc-api) βœ— grpcurl -plaintext -d '{"namespace": "k8sgpt"}' localhost:8080 schema.v1.Server/Analyze

{
  "errors": [
    "[CronJob] test"
  ],
  "status": "ProblemDetected",
  "problems": 1,
  "results": [
    {
      "kind": "HorizontalPodAutoscaler",
      "name": "k8sgpt/fake-hpa",
      "error": [
        {
          "text": "HorizontalPodAutoscaler uses StatefulSet/fake-deployment as ScaleTargetRef which does not exist.",
          "sensitive": [
            {
              "unmasked": "fake-deployment",
              "masked": "YnZ4TCgjMlktODs2ZyM4"
            }
          ]
        }
      ]
    }
  ]
}

Signed-off-by: Matthis Holleville <matthish29@gmail.com>
@matthisholleville matthisholleville requested review from a team as code owners May 6, 2023 13:06
@matthisholleville matthisholleville changed the title feat: migrate api to grpc !feat: migrate api to grpc May 6, 2023
@matthisholleville matthisholleville changed the title !feat: migrate api to grpc feat!: migrate api to grpc May 6, 2023
numanjatt
numanjatt previously approved these changes May 6, 2023
Copy link

@Aisuko Aisuko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thanks for your contribution. Please take a look at the suggestions.

pkg/server/log.go Outdated Show resolved Hide resolved
pkg/server/log.go Outdated Show resolved Hide resolved
Signed-off-by: Matthis Holleville <matthish29@gmail.com>
@AlexsJones AlexsJones merged commit 9998e76 into k8sgpt-ai:main May 9, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

ROADMAP: GRPC server implementation
4 participants