-
Notifications
You must be signed in to change notification settings - Fork 1.1k
do not create & store context in runtime vm #4650
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
Conversation
Signed-off-by: Periyasamy Palanisamy <[email protected]>
|
/cc @fidencio, @JanScheurich |
internal/oci/runtime_vm.go
Outdated
| go func() { | ||
| // Create the container | ||
| if resp, err := r.task.Create(r.ctx, request); err != nil { | ||
| if resp, err := r.task.Create(namespaces.WithNamespace(context.Background(), namespaces.Default), request); err != nil { |
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.
why WithNamespace here but not in other places? also, why aren't we passing the ctx to CreateContainer 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.
yes, missed to replace it with ctx, fixed now.
ctx is updated with Namespace in startRuntimeDaemon, so its not needed anymore in other places. is my understanding right ?
|
awesome thanks for taking this on @pperiyasamy , you've got a lint issue and I've got one question, but generally it LGTM |
internal/oci/runtime_vm.go
Outdated
| go func() { | ||
| // Create the container | ||
| if resp, err := r.task.Create(r.ctx, request); err != nil { | ||
| if resp, err := r.task.Create(namespaces.WithNamespace(context.Background(), namespaces.Default), request); err != nil { |
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.
yes, missed to replace it with ctx, fixed now.
ctx is updated with Namespace in startRuntimeDaemon, so its not needed anymore in other places. is my understanding right ?
server/streaming/streaming.go
Outdated
| type Runtime interface { | ||
| Exec(containerID string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error | ||
| Attach(containerID string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error | ||
| Exec(ctx context.Context, containerID string, cmd []string, in io.Reader, out, err io.WriteCloser, tty bool, resize <-chan remotecommand.TerminalSize) error |
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.
while fixing lint in suite_test.go, this change has a compatibility issue with kubelet interface https://github.com/kubernetes/kubernetes/blob/master/pkg/kubelet/cri/streaming/server.go#L63 as it doesn't pass ctx object, how would like to fix this ?
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.
damn yeah we'll have to drop them here and store them for this...
server/streaming/streaming.go
Outdated
| // criAdapter wraps the Runtime functions to conform to the remotecommand interfaces. | ||
| // The adapter binds the container ID to the container name argument, and the pod sandbox ID to the pod name. | ||
| type criAdapter struct { | ||
| ctx context.Context |
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.
@haircommander is it ok to store ctx here ?
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 I think we're going to have to. do we create a criAdapter for each new request or for each runtime?
Signed-off-by: Periyasamy Palanisamy <[email protected]>
108dbaa to
1bf8f82
Compare
|
LGTM |
|
/approve LGTM, thanks @pperiyasamy ! |
Signed-off-by: Periyasamy Palanisamy <[email protected]>
|
@pperiyasamy: The following test failed, say
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. |
|
@pperiyasamy: The following test 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. |
Codecov Report
@@ Coverage Diff @@
## master #4650 +/- ##
==========================================
+ Coverage 40.92% 40.95% +0.03%
==========================================
Files 110 110
Lines 9545 9545
==========================================
+ Hits 3906 3909 +3
+ Misses 5192 5189 -3
Partials 447 447 |
|
/override ci/kata-jenkins |
|
@haircommander: Overrode contexts on behalf of haircommander: ci/kata-jenkins DetailsIn response to this:
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. |
|
@pperiyasamy, thanks a lot for the PR. Codewise it looks good to me. One thing I'd like to ask you for is, could you squash those 3 commits into a single one? The reason I'm asking for this is, when we end up bisecting something, we don't end up in a commit breaking the tests, leaving us without knowing whether the commit is the reason of the breakage we're debugging, or just something that had a fix pushed apart. |
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.
/lgtm
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: haircommander, pperiyasamy, 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 |
|
/hold |
|
@saschagrunert, sorry, I'm holding this one till we have all patches squashed. Once we have that, I'll proceed with the |
|
/unhold |
|
@saschagrunert taught me a nice trick: |
|
/label tide/merge-method-squash |
|
oh, too late it seems. :-) |
We now partially revert cri-o#4650 to still use the runtime internal context for its tasks. Fixes: cri-o#4798 Signed-off-by: Sascha Grunert <[email protected]>
We now partially revert cri-o#4650 to still use the runtime internal context for its tasks. Fixes: cri-o#4798 Signed-off-by: Sascha Grunert <[email protected]>
cri-o#4803 partially reverted cri-o#4650, but ended up missing two places where the context is used to ensure the goroutines are stopped. This was caught due to some tests failing in a non deterministic manner on kata-containers CI. Related: cri-o#4798
cri-o#4803 partially reverted cri-o#4650, but ended up missing two places where the context is used to ensure the goroutines are stopped. This was caught due to some tests failing in a non deterministic manner on kata-containers CI. Related: cri-o#4798 Signed-off-by: Fabiano Fidêncio <[email protected]>
cri-o#4803 partially reverted cri-o#4650, but ended up missing two places where the context is used to ensure the goroutines are stopped. This was caught due to some tests failing in a non deterministic manner on kata-containers CI. Related: - cri-o#4798 - kata-containers/tests#3503 (comment) Signed-off-by: Fabiano Fidêncio <[email protected]>
cri-o#4803 partially reverted cri-o#4650, but ended up missing two places where the context is used to ensure the goroutines are stopped. This was caught due to some tests failing in a non deterministic manner on kata-containers CI. Related: - cri-o#4798 - kata-containers/tests#3503 (comment) Signed-off-by: Fabiano Fidêncio <[email protected]> (cherry picked from commit db280b4)
Signed-off-by: Periyasamy Palanisamy [email protected]
What type of PR is this?
What this PR does / why we need it:
This PR reuses existing context object and avoids creating a new context object in runtime VM module and storing in its runtimeVM structure.
Which issue(s) this PR fixes:
The runtime VM creates its own context object and store in its structure which shouldn't be done as for crio process should contain only one context object which should be passed across API boundaries.
Fixes #4634
Special notes for your reviewer:
streaming#criAdapter{}needed to store the existingctxobject, is that ok ?Does this PR introduce a user-facing change?