Skip to content

Commit

Permalink
Add struct for unimplemented methods (#294)
Browse files Browse the repository at this point in the history
  • Loading branch information
nwneisen authored Jan 4, 2024
1 parent c50b98d commit 77b8604
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 34 deletions.
30 changes: 6 additions & 24 deletions core/docker_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,9 @@ func NewDockerService(
}

type dockerService struct {
// This handles unimplemented methods unless cri-dockerd overrides them
runtimeapi.UnimplementedRuntimeServiceServer

client libdocker.DockerClientInterface
os config.OSInterface
podSandboxImage string
Expand Down Expand Up @@ -287,6 +290,9 @@ type dockerService struct {

type dockerServiceAlpha struct {
ds DockerService

// This handles unimplemented methods unless cri-dockerd overrides them
runtimeapi_alpha.UnimplementedRuntimeServiceServer
}

func NewDockerServiceAlpha(ds DockerService) v1AlphaCRIService {
Expand Down Expand Up @@ -326,30 +332,6 @@ func (ds *dockerService) AlphaVersion(
}, nil
}

func (ds *dockerService) CheckpointContainer(context.Context, *runtimeapi.CheckpointContainerRequest) (*runtimeapi.CheckpointContainerResponse, error) {
return nil, fmt.Errorf("CheckpointContainer is not implemented")
}

func (ds *dockerService) GetContainerEvents(*runtimeapi.GetEventsRequest, runtimeapi.RuntimeService_GetContainerEventsServer) error {
return fmt.Errorf("GetContainerEvents is not implemented")
}

func (ds *dockerService) ListMetricDescriptors(context.Context, *runtimeapi.ListMetricDescriptorsRequest) (*runtimeapi.ListMetricDescriptorsResponse, error) {
return nil, fmt.Errorf("ListMetricDescriptors is not implemented")
}

func (ds *dockerService) ListPodSandboxMetrics(context.Context, *runtimeapi.ListPodSandboxMetricsRequest) (*runtimeapi.ListPodSandboxMetricsResponse, error) {
return nil, fmt.Errorf("ListPodSandboxMetrics is not implemented")
}

func (ds *dockerService) ListPodSandboxStats(context.Context, *runtimeapi.ListPodSandboxStatsRequest) (*runtimeapi.ListPodSandboxStatsResponse, error) {
return nil, fmt.Errorf("ListPodSandboxStats is not implemented")
}

func (ds *dockerService) PodSandboxStats(context.Context, *runtimeapi.PodSandboxStatsRequest) (*runtimeapi.PodSandboxStatsResponse, error) {
return nil, fmt.Errorf("PodSandboxStats is not implemented")
}

// getDockerVersion gets the version information from docker.
func (ds *dockerService) getDockerVersion() (*dockertypes.Version, error) {
res, err := ds.systemInfoCache.Memoize("docker_version", systemInfoCacheMinTTL, func() (interface{}, error) {
Expand Down
10 changes: 0 additions & 10 deletions core/service_alpha.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,10 @@ package core

import (
"context"
"fmt"

"github.com/Mirantis/cri-dockerd/config"
"github.com/Mirantis/cri-dockerd/utils"
v1 "k8s.io/cri-api/pkg/apis/runtime/v1"
"k8s.io/cri-api/v1alpha2/pkg/apis/runtime/v1alpha2"
runtimeapi_alpha "k8s.io/cri-api/v1alpha2/pkg/apis/runtime/v1alpha2"
)

Expand Down Expand Up @@ -604,11 +602,3 @@ func (as *dockerServiceAlpha) Version(
}
return nil, err
}

func (as *dockerServiceAlpha) ListPodSandboxStats(context.Context, *v1alpha2.ListPodSandboxStatsRequest) (*v1alpha2.ListPodSandboxStatsResponse, error) {
return nil, fmt.Errorf("ListPodSandboxStats is not implemented")
}

func (ds *dockerServiceAlpha) PodSandboxStats(context.Context, *v1alpha2.PodSandboxStatsRequest) (*v1alpha2.PodSandboxStatsResponse, error) {
return nil, fmt.Errorf("PodSandboxStats is not implemented")
}

0 comments on commit 77b8604

Please sign in to comment.