Merge pull request #8276 from Iceber/remove_cri_v1alpha2

Remove CRI v1alpha2 [deprecated since v1.7]
This commit is contained in:
Fu Wei
2023-03-22 13:25:07 +08:00
committed by GitHub
17 changed files with 142 additions and 16032 deletions

View File

@@ -21,6 +21,4 @@ const (
K8sContainerdNamespace = "k8s.io"
// CRIVersion is the latest CRI version supported by the CRI plugin.
CRIVersion = "v1"
// CRIVersionAlpha is the alpha version of CRI supported by the CRI plugin.
CRIVersionAlpha = "v1alpha2"
)

View File

@@ -56,7 +56,7 @@ func init() {
func initCRIService(ic *plugin.InitContext) (interface{}, error) {
ic.Meta.Platforms = []imagespec.Platform{platforms.DefaultSpec()}
ic.Meta.Exports = map[string]string{"CRIVersion": constants.CRIVersion, "CRIVersionAlpha": constants.CRIVersionAlpha}
ic.Meta.Exports = map[string]string{"CRIVersion": constants.CRIVersion}
ctx := ic.Context
pluginConfig := ic.Config.(*criconfig.PluginConfig)
if err := criconfig.ValidatePluginConfig(ctx, pluginConfig); err != nil {

File diff suppressed because it is too large Load Diff

View File

@@ -36,7 +36,6 @@ import (
"github.com/containerd/containerd/pkg/kmutex"
"github.com/containerd/containerd/plugin"
"github.com/containerd/containerd/sandbox"
runtime_alpha "github.com/containerd/containerd/third_party/k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
"github.com/containerd/go-cni"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
@@ -348,11 +347,6 @@ func (c *criService) register(s *grpc.Server) error {
instrumented := instrument.NewService(c)
runtime.RegisterRuntimeServiceServer(s, instrumented)
runtime.RegisterImageServiceServer(s, instrumented)
instrumentedAlpha := instrument.NewAlphaService(c)
runtime_alpha.RegisterRuntimeServiceServer(s, instrumentedAlpha)
runtime_alpha.RegisterImageServiceServer(s, instrumentedAlpha)
return nil
}

View File

@@ -19,7 +19,6 @@ package sbserver
import (
"context"
runtime_alpha "github.com/containerd/containerd/third_party/k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
"github.com/containerd/containerd/version"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
@@ -42,13 +41,3 @@ func (c *criService) Version(ctx context.Context, r *runtime.VersionRequest) (*r
RuntimeApiVersion: constants.CRIVersion,
}, nil
}
// Version returns the runtime name, runtime version and runtime API version.
func (c *criService) AlphaVersion(ctx context.Context, r *runtime_alpha.VersionRequest) (*runtime_alpha.VersionResponse, error) {
return &runtime_alpha.VersionResponse{
Version: kubeAPIVersion,
RuntimeName: containerName,
RuntimeVersion: version.Version,
RuntimeApiVersion: constants.CRIVersionAlpha,
}, nil
}

View File

@@ -33,7 +33,6 @@ import (
"github.com/containerd/containerd/pkg/cri/streaming"
"github.com/containerd/containerd/pkg/kmutex"
"github.com/containerd/containerd/plugin"
runtime_alpha "github.com/containerd/containerd/third_party/k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
cni "github.com/containerd/go-cni"
"github.com/sirupsen/logrus"
"google.golang.org/grpc"
@@ -326,11 +325,6 @@ func (c *criService) register(s *grpc.Server) error {
instrumented := instrument.NewService(c)
runtime.RegisterRuntimeServiceServer(s, instrumented)
runtime.RegisterImageServiceServer(s, instrumented)
instrumentedAlpha := instrument.NewAlphaService(c)
runtime_alpha.RegisterRuntimeServiceServer(s, instrumentedAlpha)
runtime_alpha.RegisterImageServiceServer(s, instrumentedAlpha)
return nil
}

View File

@@ -19,7 +19,6 @@ package server
import (
"context"
runtime_alpha "github.com/containerd/containerd/third_party/k8s.io/cri-api/pkg/apis/runtime/v1alpha2"
"github.com/containerd/containerd/version"
runtime "k8s.io/cri-api/pkg/apis/runtime/v1"
@@ -42,13 +41,3 @@ func (c *criService) Version(ctx context.Context, r *runtime.VersionRequest) (*r
RuntimeApiVersion: constants.CRIVersion,
}, nil
}
// Version returns the runtime name, runtime version and runtime API version.
func (c *criService) AlphaVersion(ctx context.Context, r *runtime_alpha.VersionRequest) (*runtime_alpha.VersionResponse, error) {
return &runtime_alpha.VersionResponse{
Version: kubeAPIVersion,
RuntimeName: containerName,
RuntimeVersion: version.Version,
RuntimeApiVersion: constants.CRIVersionAlpha,
}, nil
}

View File

@@ -1,52 +0,0 @@
/*
Copyright The containerd Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package util
import (
"github.com/containerd/containerd/protobuf/proto"
"google.golang.org/protobuf/reflect/protoreflect"
)
func AlphaReqToV1Req(
alphar protoreflect.ProtoMessage,
v1r interface{ Unmarshal(_ []byte) error },
) error {
p, err := proto.Marshal(alphar)
if err != nil {
return err
}
if err = v1r.Unmarshal(p); err != nil {
return err
}
return nil
}
func V1RespToAlphaResp(
v1res interface{ Marshal() ([]byte, error) },
alphares protoreflect.ProtoMessage,
) error {
p, err := v1res.Marshal()
if err != nil {
return err
}
if err = proto.Unmarshal(p, alphares); err != nil {
return err
}
return nil
}