Change Version to return cri-containerd version instead.

Signed-off-by: Lantao Liu <lantaol@google.com>
This commit is contained in:
Lantao Liu
2017-10-07 00:47:51 +00:00
parent e77795b968
commit 09d7d652e6
4 changed files with 16 additions and 14 deletions

View File

@@ -17,14 +17,19 @@ limitations under the License.
package server
import (
"fmt"
"golang.org/x/net/context"
"k8s.io/kubernetes/pkg/kubelet/apis/cri/v1alpha1/runtime"
"github.com/kubernetes-incubator/cri-containerd/pkg/version"
)
const (
containerName = "containerd"
// For now, containerd and runc are bundled with cri-containerd, cri-containerd
// version is more important to us.
// TODO(random-liu): Figure out how to package cri-containerd and containerd,
// and how to version it. We still prefer calling the container runtime "containerd",
// but we care both the cri-containerd version and containerd version.
containerName = "cri-containerd"
containerdAPIVersion = "0.0.0"
// kubeAPIVersion is the api version of kubernetes.
kubeAPIVersion = "0.1.0"
@@ -32,14 +37,10 @@ const (
// Version returns the runtime name, runtime version and runtime API version.
func (c *criContainerdService) Version(ctx context.Context, r *runtime.VersionRequest) (*runtime.VersionResponse, error) {
resp, err := c.client.Version(ctx)
if err != nil {
return nil, fmt.Errorf("failed to get containerd version: %v", err)
}
return &runtime.VersionResponse{
Version: kubeAPIVersion,
RuntimeName: containerName,
RuntimeVersion: resp.Version,
RuntimeVersion: version.CRIContainerdVersion,
// Containerd doesn't have an api version now.
RuntimeApiVersion: containerdAPIVersion,
}, nil