Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pperiyasamy
Copy link
Member

@pperiyasamy pperiyasamy commented Mar 12, 2021

Signed-off-by: Periyasamy Palanisamy [email protected]

What type of PR is this?

/kind bug

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 existing ctx object, is that ok ?

Does this PR introduce a user-facing change?

None

Signed-off-by: Periyasamy Palanisamy <[email protected]>
@openshift-ci-robot openshift-ci-robot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 12, 2021
@pperiyasamy
Copy link
Member Author

/cc @fidencio, @JanScheurich

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 {
Copy link
Member

@haircommander haircommander Mar 12, 2021

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?

Copy link
Member Author

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 ?

@openshift-ci-robot openshift-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 12, 2021
@haircommander
Copy link
Member

awesome thanks for taking this on @pperiyasamy , you've got a lint issue and I've got one question, but generally it LGTM

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 {
Copy link
Member Author

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 ?

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
Copy link
Member Author

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 ?

Copy link
Member

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...

// 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
Copy link
Member Author

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 ?

Copy link
Member

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]>
@TomSweeneyRedHat
Copy link
Contributor

LGTM
assuming happy tests.

@haircommander
Copy link
Member

/approve

LGTM, thanks @pperiyasamy !

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 15, 2021
Signed-off-by: Periyasamy Palanisamy <[email protected]>
@openshift-ci-robot
Copy link

@pperiyasamy: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/kata-jenkins 0f70874 link /test kata-containers
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. I understand the commands that are listed here.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Mar 15, 2021

@pperiyasamy: The following test failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
ci/openshift-jenkins/integration_crun_cgroupv2 0f70874 link /test integration_cgroupv2

Full PR test history. Your PR dashboard.

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. I understand the commands that are listed here.

@codecov
Copy link

codecov bot commented Mar 15, 2021

Codecov Report

Merging #4650 (5173eb0) into master (6718405) will increase coverage by 0.03%.
The diff coverage is 6.52%.

@@            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              

@haircommander
Copy link
Member

/override ci/kata-jenkins

@openshift-ci-robot
Copy link

@haircommander: Overrode contexts on behalf of haircommander: ci/kata-jenkins

Details

In response to this:

/override ci/kata-jenkins

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.

@haircommander
Copy link
Member

@fidencio
Copy link
Contributor

@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.

Copy link
Member

@saschagrunert saschagrunert left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 16, 2021
@openshift-ci-robot
Copy link

[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

Details Needs approval from an approver in each of these files:
  • OWNERS [haircommander,saschagrunert]

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

@fidencio
Copy link
Contributor

/hold

@openshift-ci-robot openshift-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 16, 2021
@fidencio
Copy link
Contributor

@saschagrunert, sorry, I'm holding this one till we have all patches squashed. Once we have that, I'll proceed with the /lgtm.

@fidencio
Copy link
Contributor

/unhold

@openshift-ci-robot openshift-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Mar 16, 2021
@fidencio
Copy link
Contributor

@saschagrunert taught me a nice trick: /label tide/merge-method-squash, let's see if it works. :-)

@openshift-merge-robot openshift-merge-robot merged commit 1e86661 into cri-o:master Mar 16, 2021
@fidencio
Copy link
Contributor

/label tide/merge-method-squash

@openshift-ci-robot openshift-ci-robot added the tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges. label Mar 16, 2021
@fidencio
Copy link
Contributor

oh, too late it seems. :-)

saschagrunert added a commit to saschagrunert/cri-o that referenced this pull request Apr 26, 2021
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]>
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/cri-o that referenced this pull request Apr 27, 2021
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]>
fidencio added a commit to fidencio/cri-o that referenced this pull request May 7, 2021
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
fidencio added a commit to fidencio/cri-o that referenced this pull request May 7, 2021
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]>
fidencio added a commit to fidencio/cri-o that referenced this pull request May 8, 2021
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]>
fidencio added a commit to fidencio/cri-o that referenced this pull request May 11, 2021
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. lgtm Indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. tide/merge-method-squash Denotes a PR that should be squashed by tide when it merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

runtime VM holds context

7 participants