Crane is a FinOps Platform for Cloud Resource Analytics and Economics in Kubernetes clusters. The goal is not only to help users to manage cloud cost easier but also ensure the quality of applications.
Describe the bug
in current logic, crane-agent will connect the given runtimeEndpoint first if --runtime-endpoint args was given
var runtimeEndpoints []string
if runtimeEndpoint != "" {
runtimeEndpoints = append(runtimeEndpoints, runtimeEndpoint)
}
runtimeEndpoints = append(runtimeEndpoints, defaultRuntimeEndpoints...)
but in NewRemoteRuntimeService func, it will dial the socket in none-block mode, which will return success immediately even the runtimeEnpoint not exist
for _, endpoint := range runtimeEndpoints {
containerRuntime, err := criremote.NewRemoteRuntimeService(endpoint, 3*time.Second)
if err == nil {
return containerRuntime, nil
}
errs = append(errs, err)
}
Reproduce steps
set the crane-agent with none-existing runtime endpoint
--runtime-endpoint=unix:///var/run/none.sock
crane-agent panic with a bad runtimeService conn
Expected behavior
connect with the given runtime endpoint only
if no runtime endpoint given, try the default runtime-endpoint list one by one until found a real success one(by dial in block mode)
Screenshots
Environment (please complete the following information):
Describe the bug in current logic, crane-agent will connect the given runtimeEndpoint first if --runtime-endpoint args was given
but in
NewRemoteRuntimeService
func, it will dial the socket in none-block mode, which will return success immediately even the runtimeEnpoint not existReproduce steps
Environment (please complete the following information):