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 bug

What this PR does / why we need it:

before, we were only setting workload settings for the containers in a pod. This was a gap, as a user may want to have the whole pod-i.e conmon-be confined as well.

Add functionality to put conmon in the workload, configurable by the "POD" label

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

Allow users to customize conmon's resources if a pod is in a workload.

@openshift-ci openshift-ci bot added release-note Denotes a PR that will be considered when it comes time to generate release notes. kind/bug Categorizes issue or PR as related to a bug. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels May 17, 2021
@openshift-ci openshift-ci bot requested a review from rhatdan May 17, 2021 20:20
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 17, 2021
@haircommander haircommander changed the title workloads: set workload for conmon as well wip: workloads: set workload for conmon as well May 17, 2021
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 17, 2021
@haircommander
Copy link
Member Author

still not super happy with it, needs some tweaking of the APIs but I wante to throw it at ci

@haircommander haircommander force-pushed the workload-settings-7 branch 2 times, most recently from 42f1833 to c589989 Compare May 18, 2021 18:15
@haircommander
Copy link
Member Author

/retest

@haircommander haircommander force-pushed the workload-settings-7 branch 2 times, most recently from 8692892 to 67bd771 Compare May 20, 2021 19:43
@haircommander haircommander changed the title wip: workloads: set workload for conmon as well workloads: set workload for conmon as well May 20, 2021
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label May 20, 2021
@haircommander
Copy link
Member Author

I've been puzzling over whether I can come up with a cleaner API between internal/oci/oci_linux and internal/config/cgmgr and I haven't. LinuxResources can be scraped from a spec (so we can reuse the pkg/config/workloads.go function MutateCgroupGivenAnnotation), and holds all the information we may want (configuration of cgroups). if someone can think of something better I'm here to listen, but I think this is ready

@haircommander haircommander force-pushed the workload-settings-7 branch from 184350f to 00b5c19 Compare May 20, 2021 20:01
@haircommander
Copy link
Member Author

/retest

1 similar comment
@haircommander
Copy link
Member Author

/retest

@haircommander haircommander force-pushed the workload-settings-7 branch from 00b5c19 to 569eeeb Compare May 21, 2021 14:12

logrus.Debugf("Running conmon under slice %s and unitName %s", cgroupParent, conmonUnitName)
if err := utils.RunUnderSystemdScope(pid, cgroupParent, conmonUnitName, killSignalProp, systemdDbus.PropAfter("crio.service")); err != nil {
if err := utils.RunUnderSystemdScope(pid, cgroupParent, conmonUnitName, props...); err != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Wonder if it's possible to reuse runc systemd manager's Apply()/Set() here. It does a job similar to utils.RunUnderSystemdScope, can be used to set arbitrary properties (via cgroups.SystemdProps), and in general does a better job.

Copy link
Member Author

Choose a reason for hiding this comment

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

unfortunatley Apply/Set aren't yet a very portable API (from what I was able to put together). Here's what I had to do to use them for this case: haircommander@82b0997 . I would believe I haven't used the API correctly, but I think I'd like to port this to using runc at a later time (if ever)

@haircommander haircommander force-pushed the workload-settings-7 branch from 569eeeb to 6213b85 Compare May 21, 2021 20:14
@openshift-ci openshift-ci bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 23, 2021
@haircommander haircommander force-pushed the workload-settings-7 branch from 6213b85 to 78939f2 Compare May 24, 2021 16:31
@openshift-ci openshift-ci bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 24, 2021
@haircommander
Copy link
Member Author

/retest

@haircommander haircommander force-pushed the workload-settings-7 branch 2 times, most recently from ad21927 to 66cedc5 Compare May 27, 2021 18:00
Copy link
Member

@mrunalp mrunalp left a comment

Choose a reason for hiding this comment

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

Left some comments.

PodSandboxStateSandboxReady PodSandboxState = 0
PodSandboxStateSandboxNotReady PodSandboxState = 1

InfraName = "POD"
Copy link
Member

Choose a reason for hiding this comment

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

Can we name this InfraContainerName ?


if [ -z "$cpushares" ]; then
[[ $(jq -r .linux.resources.cpu.shares < "$config") == 0 ]]
[[ $(jq .linux.resources.cpu.shares < "$config") == *"$cpushares"* ]]
Copy link
Member

Choose a reason for hiding this comment

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

Why is the code in both the branches the same?

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 idea how that got there haha

else
[[ "$cpuset" == *"$found_cpuset"* ]]
fi
# cgroup_v2 doesn't have an analogue for cpushares
Copy link
Member

Choose a reason for hiding this comment

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

cgroups v2 equivalent is cpu.weight.
See the conversion table here - https://github.com/containers/crun/blob/master/crun.1.md

Copy link
Member Author

Choose a reason for hiding this comment

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

ah! I attempted to update

@haircommander haircommander force-pushed the workload-settings-7 branch 3 times, most recently from a120519 to 7a4bc63 Compare June 4, 2021 17:31
@haircommander
Copy link
Member Author

/retest

@haircommander haircommander force-pushed the workload-settings-7 branch from 7a4bc63 to 6035b9a Compare June 7, 2021 13:39
there's a line in the kubelet leaky file that says it should be deleted
we need an importable InfraName anyway, so move all references from leaky.PodContainerName or infraName
to server/cri/types.InfraName

Signed-off-by: Peter Hunt <[email protected]>
currently, workloads are only configured for the containers in the pod.
This is insufficient for clients that want to keep a whole pod confined in a workload.

Add functionality where conmon will also be put into the workload

Signed-off-by: Peter Hunt <[email protected]>
@haircommander haircommander force-pushed the workload-settings-7 branch from 6035b9a to 4860dd2 Compare June 7, 2021 18:12
Copy link
Member

@mrunalp mrunalp 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 openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 7, 2021
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 7, 2021

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: haircommander, mrunalp

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,mrunalp]

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

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@haircommander
Copy link
Member Author

/retest

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

2 similar comments
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Jun 8, 2021

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

Test name Commit Details Rerun command
ci/openshift-jenkins/e2e_crun_cgroupv2 4860dd2 link /test e2e_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.

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

1 similar comment
@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit eedb15e into cri-o:master Jun 8, 2021
@haircommander
Copy link
Member Author

/cherry-pick release-1.21

@openshift-cherrypick-robot

@haircommander: #4907 failed to apply on top of branch "release-1.21":

Applying: storage: succeed in DeleteContainer if container is unknown
Applying: server: export InfraName and drop references to leaky
Using index info to reconstruct a base tree...
M	internal/oci/oci_linux.go
M	server/sandbox_run_linux.go
M	server/server.go
M	vendor/modules.txt
Falling back to patching base and 3-way merge...
Auto-merging vendor/modules.txt
Removing vendor/k8s.io/kubernetes/pkg/kubelet/leaky/leaky.go
Auto-merging server/server.go
Auto-merging server/sandbox_run_linux.go
Auto-merging internal/oci/oci_linux.go
Applying: Bump runc to get public RangeToBits function
Using index info to reconstruct a base tree...
M	go.mod
M	go.sum
M	vendor/modules.txt
Falling back to patching base and 3-way merge...
Auto-merging vendor/modules.txt
CONFLICT (content): Merge conflict in vendor/modules.txt
Auto-merging go.sum
CONFLICT (content): Merge conflict in go.sum
Auto-merging go.mod
CONFLICT (content): Merge conflict in go.mod
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0003 Bump runc to get public RangeToBits function
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

Details

In response to this:

/cherry-pick release-1.21

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.

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. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants