Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce framwork of RuntimeManager and cri-proxy #105

Merged
merged 1 commit into from
Apr 28, 2022

Conversation

honpey
Copy link
Contributor

@honpey honpey commented Apr 28, 2022

Signed-off-by: pengyang.hpy honpey@gmail.com

Ⅰ. Describe what this PR does

Introduce framwork of RuntimeManager and cri-proxy

  1. framework of runtimemanager, including:
    server: intercept request from kubelet, and forward request to backend containerd/dockerd
    resource-executor: parse intercepted request, genereate request to hook server and do checkpoint
    dispatcher: mange hook server client and dispatch hook request to hook server

  2. cri-proxy
    part of 'server', intercept request from kubelet under containerd scenario

Ⅱ. Does this pull request fix one issue?

Ⅲ. Describe how to verify it

Ⅳ. Special notes for reviews

@codecov-commenter
Copy link

codecov-commenter commented Apr 28, 2022

Codecov Report

Merging #105 (e540cba) into main (1df5a76) will not change coverage.
The diff coverage is n/a.

❗ Current head e540cba differs from pull request most recent head f5c5d81. Consider uploading reports for the commit f5c5d81 to get more accurate results

@@           Coverage Diff           @@
##             main     #105   +/-   ##
=======================================
  Coverage   44.19%   44.19%           
=======================================
  Files          73       73           
  Lines        5965     5965           
=======================================
  Hits         2636     2636           
  Misses       3036     3036           
  Partials      293      293           
Flag Coverage Δ
unittests 44.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.


Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1df5a76...f5c5d81. Read the comment docs.

pkg/runtime-manager/dispatcher/dispatcher.go Outdated Show resolved Hide resolved
pkg/runtime-manager/dispatcher/dispatcher.go Outdated Show resolved Hide resolved
pkg/runtime-manager/server/cri/criserver.go Outdated Show resolved Hide resolved
pkg/runtime-manager/server/cri/criserver.go Outdated Show resolved Hide resolved
pkg/runtime-manager/dispatcher/dispatcher.go Show resolved Hide resolved
package utils

const (
DefaultRuntimeManagerSocketPath = "/var/run/runtimemanger/runtimemanager.sock"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add TODO if we may customize these paths

Copy link
Contributor Author

@honpey honpey Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add TODO if we may customize these paths

fixed path, would not be changed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

@honpey honpey force-pushed the runtime-dev branch 3 times, most recently from 3998f94 to 047c1fa Compare April 28, 2022 10:00
)

const (
RunPodSandbox RuntimeServiceType = iota
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not reuse the definition in cri repo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems no const or variable "RunPodSandbox" exposed in cri repo?

why not reuse the definition in cri repo?

it seems no const or variable "RunPodSandbox" exposed in cri repo?

return err
}

func (ci *RuntimeManagerCriServer) getRuntimeHookInfo(serviceType RuntimeServiceType) (config.RuntimeRequestPath,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the difference between RuntimeRequestPath and ServiceType?

type RuntimeResourceType string

const (
RuntimePodResource RuntimeResourceType = "RuntimePodResource"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge the pod resource and container resource, because a container must belong to a pod.
the meta info is same for docker and cri, we need a unified struct for docker and cri

Copy link
Contributor Author

@honpey honpey Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge the pod resource and container resource, because a container must belong to a pod.
the meta info is same for docker and cri, we need a unified struct for docker and cri

because in StartContainer/UpdateContainer api, there is only containerID, so we should have a db indexed by containerID, otherwise we may loop the whole db to find specified container info.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge the pod resource and container resource, because a container must belong to a pod.
the meta info is same for docker and cri, we need a unified struct for docker and cri

because in StartCcontainer/UpdateContainer api, there is only containerID, so we should have a db indexed by containerID, otherwise we may loop the whole db to find specify container info.

the repo stores unified struct of container/pod for both containerd/dockerd sceario. the docker resource-executor should convert the docker request to the unified struct and store


type RuntimeManagerCriServer struct {
hookDispatcher *dispatcher.RuntimeHookDispatcher
runtimeClient runtimeapi.RuntimeServiceClient
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we use it to communicate with hook server? change to hookClient, WDYT?

Copy link
Contributor Author

@honpey honpey Apr 28, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seems we use it to communicate with hook server? change to hookClient, WDYT?

runtimeClient is used to talk with containerd not hookserver.
but it maybe changed to BackendClient to avoid confusing

Signed-off-by: pengyang.hpy <honpey@gmail.com>
@eahydra
Copy link
Member

eahydra commented Apr 28, 2022

/lgtm

@hormes
Copy link
Member

hormes commented Apr 28, 2022

/approve

@koordinator-bot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: eahydra, hormes

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@koordinator-bot koordinator-bot bot merged commit 1a83fb3 into koordinator-sh:main Apr 28, 2022
@honpey honpey deleted the runtime-dev branch April 29, 2022 03:54
@jasonliu747 jasonliu747 linked an issue May 7, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[feature request] runtime-manager cri-proxy
6 participants