mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-21 19:01:49 +00:00
Check for all errors in CRI connection validation
We only have one CRI API (v1) to validate during the initial connection of the kubelet with the container runtime. Therefore we can now verify all kind of GRPC related issues. Fixes: https://github.com/kubernetes/kubernetes/issues/114956 Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
This commit is contained in:
parent
4c4d4ad0a4
commit
e89547d308
@ -25,9 +25,7 @@ import (
|
||||
"go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc"
|
||||
"go.opentelemetry.io/otel/trace"
|
||||
"google.golang.org/grpc"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/credentials/insecure"
|
||||
"google.golang.org/grpc/status"
|
||||
utilfeature "k8s.io/apiserver/pkg/util/feature"
|
||||
tracing "k8s.io/component-base/tracing"
|
||||
"k8s.io/klog/v2"
|
||||
@ -93,13 +91,11 @@ func (r *remoteImageService) validateServiceConnection(ctx context.Context, conn
|
||||
klog.V(4).InfoS("Validating the CRI v1 API image version")
|
||||
r.imageClient = runtimeapi.NewImageServiceClient(conn)
|
||||
|
||||
if _, err := r.imageClient.ImageFsInfo(ctx, &runtimeapi.ImageFsInfoRequest{}); err == nil {
|
||||
klog.V(2).InfoS("Validated CRI v1 image API")
|
||||
|
||||
} else if status.Code(err) == codes.Unimplemented {
|
||||
return fmt.Errorf("CRI v1 image API is not implemented for endpoint %q: %w", endpoint, err)
|
||||
if _, err := r.imageClient.ImageFsInfo(ctx, &runtimeapi.ImageFsInfoRequest{}); err != nil {
|
||||
return fmt.Errorf("validate CRI v1 image API for endpoint %q: %w", endpoint, err)
|
||||
}
|
||||
|
||||
klog.V(2).InfoS("Validated CRI v1 image API")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -117,13 +117,11 @@ func (r *remoteRuntimeService) validateServiceConnection(ctx context.Context, co
|
||||
klog.V(4).InfoS("Validating the CRI v1 API runtime version")
|
||||
r.runtimeClient = runtimeapi.NewRuntimeServiceClient(conn)
|
||||
|
||||
if _, err := r.runtimeClient.Version(ctx, &runtimeapi.VersionRequest{}); err == nil {
|
||||
klog.V(2).InfoS("Validated CRI v1 runtime API")
|
||||
|
||||
} else if status.Code(err) == codes.Unimplemented {
|
||||
return fmt.Errorf("CRI v1 runtime API is not implemented for endpoint %q: %w", endpoint, err)
|
||||
if _, err := r.runtimeClient.Version(ctx, &runtimeapi.VersionRequest{}); err != nil {
|
||||
return fmt.Errorf("validate CRI v1 runtime API for endpoint %q: %w", endpoint, err)
|
||||
}
|
||||
|
||||
klog.V(2).InfoS("Validated CRI v1 runtime API")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user