-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add option to drop infra container #4165
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
Add option to drop infra container #4165
Conversation
|
replaces #3997 (which has grown out of date, and has an extra patch that's not needed) |
|
also carries #4146 |
|
/retest |
9a0509a to
53c5bd4
Compare
Codecov Report
@@ Coverage Diff @@
## master #4165 +/- ##
==========================================
- Coverage 40.92% 40.91% -0.01%
==========================================
Files 111 111
Lines 9512 9614 +102
==========================================
+ Hits 3893 3934 +41
- Misses 5242 5301 +59
- Partials 377 379 +2 |
b68bade to
25681e1
Compare
25681e1 to
90975f3
Compare
internal/criocli/criocli.go
Outdated
| if ctx.IsSet("manage-ns-lifecycle") { | ||
| config.ManageNSLifecycle = ctx.Bool("manage-ns-lifecycle") | ||
| } | ||
| if ctx.IsSet("drop-infra") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wondering if calling this drop-infra-container or drop-infra-ctr is better or leave it as is.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah drop-infra-ctr is more clear... I may make that change on next rebase (the only other field in the config that has container or ctr is ctr_stop_timeout so we should keep with ctr imo)
4145bbc to
a3787af
Compare
|
/retest |
internal/criocli/criocli.go
Outdated
| }, | ||
| &cli.BoolFlag{ | ||
| Name: "drop-infra-ctr", | ||
| Usage: fmt.Sprintf("determines whether we drop the infra container when appropriate. Requires ManageNSLifecycle to be true (default: %v)", defConf.DropInfraCtr), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of when appropriate should we reword to when pod pid namespace is not shared?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it a bit verbose for a cli flag TBH but yeah it would better match the config values
internal/lib/container_server.go
Outdated
| // on disk | ||
| func (c *ContainerServer) ContainerStateToDisk(ctr *oci.Container) error { | ||
| if ctr == nil { | ||
| if ctr.Spoofed() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need a skip in ContainerStateFromDisk as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we can for posterity, but the only time it's called is when restoring, in a block where we don't restore if the container used to be spoofed.
internal/lib/sandbox/sandbox.go
Outdated
| return nil | ||
| } | ||
|
|
||
| // NeedsInfra is a function that returns whether the sandbox will need an infra container |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Add sentence with period.
internal/lib/sandbox/sandbox.go
Outdated
|
|
||
| // NeedsInfra is a function that returns whether the sandbox will need an infra container | ||
| // if the server manages the namespace lifecycles, and the Pid option on the sandbox | ||
| // is node level, the infra container is not needed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
node or container
Signed-off-by: Peter Hunt <[email protected]>
as well as update existing tests to allow drop_infra_ctr to be true or false by default Signed-off-by: Peter Hunt <[email protected]>
e6357c8 to
75b5f18
Compare
|
(most) comments address, thanks for the thorough review @kolyshkin |
specifically, set RUNTIME_NAME and CONTAINER_DEFAULT_RUNTIME if it's set as such Signed-off-by: Peter Hunt <[email protected]>
sysctls must be passed to pinns of the format -s 'key=value'+'key2=value2' also, move the pinns source code to `pinns/src` to clean up the top level directory a bit Signed-off-by: Peter Hunt <[email protected]>
as it would otherwise unconditionally have pexit() called Signed-off-by: Peter Hunt <[email protected]>
Signed-off-by: Peter Hunt <[email protected]>
to hold crio specific annotations until they are stable enough to put in containers/common Signed-off-by: Peter Hunt <[email protected]>
as well as a constructor for a spoofed container a Spoofed() container is one that exists in cri-o's state, but not in the runtime This allows us to drop the infra, but keep bookkeeping standardized (for instance, when we restore cri-o, we look at the container's state directory) Signed-off-by: Peter Hunt <[email protected]>
to allow the sandbox to decide when it needs an infra container Signed-off-by: Peter Hunt <[email protected]>
in the initial (very old) implementation of a dropped infra, infra containers were allowed to be nil This is no longer the case, so we can remove traces of that old implementation Signed-off-by: Peter Hunt <[email protected]>
this commit includes: - propegate sysctls from pod creation down to pinns - use the annotations package for userns and spoofed containers - add restore code for when a container was spoofed - query a runtime handler based on the string instead of by container - this allows us to query the runtime handler before we create the container to allow it to be spoofed - drop the infra container when the pod is not kernel separated, and when NeedsInfra is false Signed-off-by: Peter Hunt <[email protected]>
75b5f18 to
9afdd35
Compare
saschagrunert
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just one suggestion around the general behavior, otherwise LGTM
|
|
||
| **--default-ulimits**="": Ulimits to apply to containers by default (name=soft:hard) (default: []) (default: []) | ||
|
|
||
| **--drop-infra-ctr**: Determines whether pods are created without an infra container (when the pod is not using a pod level PID namespace). Requires ManageNSLifecycle to be true (default: false) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we implicitly set ManageNSLifecycle to true if this toggle switches on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is more clear (as an experimental feature) that we fail quickly when it's not set. By the time DropInfra is set to true by default, I like to think we won't have ManageNSLifecycle as an option anymore
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: haircommander, saschagrunert The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
/lgtm |
|
/retest |
|
@haircommander: The following tests failed, say
Full PR test history. Your PR dashboard. DetailsInstructions 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. I understand the commands that are listed here. |
Add option to drop infra container Signed-off-by: bin liu <[email protected]>
What type of PR is this?
/kind feature
What this PR does / why we need it:
Which issue(s) this PR fixes:
Special notes for your reviewer:
Does this PR introduce a user-facing change?