[X] I've searched for similar issues and couldn't find anything matching
[X] I've included steps to reproduce the behavior
Affected Components
[X] K8sGPT (CLI)
[ ] K8sGPT Operator
K8sGPT Version
0.3.37
Kubernetes Version
n/a
Host OS and its Version
Mac
Steps to reproduce
Add amazonbedrock as backend with k8sgpt auth
Run k8sgpt serve
Expected behaviour
1) Panic should not hide the actual error
2) Fail fast with descriptive error for missing --backend, -b flag with non-default (openai) backend configurations.
3) Document to avoid invalid flag-configuration combinations
Note that multiple calls to a nil reference along the k8sgpt serve scenaio exist.
Try for example:
1) Run k8sgpt serve -b amazonbedrock
2) Query with grpcurl -plaintext -d '{"explain": true, "namespace": "k8sgpt"}' localhost:8080 schema.v1.ServerService/Analyze (note the missing backend parameter in the query)
query output:
ERROR:
Code: Unavailable
Message: error reading from server: EOF
The problem is at pkg/server/analyze.go where the config instance is nil due to an error yielded by the previous statement.
Following the idiomatic error handling in go should solve the problem.
Checklist
Affected Components
K8sGPT Version
0.3.37
Kubernetes Version
n/a
Host OS and its Version
Mac
Steps to reproduce
k8sgpt auth
k8sgpt serve
Expected behaviour
1) Panic should not hide the actual error 2) Fail fast with descriptive error for missing
--backend, -b
flag with non-default (openai) backend configurations. 3) Document to avoid invalid flag-configuration combinationsActual behaviour
Additional Information
configuration:
Note that multiple calls to a nil reference along the
k8sgpt serve
scenaio exist.Try for example: 1) Run
k8sgpt serve -b amazonbedrock
2) Query withgrpcurl -plaintext -d '{"explain": true, "namespace": "k8sgpt"}' localhost:8080 schema.v1.ServerService/Analyze
(note the missing backend parameter in the query)query output:
server output:
The problem is at pkg/server/analyze.go where the
config
instance is nil due to an error yielded by the previous statement.Following the idiomatic error handling in go should solve the problem.