k8sgpt-ai / k8sgpt-operator

Automatic SRE Superpowers within your Kubernetes cluster
https://k8sgpt.ai
Apache License 2.0
300 stars 85 forks source link

[Feature]: Add minio remote cache support in the operator #464

Open arbreezy opened 2 months ago

arbreezy commented 2 months ago

Checklist

Is this feature request related to a problem?

None

Problem Description

No response

Solution Description

We have recently added Minio as another remote cache storage, to hold K8sGPT's findings.

In order to have feature parity, it will be great to add it in the operator's config as well

Benefits

Feature parity with K8sGPT

Potential Drawbacks

No response

Additional Information

There is already a GRPC proto schema to support minio S3-like api

and the original PR has included the server mode changes

chetak123 commented 1 week ago

I would like to take up this issue please,

Also I'm new to this operator ecosystem and trying to find my way, So I would be grateful if you could please point me what operator's config is.

aghilish commented 1 week ago

@arbreezy hey, I'm new to k8sgpt and would like to contribute to the operator of it.

I am currently working on this feature. I tried to use the S3_cache schema in pkg/client/config.go by using sth like

if config.Spec.RemoteCache.MinIO != nil {
            req.Cache = &schemav1.Cache{
                CacheType: &schemav1.Cache_S3Cache{
                    S3Cache: &schemav1.S3Cache{
                        BucketName: config.Spec.RemoteCache.MinIO.BucketName,
                        Endpoint:   config.Spec.RemoteCache.MinIO.Endpoint,
                    },
                },
            }
        }

But i get this error during reconciliation loop

Finished Reconciling k8sGPT with error: failed to call AddConfig RPC: rpc error: code = Unimplemented desc = unknown service schema.v1.ServerConfigService
2024-09-23T11:32:52Z    ERROR   Reconciler error    {"controller": "k8sgpt", "controllerGroup": "core.k8sgpt.ai", "controllerKind": "K8sGPT", "K8sGPT": {"name":"k8sgpt-sample","namespace":"k8sgpt-operator-system"}, "namespace": "k8sgpt-operator-system", "name": "k8sgpt-sample", "reconcileID": "d0a14f69-ad49-4dca-a546-aa83836069d4", "error": "failed to call AddConfig RPC: rpc error: code = Unimplemented desc = unknown service schema.v1.ServerConfigService"}
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).reconcileHandler
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:324
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).processNextWorkItem
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:265
sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller).Start.func2.2
    /go/pkg/mod/sigs.k8s.io/controller-runtime@v0.15.0/pkg/internal/controller/controller.go:226

does this require changing the schema/protobuf ? or changing the server implementation ?

@chetak123 I might be able to create a PR soon, you can have a look at changes and suggest improvements.

AlexsJones commented 1 week ago

Please make sure you pull the latest four SDK's that are part of the RPC stack https://buf.build/k8sgpt-ai/k8sgpt/sdks

Follow these instructions to get the generated SDK for k8sgpt-ai/k8sgpt at main using v1.34.2 of protocolbuffers/go.More details on Go SDKs go get buf.build/gen/go/k8sgpt-ai/k8sgpt/protocolbuffers/go@latest Copy to clipboard grpc/go

v1.5.1 Follow these instructions to get the generated SDK for k8sgpt-ai/k8sgpt at main using v1.5.1 of grpc/go.More details on Go SDKs go get buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc/go@latest Copy to clipboard connectrpc/go

v1.17.0 Follow these instructions to get the generated SDK for k8sgpt-ai/k8sgpt at main using v1.17.0 of connectrpc/go.More details on Go SDKs go get buf.build/gen/go/k8sgpt-ai/k8sgpt/connectrpc/go@latest Copy to clipboard grpc-ecosystem/gateway

v2.22.0 Follow these instructions to get the generated SDK for k8sgpt-ai/k8sgpt at main using v2.22.0 of grpc-ecosystem/gateway.More details on Go SDKs go get buf.build/gen/go/k8sgpt-ai/k8sgpt/grpc-ecosystem/gateway/v2@latest