Skip to content
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

Advertise Conmon PID via MAINPID #6689

Closed
wants to merge 1 commit into from

Conversation

goochjj
Copy link
Contributor

@goochjj goochjj commented Jun 19, 2020

When NOTIFY_SOCKET is passed from systemd, we
send MAINPID= so systemd monitors the correct PID.

Imported daemon/ from go-systemd dependency.

Signed-off-by: Joseph Gooch mrwizard@dok.org

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: goochjj
To complete the pull request process, please assign giuseppe
You can assign the PR to them by writing /assign @giuseppe in a comment when ready.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

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

@openshift-ci-robot openshift-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Jun 19, 2020
@openshift-ci-robot
Copy link
Collaborator

Hi @goochjj. Thanks for your PR.

I'm waiting for a containers 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.

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.

@TomSweeneyRedHat
Copy link
Member

/ok-to-test

@openshift-ci-robot openshift-ci-robot added ok-to-test and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Jun 19, 2020
@@ -37,6 +37,7 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/sys/unix"
"k8s.io/client-go/tools/remotecommand"
"github.com/coreos/go-systemd/v22/daemon"
Copy link
Member

Choose a reason for hiding this comment

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

@goochjj gating doesn't like the location of this line, it needs to move up in alpha order. I think to line 32.5

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

@mheon
Copy link
Member

mheon commented Jun 19, 2020

Gating is complaining about gofmt.

@giuseppe PTAL

@TomSweeneyRedHat
Copy link
Member

Once gating and happy tests are complete
LGTM

Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

This could break existing users. Until now, we deferred all sd notify communication to the container.

The main pid, however, would make sense to communicate as that's not something any process in the container could know.

@vrothberg
Copy link
Member

vrothberg commented Jun 19, 2020

I'll pass it to @giuseppe :^)

@goochjj goochjj force-pushed the libpod-sd-notify branch 2 times, most recently from 491e018 to f4a93ec Compare June 19, 2020 13:58
@goochjj
Copy link
Contributor Author

goochjj commented Jun 19, 2020

I'm not sure how to fix the vendor check. When I run the go mod commands locally it deletes many many things.

@goochjj
Copy link
Contributor Author

goochjj commented Jun 19, 2020

I think I figured it out

@vrothberg
Copy link
Member

I'm not sure how to fix the vendor check. When I run the go mod commands locally it deletes many many things.

We require go >= 1.1.3. If you're below that, you can run make vendor-in-container

Copy link
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

runc already sends a MAINPID=$PID-CONTAINER, crun doesn't. More in general we are already delegating the sd-notify logic to the OCI runtime.

The safest is probably to override it from Podman once the container is already started (after "start" terminates). Does systemd work fine if you use MAINPID= multiple times?

libpod/oci_conmon_linux.go Outdated Show resolved Hide resolved
@goochjj goochjj force-pushed the libpod-sd-notify branch 2 times, most recently from 23bb7b9 to 03666d3 Compare June 19, 2020 17:02
When NOTIFY_SOCKET is passed from systemd, we
send MAINPID=<pid of conmon> so systemd monitors the correct PID.
We do this both Before and After the OCI runtime engine start is called.

Imported daemon/ from go-systemd dependency.

Signed-off-by: Joseph Gooch <mrwizard@dok.org>
Co-authored-by: Giuseppe Scrivano <giuseppe@scrivano.org>
Copy link
Member

@vrothberg vrothberg left a comment

Choose a reason for hiding this comment

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

I think we only need to send the MAINPID once in start. It's redundant in create.

Other than that LGTM. @giuseppe WDYT?

@giuseppe
Copy link
Member

yes I agree. We need only for start, then LGTM

@goochjj
Copy link
Contributor Author

goochjj commented Jun 22, 2020

yes I agree. We need only for start, then LGTM

I sent it twice, in case runc or crun passes a different MAINPID. conmon happens before OCI runtime, start happens after.

Note also this PR is superceded by #6693

@goochjj goochjj closed this Jun 22, 2020
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 24, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. ok-to-test
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants