Skip to content

Conversation

@Burning1020
Copy link
Member

@Burning1020 Burning1020 commented Oct 27, 2022

Works for #7312:

Add a new config as sandbox controller mod, which can be either
"podsandbox" or "shim". If empty, set it to default "podsandbox"
when CRI plugin inits.

Signed-off-by: Zhang Tianyang burning9699@gmail.com

},
Runtime: api.RuntimeOpts{Name: "test"},
Runtime: api.RuntimeOpts{Name: "test"},
Controller: "remote",
Copy link
Member

Choose a reason for hiding this comment

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

Sandboxes are implemented by shims (side by side with task service), so we can reuse Runtime field to find right shim for tasks/sandboxing. There is no need in dedicated Controller field.

Copy link
Member Author

Choose a reason for hiding this comment

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

Reasonable. Thanks!

@Burning1020 Burning1020 force-pushed the sc-switch branch 2 times, most recently from eb14f1d to c8b6ea5 Compare November 1, 2022 07:18
@Burning1020 Burning1020 closed this Nov 1, 2022
@Burning1020 Burning1020 reopened this Nov 1, 2022
@Burning1020
Copy link
Member Author

CC @mxpv I've pushed again. Use sandbox_mode="shim|podsandbox" to determinate which controller.

// while using default snapshotters for operational simplicity.
// See https://github.com/containerd/containerd/issues/6657 for details.
Snapshotter string `toml:"snapshotter" json:"snapshotter"`
// SandboxMode setting sandbox controller mode of sandbox at runtime level like Snapshotter
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// SandboxMode setting sandbox controller mode of sandbox at runtime level like Snapshotter
// SandboxMode defines which sandbox runtime to use when scheduling pods
// This features requires experimental CRI server to be enabled (use ENABLE_CRI_SANDBOXES=1)

@mxpv mxpv added this to the 1.7 milestone Nov 2, 2022
@Burning1020
Copy link
Member Author

CC @fuweid @dmcgowan

"github.com/containerd/containerd/api/services/sandbox/v1"
)

const DefaultSandboxController = "podsandbox"
Copy link
Member

Choose a reason for hiding this comment

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

If the mode is type, I think we should use const type and add validation for this.

type Mode string

const (
     ModeDefault Mode = "default"
     ModeRemote = "remote"
)

func ValidateMode() error {
    ...
}

Something like that.

Copy link
Member Author

Choose a reason for hiding this comment

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

I want make "SandboxMode" similar to "Snapshotter", they're all string type. If we change it to Mode type, there wolud be some conversion. Is it necessary?

if err != nil {
return nil, fmt.Errorf("failed to get sandbox runtime: %w", err)
}
// Absent case
Copy link
Member

Choose a reason for hiding this comment

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

we can verify the Runtime.Config when setup CRI plugin. And update it to default mode if it is empty.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@Burning1020 Burning1020 force-pushed the sc-switch branch 2 times, most recently from 09d0dcf to 8ca5390 Compare November 3, 2022 13:21
@Burning1020 Burning1020 changed the title Add a switch between sandbox controller impls Sandbox API: Add a new mode config for sandbox controller impls Nov 4, 2022
@Burning1020 Burning1020 force-pushed the sc-switch branch 3 times, most recently from 6727116 to 5ccbc87 Compare November 4, 2022 07:27
@Burning1020 Burning1020 closed this Nov 4, 2022
@Burning1020 Burning1020 reopened this Nov 4, 2022
@k8s-ci-robot
Copy link

@Burning1020: The /test command needs one or more targets.
The following commands are available to trigger required jobs:

  • /test pull-containerd-build
  • /test pull-containerd-node-e2e
  • /test pull-containerd-sandboxed-node-e2e

Use /test all to run the following jobs that were automatically triggered:

  • pull-containerd-build
  • pull-containerd-node-e2e
Details

In response to this:

/test

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.

@Burning1020 Burning1020 closed this Nov 4, 2022
@Burning1020 Burning1020 reopened this Nov 4, 2022
@Burning1020 Burning1020 requested a review from fuweid November 7, 2022 09:17
type Mode string

const (
// ModePodSandbox means use Controller implementation from sbserver podsandbox package.
Copy link
Member

Choose a reason for hiding this comment

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

I feel like this is CRI specific and should be maintained in cri package.

Copy link
Member Author

@Burning1020 Burning1020 Nov 8, 2022

Choose a reason for hiding this comment

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

updated

@Burning1020 Burning1020 force-pushed the sc-switch branch 2 times, most recently from 572a591 to 233399c Compare November 8, 2022 13:07
@Burning1020 Burning1020 requested review from mxpv and removed request for fuweid November 9, 2022 03:49
"github.com/containerd/containerd/plugin"
)

type Mode string
Copy link
Member

Choose a reason for hiding this comment

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

What about SandboxMode?

Copy link
Member Author

Choose a reason for hiding this comment

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

updated to SandboxControllerMode

Add a new config as sandbox controller mod, which can be either
"podsandbox" or "shim". If empty, set it to default "podsandbox"
when CRI plugin inits.

Signed-off-by: Zhang Tianyang <burning9699@gmail.com>
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 on green

@mxpv
Copy link
Member

mxpv commented Nov 9, 2022

/test pull-containerd-sandboxed-node-e2e

@Burning1020
Copy link
Member Author

/retest

@mxpv mxpv merged commit 7eeaed8 into containerd:main Nov 10, 2022
@mxpv mxpv mentioned this pull request Nov 10, 2022
17 tasks
@Burning1020 Burning1020 deleted the sc-switch branch November 11, 2022 01:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants