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

Skip to content

Conversation

@haircommander
Copy link
Member

What type of PR is this?

/kind api-change

What this PR does / why we need it:

a new version of #3076 that adapts the sysctl code from crun and copies it into pinns, as it's the only part of libcrun that is needed. This, along with fixing a remaining port-forward bug, should be the last needed to pass tests while dropping infra container (still lots of more refactoring needed)

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

If manage_ns_lifecycle is true, and pod isn't sharing PID namespace, pods will be deployed without an infra container

@openshift-ci-robot openshift-ci-robot added dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API labels Mar 24, 2020
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: haircommander
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.

Details 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

1 similar comment
@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: haircommander
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.

Details 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

@haircommander haircommander changed the title Sandbox: drop infra and use pinns to configure sysctls WIP Sandbox: drop infra and use pinns to configure sysctls Mar 24, 2020
@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Mar 24, 2020
test/sysctl.bats Outdated
@@ -0,0 +1,54 @@
#!/usr/bin/env bats
Copy link
Member Author

Choose a reason for hiding this comment

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

todo: remove this test, it was just for not needing to run the entire ctr.bats

@codecov
Copy link

codecov bot commented Mar 24, 2020

Codecov Report

Merging #3474 into master will increase coverage by 0.08%.
The diff coverage is 40.54%.

@@            Coverage Diff             @@
##           master    #3474      +/-   ##
==========================================
+ Coverage   43.95%   44.03%   +0.08%     
==========================================
  Files         101      101              
  Lines        7770     7807      +37     
==========================================
+ Hits         3415     3438      +23     
- Misses       4056     4072      +16     
+ Partials      299      297       -2

return 0;
}

static int write_sysctl_to_file (char * sysctl_key, char* sysctl_value)
Copy link
Member Author

Choose a reason for hiding this comment

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

todo: give @giuseppe credit for this function

Copy link
Member

Choose a reason for hiding this comment

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

could we use directly libcrun or is it overkill? It doesn't need to be linked and it could just be a git submodule

Copy link
Member Author

Choose a reason for hiding this comment

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

It is kind of overkill. All the autoconf/automake configuration for a 15 line function ultimately doesn't seem worth it.

The interaction with libcrun was also awkward, because we need to call pinns before we write the config.json to disk. To get the sysctls from it, we needed to write a temporary one, then use it to configure the namespaces, then use those namespaces to configure the real one.

Ultimately, I like this flow better.

Copy link
Member

Choose a reason for hiding this comment

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

I thought we could use directly the function without going through the config.json part.

But I agree autoconf/automake for a function is overkill :-)

@haircommander haircommander force-pushed the manage-ns-no-infra-sysctl-pinns branch 2 times, most recently from b3197e3 to 1345fb2 Compare March 24, 2020 20:51
@haircommander
Copy link
Member Author

/test e2e

@haircommander haircommander force-pushed the manage-ns-no-infra-sysctl-pinns branch 3 times, most recently from c7da1d4 to 8ea9545 Compare March 25, 2020 17:31
@haircommander
Copy link
Member Author

/test integration_rhel

@haircommander haircommander force-pushed the manage-ns-no-infra-sysctl-pinns branch 4 times, most recently from 55dfe5a to 60e9c99 Compare March 25, 2020 19:41
some changes this includes:
    allow for the infra container to not be created by the runtime, if sb.NeedsInfra() is false
    add concept of a 'spoofed' container. This allows us to make calls to ID(), Name(), and Description() without having the runtime create the container
    using spoof, change checks of podInfraContainer == nil to Spoofed(), as well as re-add Description() calls
    reorder some infra container creation code
    add unit tests for NeedsInfra and Spoofed
    add integration test for drop infra

Signed-off-by: Peter Hunt <[email protected]>
Signed-off-by: Peter Hunt <[email protected]>
Signed-off-by: Peter Hunt <[email protected]>
sysctls are configured in the runtime after the process unshares in the shared namespaces. since we aren't using a runtime, we need to repeat this step.

After unsharing, but before binding, configure the sysctls for the namespace.

Signed-off-by: Peter Hunt <[email protected]>
@haircommander haircommander force-pushed the manage-ns-no-infra-sysctl-pinns branch from 60e9c99 to b1961cd Compare March 25, 2020 19:54
@haircommander haircommander force-pushed the manage-ns-no-infra-sysctl-pinns branch from b1961cd to 7531de8 Compare March 25, 2020 20:10
@haircommander
Copy link
Member Author

/retest

@openshift-ci-robot
Copy link

@haircommander: PR needs rebase.

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.

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 26, 2020
@openshift-ci-robot
Copy link

@haircommander: PR needs rebase.

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.

scontainer.SetSpec(&m)
scontainer.SetMountPoint(m.Annotations[annotations.MountPoint])
var scontainer *oci.Container
if sb.NeedsInfra(c.config.ManageNSLifecycle) {
Copy link
Contributor

Choose a reason for hiding this comment

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

When NeedsInfra() returns true, infra container would still be instantiated.
From the subject of the PR, I thought infra container would be gone.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah it's still being used to hold pod level information (and is likely needed to store it for a restore). The first step is to drop the container at the runtime level

if err := s.CtrIDIndex().Delete(podInfraContainer.ID()); err != nil {
return nil, fmt.Errorf("failed to delete infra container %s in pod sandbox %s from index: %v", podInfraContainer.ID(), sb.ID(), err)
}
s.ReleaseContainerName(podInfraContainer.Name())
Copy link
Contributor

@tedyu tedyu May 8, 2020

Choose a reason for hiding this comment

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

We don't need the 'if podInfraContainer != nil ' check because there would be spoofed container if infra container is not needed.


if err := s.ContainerStateToDisk(container); err != nil {
log.Warnf(ctx, "unable to write containers %s state to disk: %v", container.ID(), err)
if err := s.MonitorConmon(container); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

I noticed the MonitorConmon() call originally on line 638 has been removed.
Do we still want the call here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

no we've dropped conmonmon

namespaces, err := pinFunc(managedNamespaces, cfg, sysctls)
if err != nil {
return typesAndPaths, nil
return typesAndPaths, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Since err is returned, how useful is typesAndPaths ?

Copy link
Member Author

Choose a reason for hiding this comment

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

it's not it could be nil


return 0;
}
static int bind_ns(const char *pin_path, const char *ns_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Current declaration is:
static int bind_ns(const char *pin_path, const char *filename, const char *ns_name);

filename is no longer needed ?

Copy link
Member Author

Choose a reason for hiding this comment

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

the way the function works has been changed

@openshift-ci-robot
Copy link

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

Test name Commit Details Rerun command
ci/openshift-jenkins/critest_rhel 7531de8 link /test critest_rhel
ci/openshift-jenkins/integration_crun_cgroupv2 7531de8 link /test integration_cgroupv2
ci/openshift-jenkins/integration_rhel 7531de8 link /test integration_rhel
ci/openshift-jenkins/integration_fedora 7531de8 link /test integration_fedora
ci/openshift-jenkins/integration_crun 7531de8 link /test integration_crun
ci/openshift-jenkins/e2e_features_rhel 7531de8 link /test e2e_features_rhel
ci/kata-jenkins 7531de8 link /test kata-containers
ci/openshift-jenkins/e2e_crun_cgroupv2 7531de8 link /test e2e_cgroupv2
ci/openshift-jenkins/e2e_rhel 7531de8 link /test e2e_rhel
ci/prow/images 7531de8 link /test images
ci/prow/launch-aws 7531de8 link /test launch-aws
ci/prow/e2e-aws 7531de8 link /test e2e-aws

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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.

@haircommander
Copy link
Member Author

replacing with #3997

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants