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

WIP: balloons: add RDT support #473

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cmd/plugins/balloons/policy/balloons-policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -1679,6 +1679,9 @@ func (p *balloons) assignContainer(c cache.Container, bln *Balloon) {
bln.PodIDs[podID] = append(bln.PodIDs[podID], c.GetID())
bln.updateGroups(c, 1)
p.updatePinning(bln)
if bln.Def.RdtClass != "" {
c.SetRDTClass(bln.Def.RdtClass)
}
}

// dismissContainer removes a container from a balloon
Expand Down
7 changes: 7 additions & 0 deletions config/crd/bases/config.nri_balloonspolicies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ spec:
placed on separate balloons. The default is false: prefer
placing containers of a pod to the same balloon(s).
type: boolean
rdtClass:
description: |-
RdtClass controls RDT class of processes in the containers
of a balloon. The default is empty: no RDT class is set. If
defined, processes will be added to the directory
corresponding the class in the resctrl file system.
type: string
shareIdleCPUsInSame:
description: |-
ShareIdleCpusInSame <topology-level>: if there are idle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,13 @@ spec:
placed on separate balloons. The default is false: prefer
placing containers of a pod to the same balloon(s).
type: boolean
rdtClass:
description: |-
RdtClass controls RDT class of processes in the containers
of a balloon. The default is empty: no RDT class is set. If
defined, processes will be added to the directory
corresponding the class in the resctrl file system.
type: string
shareIdleCPUsInSame:
description: |-
ShareIdleCpusInSame <topology-level>: if there are idle
Expand Down
4 changes: 4 additions & 0 deletions docs/resource-policy/policy/balloons.md
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ Balloons policy parameters:
- `cpuClass` specifies the name of the CPU class according to which
CPUs of balloons are configured. Class properties are defined in
separate `cpu.classes` objects, see below.
- `rdtClass` specifies the name of the RDT class. Corresponding
class of service (COS) must exist in the resctrl file
system. Containers in the balloon are assigned to the class. Refer
to resctrl file system for configuring classes.
- `pinMemory` overrides policy-level `pinMemory` in balloons of this
type.
- `memoryTypes` is a list of allowed memory types for containers in
Expand Down
5 changes: 5 additions & 0 deletions pkg/apis/config/v1alpha1/resmgr/policy/balloons/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ type BalloonDef struct {
// CpuClass controls how CPUs of a balloon are (re)configured
// whenever a balloon is created, inflated or deflated.
CpuClass string `json:"cpuClass,omitempty"`
// RdtClass controls RDT class of processes in the containers
// of a balloon. The default is empty: no RDT class is set. If
// defined, processes will be added to the directory
// corresponding the class in the resctrl file system.
RdtClass string `json:"rdtClass,omitempty"`
// MinBalloons is the number of balloon instances that always
// exist even if they would become empty. At init this number
// of instances will be created before assigning any
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
config:
allocatorTopologyBalancing: true
reservedResources:
cpu: 750m
pinCPU: false
pinMemory: false
balloonTypes:
- name: balloon-gold
rdtClass: rdt-class-gold
matchExpressions:
- key: name
operator: In
values:
- container-gold
log:
debug:
- resource-manager
- cache
- policy
- sysfs
source: true
klog:
skip_headers: true
20 changes: 20 additions & 0 deletions test/e2e/policies.test-suite/balloons/n4c16/test14-rdt/code.var.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
helm-terminate
helm_config=$TEST_DIR/balloons-rdt.cfg helm-launch balloons

cleanup() {
vm-command "kubectl delete pods --all --now"
helm-terminate
vm-command "rm -f /var/lib/nri-resource-policy/cache" || true
}
cleanup

# pod0c{0,1,2}: one container per free L2 group
CPUREQ="1500m" MEMREQ="100M" CPULIM="1500m" MEMLIM="100M"
POD_ANNOTATION="balloon.balloons.resource-policy.nri.io/container.pod0c1: balloon-gold" CONTCOUNT=3 create balloons-busybox
report allowed

breakpoint
echo "DELME: forced to fail to avoid cleanup
exit 1

cleanup
Loading