Skip to content

Commit

Permalink
Support CRI v1 and v1alpha2 at the same time
Browse files Browse the repository at this point in the history
The idea is to use intermediate internal types to be able to switch
between the `v1` and `v1alpha2` protocol versions. The kubelet selects
the correct version during connection establishment with the remote
runtime. `v1` is the preferred version, whereas `v1alpha2` is now being
deprecated.

Additional things done:

- Added APIVersion() to runtime service
- Add --cri-version kubelet configuration flag
- Move cri-api types from staging to internal

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
  • Loading branch information
saschagrunert committed Oct 28, 2021
1 parent 392de80 commit 668f3fc
Show file tree
Hide file tree
Showing 101 changed files with 7,982 additions and 1,103 deletions.
6 changes: 3 additions & 3 deletions cmd/kubemark/hollow-node.go
Expand Up @@ -25,8 +25,8 @@ import (

"github.com/spf13/cobra"
"github.com/spf13/pflag"
internalapi "k8s.io/cri-api/pkg/apis"
"k8s.io/klog/v2"
internalapi "k8s.io/kubernetes/pkg/kubelet/apis/cri"

v1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -228,14 +228,14 @@ func run(cmd *cobra.Command, config *hollowNodeConfig) error {
return fmt.Errorf("Failed to start fake runtime, error: %w", err)
}
defer fakeRemoteRuntime.Stop()
runtimeService, err := remote.NewRemoteRuntimeService(endpoint, 15*time.Second)
runtimeService, err := remote.NewRemoteRuntimeService(endpoint, 15*time.Second, "")
if err != nil {
return fmt.Errorf("Failed to init runtime service, error: %w", err)
}

var imageService internalapi.ImageManagerService = fakeRemoteRuntime.ImageService
if config.UseHostImageService {
imageService, err = remote.NewRemoteImageService(f.RemoteImageEndpoint, 15*time.Second)
imageService, err = remote.NewRemoteImageService(f.RemoteImageEndpoint, 15*time.Second, runtimeService.APIVersion())
if err != nil {
return fmt.Errorf("Failed to init image service, error: %w", err)
}
Expand Down

0 comments on commit 668f3fc

Please sign in to comment.