Skip to content

Conversation

@abel-von
Copy link
Contributor

@abel-von abel-von commented Nov 17, 2023

This PR cherry-picked the #9119 and split the CRI plugin into plugins below:

image

  1. the io.containerd.internal.v1.cri plugin is for loading cri configuration and validation
  2. the io.containerd.image.v1.cri-image-service plugin is a image service to create/pull/remove/query images.
  3. the io.containerd.sandbox.controller.v1.podsandbox the a sandbox controller implement that create a pause container to mimic a sandbox, it is a legacy support.
  4. the io.containerd.grpc.v1.cri-grpc-service is the CRI grpc service plugin, to serve grpc API calls of CRI interfaces.

@k8s-ci-robot
Copy link

Hi @abel-von. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@abel-von abel-von force-pushed the sandbox-plugin-1117 branch 2 times, most recently from 4c29c26 to 0efc665 Compare November 17, 2023 08:19
@abel-von
Copy link
Contributor Author

PTAL @mxpv @fuweid @dmcgowan

@abel-von abel-von changed the title sandbox: Move CRI Image Service a seperate plugin sandbox: Move CRI Image Service and CRI Base a seperate plugin Nov 17, 2023
@abel-von abel-von changed the title sandbox: Move CRI Image Service and CRI Base a seperate plugin sandbox: Move CRI Image Service and CRI Base seperate plugins Nov 17, 2023
@fuweid
Copy link
Member

fuweid commented Nov 17, 2023

All the integration test cases fail. I think there is regression caused by 09723a6

Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
Signed-off-by: Abel Feng <fshb1988@gmail.com>
@abel-von abel-von force-pushed the sandbox-plugin-1117 branch from 0efc665 to ebb1655 Compare November 20, 2023 07:32
@abel-von
Copy link
Contributor Author

I think it is not caused by 09723a6. It is actually because we changed the cri plugin type from io.containerd.grpc.v1 to io.containerd.internal.v1 so that the RootDir and StateDir in Config changed.
Recently we init the Config in the code below

	c := criconfig.Config{
		PluginConfig:       *pluginConfig,
		ContainerdRootDir:  filepath.Dir(ic.Properties[plugins.PropertyRootDir]),
		ContainerdEndpoint: ic.Properties[plugins.PropertyGRPCAddress],
		RootDir:            ic.Properties[plugins.PropertyRootDir],
		StateDir:           ic.Properties[plugins.PropertyStateDir],
	}

I think we may have to keep the RootDir and StateDir io.containerd.grpc.v1.cri, or we migrate cri root dirs and state dirs to the new path, but we can not simply rename them to the new path because some paths such as io fifos are stored in the db.
@fuweid

@abel-von
Copy link
Contributor Author

I think the CRI integration test passed, one of them failed because an occasional failure of the container registry. could you please rerun it to make sure all CI steps green? @fuweid

pkg/cri/cri.go Outdated
ID: "cri",
Config: &config,
Type: plugins.GRPCPlugin,
ID: "cri-grpc-service",
Copy link
Member

Choose a reason for hiding this comment

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

could you just keep it as cri? It's unlikely to do live-migration because the running containers are using the volume in this plugin folder.

Copy link
Member

Choose a reason for hiding this comment

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

We probably need to add some release upgrade integration cases for this before we accept this.

REF:

// Add exec/stats/stop-existing-running-pods/...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

could you just keep it as cri? It's unlikely to do live-migration because the running containers are using the volume in this plugin folder.

That is actually why the intergration test failed before. So that I add a commit 9a18e8e to keep the plugin folder path "io.containerd.grpc.v1.cri" as before.

I think it is no use to change the name here because we want to add a plugin of type io.containerd.internal.v1 to carry the cri configs and other plugins will be depend on this plugin to get the cri configs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We probably need to add some release upgrade integration cases for this before we accept this.

added a test case to manipulate the containers in the pod before upgrade. 0597be4849

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The added integration test case reveals an existing compatibility issues, and I fixed in e18e86905b3071, all these are included in this PR, could you please take a look at the new commits ?

or, as Max has approved, shall I put the two new commits in a new PR? @mxpv @fuweid

Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need to rename it cri-grp-service. Just use cri because it's grpc plugin. It won't conflict with internal one.

@abel-von abel-von force-pushed the sandbox-plugin-1117 branch 2 times, most recently from 75820ea to 0597be4 Compare November 28, 2023 08:35
@abel-von abel-von mentioned this pull request Nov 28, 2023
19 tasks
Copy link
Member

@mikebrow mikebrow left a comment

Choose a reason for hiding this comment

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

looking good .. yes, suggest splitting up the test and fix (last two commits) into another PR .. tag that PR for cherry pick..

@abel-von
Copy link
Contributor Author

the integration test codes is splited into the new PR #9434

please take a look @mikebrow @fuweid

@abel-von abel-von requested review from fuweid and mikebrow November 30, 2023 01:10
Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

Basically, it looks good to me

pkg/cri/cri.go Outdated
ID: "cri",
Config: &config,
Type: plugins.GRPCPlugin,
ID: "cri-grpc-service",
Copy link
Member

Choose a reason for hiding this comment

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

I think we don't need to rename it cri-grp-service. Just use cri because it's grpc plugin. It won't conflict with internal one.

}
}

// For backward compatibility, we have to keep the rootDir and stateDir the same as before.
Copy link
Member

Choose a reason for hiding this comment

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

I think it's not a long-term solution. We should introduce some toggle to switch to use cri.base root or state dir in the future.

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 it's not a long-term solution. We should introduce some toggle to switch to use cri.base root or state dir in the future.

we may have to record the root and state dir in the sandbox object in cri cache, when recovering from restart, we need to detect if it is "io.containerd.internal.v1.cri" or "io.containerd.grpc.v1.cri", but this is a big change, can we leave it in another PR?

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 don't need to rename it cri-grp-service. Just use cri because it's grpc plugin. It won't conflict with internal one.

changed back to "cri"

Copy link
Member

Choose a reason for hiding this comment

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

we may have to record the root and state dir in the sandbox object in cri cache, when recovering from restart, we need to detect if it is "io.containerd.internal.v1.cri" or "io.containerd.grpc.v1.cri", but this is a big change, can we leave it in another PR?

Yes. We can handle it in the follow-up. I am not against to introduce fallback logic to handle existing running pods. 😂

Signed-off-by: Abel Feng <fshb1988@gmail.com>
Signed-off-by: Abel Feng <fshb1988@gmail.com>
Signed-off-by: Abel Feng <fshb1988@gmail.com>
@abel-von abel-von force-pushed the sandbox-plugin-1117 branch from 9a18e8e to e1b4958 Compare November 30, 2023 15:09
Copy link
Member

@fuweid fuweid left a comment

Choose a reason for hiding this comment

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

LGTM

@mxpv mxpv added this pull request to the merge queue Dec 1, 2023
Merged via the queue into containerd:main with commit 47163c3 Dec 1, 2023
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.

5 participants