Remove cri v1alpha1 services

Signed-off-by: Iceber Gu <wei.cai-nat@daocloud.io>
This commit is contained in:
Iceber Gu 2023-03-16 10:48:35 +08:00
parent e735405c15
commit c011502bd1
9 changed files with 2 additions and 1197 deletions

View File

@ -378,7 +378,7 @@ The deprecated features are shown in the following table:
| Container label `containerd.io/restart.logpath` | containerd v1.5 | containerd v2.0 ✅ | Use `containerd.io/restart.loguri` label |
| `cri-containerd-*.tar.gz` release bundles | containerd v1.6 | containerd v2.0 | Use `containerd-*.tar.gz` bundles |
| Pulling Schema 1 images (`application/vnd.docker.distribution.manifest.v1+json`) | containerd v1.7 | containerd v2.0 | Use Schema 2 or OCI images |
| CRI `v1alpha2` | containerd v1.7 | containerd v2.0 | Use CRI `v1` |
| CRI `v1alpha2` | containerd v1.7 | containerd v2.0 | Use CRI `v1` |
### Deprecated config properties
The deprecated properties in [`config.toml`](./docs/cri/config.md) are shown in the following table:

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"
@ -341,11 +340,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"
@ -319,11 +318,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
}