Skip to content

Commit 1f903e9

Browse files
committed
plugins: add sample rdt plugin
Signed-off-by: Markus Lehtonen <markus.lehtonen@intel.com>
1 parent aaa8e49 commit 1f903e9

File tree

12 files changed

+456
-3
lines changed

12 files changed

+456
-3
lines changed

Makefile

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ PLUGINS := \
5151
$(BIN_PATH)/template \
5252
$(BIN_PATH)/wasm \
5353
$(BIN_PATH)/network-device-injector \
54-
$(BIN_PATH)/network-logger
54+
$(BIN_PATH)/network-logger \
55+
$(BIN_PATH)/rdt
5556

5657
ifneq ($(V),1)
5758
Q := @
@@ -122,9 +123,9 @@ $(BIN_PATH)/wasm build/bin/wasm: FORCE
122123
# test targets
123124
#
124125

125-
test-gopkgs: ginkgo-tests test-ulimits
126+
test-gopkgs: ginkgo-tests test-ulimits test-rdt
126127

127-
SKIPPED_PKGS="ulimit-adjuster,device-injector"
128+
SKIPPED_PKGS="ulimit-adjuster,device-injector,rdt"
128129

129130
ginkgo-tests:
130131
$(Q)$(GINKGO) run \
@@ -146,6 +147,9 @@ test-ulimits:
146147
test-device-injector:
147148
$(Q)cd ./plugins/device-injector && $(GO_TEST) -v
148149

150+
test-rdt:
151+
$(Q)cd ./plugins/rdt && $(GO_TEST) -v
152+
149153
codecov: SHELL := $(shell which bash)
150154
codecov:
151155
bash <(curl -s https://codecov.io/bash) -f $(COVERAGE_PATH)/coverprofile

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ The following sample plugins exist for NRI:
419419
- [ulimit adjuster](plugins/ulimit-adjuster)
420420
- [NRI v0.1.0 plugin adapter](plugins/v010-adapter)
421421
- [WebAssembly plugin](plugins/wasm)
422+
- [RDT](plugins/rdt)
422423
- [template](plugins/template)
423424

424425
Please see the documentation of these plugins for further details
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: apps/v1
2+
kind: DaemonSet
3+
metadata:
4+
name: nri-plugin-rdt
5+
spec:
6+
template:
7+
spec:
8+
containers:
9+
- name: plugin
10+
image: plugin:latest
11+
args:
12+
- "-idx"
13+
- "10"
14+
resources:
15+
requests:
16+
cpu: "2m"
17+
memory: "5Mi"
18+
securityContext:
19+
allowPrivilegeEscalation: false
20+
capabilities:
21+
drop:
22+
- ALL
23+
volumeMounts:
24+
- name: nri-socket
25+
mountPath: /var/run/nri/nri.sock
26+
volumes:
27+
- name: nri-socket
28+
hostPath:
29+
path: /var/run/nri/nri.sock
30+
type: Socket
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
namespace: kube-system
4+
resources:
5+
- daemonset.yaml
6+
images:
7+
- name: plugin
8+
newName: ghcr.io/containerd/nri/plugins/rdt
9+
labels:
10+
- includeSelectors: true
11+
pairs:
12+
app.kubernetes.io/name: nri-plugin-rdt
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- base/
5+
components:
6+
- ../components/image-stable
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: kustomize.config.k8s.io/v1beta1
2+
kind: Kustomization
3+
resources:
4+
- ../base/
5+
components:
6+
- ../../components/image-unstable

plugins/rdt/README.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
## RDT Plugin
2+
3+
This sample plugin can adjust RDT configuration of containers using pod
4+
annotations.
5+
6+
> [CAUTION]
7+
> This plugin is experimental and only intended for demonstration purposes.
8+
9+
### Annotations
10+
11+
Pod annotations can be used to adjust the RDT configuration of containers. See
12+
[IntelRdt of runtime-spec](https://github.com/opencontainers/runtime-spec/blob/main/config-linux.md#intelrdt)
13+
for details.
14+
15+
| Annotation Key | Format | Description |
16+
|-------------------------------------------------------------------|------------------------------------|---------------------------------------------------------------------|
17+
| `closid.rdt.noderesource.dev/container.$CONTAINER_NAME` | string | Set the `intelRdt.closID` of the container configuration. |
18+
| `schemata.rdt.noderesource.dev/container.$CONTAINER_NAME` | array of strings, separated by `,` | Set the `intelRdt.schemata` of the container configuration. |
19+
| `enablemonitoring.rdt.noderesource.dev/container.$CONTAINER_NAME` | bool | Set the `intelRdt.enableMonitoring` of the container configuration. |
20+
21+
See [sample pod spec](sample-rdt-adjust.yaml) for a practical example.
22+
23+
## Deployment
24+
25+
The NRI repository contains minimal kustomize overlays for this plugin at
26+
[contrib/kustomize/rdt](../../contrib/kustomize/rdt).
27+
28+
Deploy the latest release with:
29+
30+
```bash
31+
kubectl apply -k https://github.com/containerd/nri/contrib/kustomize/rdt
32+
```
33+
34+
Deploy a specific release with:
35+
36+
```bash
37+
RELEASE_TAG=v0.11.0
38+
kubectl apply -k "github.com/containerd/nri/contrib/kustomize/rdt?ref=${RELEASE_TAG}"
39+
```
40+
41+
Deploy the latest development build from tip of the main branch with:
42+
43+
```bash
44+
kubectl apply -k https://github.com/containerd/nri/contrib/kustomize/rdt/unstable
45+
```

plugins/rdt/go.mod

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module github.com/containerd/nri/plugins/rdt
2+
3+
go 1.24.3
4+
5+
replace github.com/containerd/nri => ../..
6+
7+
require (
8+
github.com/containerd/log v0.1.0
9+
github.com/containerd/nri v0.6.1
10+
github.com/sirupsen/logrus v1.9.3
11+
github.com/stretchr/testify v1.8.4
12+
)
13+
14+
require (
15+
github.com/containerd/ttrpc v1.2.7 // indirect
16+
github.com/davecgh/go-spew v1.1.1 // indirect
17+
github.com/golang/protobuf v1.5.3 // indirect
18+
github.com/knqyf263/go-plugin v0.9.0 // indirect
19+
github.com/kr/text v0.2.0 // indirect
20+
github.com/opencontainers/runtime-spec v1.2.2-0.20250818071321-383cadbf08c0 // indirect
21+
github.com/pmezard/go-difflib v1.0.0 // indirect
22+
github.com/tetratelabs/wazero v1.9.0 // indirect
23+
golang.org/x/sys v0.35.0 // indirect
24+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d // indirect
25+
google.golang.org/grpc v1.57.1 // indirect
26+
google.golang.org/protobuf v1.34.1 // indirect
27+
gopkg.in/yaml.v3 v3.0.1 // indirect
28+
)

plugins/rdt/go.sum

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I=
2+
github.com/containerd/log v0.1.0/go.mod h1:VRRf09a7mHDIRezVKTRCrOq78v577GXq3bSa3EhrzVo=
3+
github.com/containerd/ttrpc v1.2.7 h1:qIrroQvuOL9HQ1X6KHe2ohc7p+HP/0VE6XPU7elJRqQ=
4+
github.com/containerd/ttrpc v1.2.7/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQrAbN1q9o=
5+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
6+
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
7+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
8+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
9+
github.com/go-logr/logr v1.4.2 h1:6pFjapn8bFcIbiKo3XT4j/BhANplGihG6tvd+8rYgrY=
10+
github.com/go-logr/logr v1.4.2/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY=
11+
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
12+
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
13+
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
14+
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
15+
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
16+
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
17+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
18+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
19+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 h1:k7nVchz72niMH6YLQNvHSdIE7iqsQxK1P41mySCvssg=
20+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
21+
github.com/knqyf263/go-plugin v0.9.0 h1:CQs2+lOPIlkZVtcb835ZYDEoyyWJWLbSTWeCs0EwTwI=
22+
github.com/knqyf263/go-plugin v0.9.0/go.mod h1:2z5lCO1/pez6qGo8CvCxSlBFSEat4MEp1DrnA+f7w8Q=
23+
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
24+
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
25+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
26+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
27+
github.com/onsi/ginkgo/v2 v2.19.1 h1:QXgq3Z8Crl5EL1WBAC98A5sEBHARrAJNzAmMxzLcRF0=
28+
github.com/onsi/ginkgo/v2 v2.19.1/go.mod h1:O3DtEWQkPa/F7fBMgmZQKKsluAy8pd3rEQdrjkPb9zA=
29+
github.com/onsi/gomega v1.34.0 h1:eSSPsPNp6ZpsG8X1OVmOTxig+CblTc4AxpPBykhe2Os=
30+
github.com/onsi/gomega v1.34.0/go.mod h1:MIKI8c+f+QLWk+hxbePD4i0LMJSExPaZOVfkoex4cAo=
31+
github.com/opencontainers/runtime-spec v1.2.2-0.20250818071321-383cadbf08c0 h1:RLn0YfUWkiqPGtgUANvJrcjIkCHGRl3jcz/c557M28M=
32+
github.com/opencontainers/runtime-spec v1.2.2-0.20250818071321-383cadbf08c0/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0=
33+
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
34+
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
35+
github.com/prometheus/procfs v0.6.0 h1:mxy4L2jP6qMonqmq+aTtOx1ifVWUgG/TAmntgbh3xv4=
36+
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
37+
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
38+
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
39+
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
40+
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
41+
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
42+
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
43+
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
44+
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
45+
github.com/tetratelabs/wazero v1.9.0 h1:IcZ56OuxrtaEz8UYNRHBrUa9bYeX9oVY93KspZZBf/I=
46+
github.com/tetratelabs/wazero v1.9.0/go.mod h1:TSbcXCfFP0L2FGkRPxHphadXPjo1T6W+CseNNY7EkjM=
47+
golang.org/x/net v0.38.0 h1:vRMAPTMaeGqVhG5QyLJHqNDwecKTomGeqbnfZyKlBI8=
48+
golang.org/x/net v0.38.0/go.mod h1:ivrbrMbzFq5J41QOQh0siUuly180yBYtLp+CKbEaFx8=
49+
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
50+
golang.org/x/sys v0.35.0 h1:vz1N37gP5bs89s7He8XuIYXpyY0+QlsKmzipCbUtyxI=
51+
golang.org/x/sys v0.35.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
52+
golang.org/x/text v0.23.0 h1:D71I7dUrlY+VX0gQShAThNGHFxZ13dGLBHQLVl1mJlY=
53+
golang.org/x/text v0.23.0/go.mod h1:/BLNzu4aZCJ1+kcD0DNRotWKage4q2rGVAg4o22unh4=
54+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg=
55+
golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk=
56+
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
57+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d h1:pgIUhmqwKOUlnKna4r6amKdUngdL8DrkpFeV8+VBElY=
58+
google.golang.org/genproto/googleapis/rpc v0.0.0-20230731190214-cbb8c96f2d6d/go.mod h1:TUfxEVdsvPg18p6AslUXFoLdpED4oBnGwyqk3dV1XzM=
59+
google.golang.org/grpc v1.57.1 h1:upNTNqv0ES+2ZOOqACwVtS3Il8M12/+Hz41RCPzAjQg=
60+
google.golang.org/grpc v1.57.1/go.mod h1:Sd+9RMTACXwmub0zcNY2c4arhtrbBYD1AUHI/dt16Mo=
61+
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
62+
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
63+
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
64+
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
65+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
66+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
67+
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
68+
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
69+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
70+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

plugins/rdt/main.go

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
/*
2+
Copyright The containerd Authors.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
*/
16+
17+
package main
18+
19+
import (
20+
"context"
21+
"flag"
22+
"os"
23+
"strconv"
24+
"strings"
25+
26+
"github.com/containerd/log"
27+
"github.com/sirupsen/logrus"
28+
29+
"github.com/containerd/nri/pkg/api"
30+
"github.com/containerd/nri/pkg/stub"
31+
)
32+
33+
type plugin struct {
34+
stub stub.Stub
35+
l *logrus.Logger
36+
}
37+
38+
func main() {
39+
l := logrus.StandardLogger()
40+
l.SetFormatter(&logrus.TextFormatter{
41+
PadLevelText: true,
42+
})
43+
44+
pluginIdx := flag.String("idx", "", "plugin index to register to NRI")
45+
verbose := flag.Bool("verbose", false, "enable verbose logging")
46+
47+
flag.Parse()
48+
l.WithField("verbose", *verbose).Info("Starting plugin")
49+
50+
if *verbose {
51+
l.SetLevel(logrus.DebugLevel)
52+
}
53+
54+
opts := []stub.Option{}
55+
if *pluginIdx != "" {
56+
opts = append(opts, stub.WithPluginIdx(*pluginIdx))
57+
}
58+
59+
p := &plugin{l: l}
60+
var err error
61+
if p.stub, err = stub.New(p, opts...); err != nil {
62+
l.Fatalf("Failed to create plugin stub: %v", err)
63+
}
64+
65+
if err := p.stub.Run(context.Background()); err != nil {
66+
l.Errorf("Plugin exited with error %v", err)
67+
os.Exit(1)
68+
}
69+
}
70+
71+
func (p *plugin) CreateContainer(ctx context.Context, pod *api.PodSandbox, container *api.Container) (*api.ContainerAdjustment, []*api.ContainerUpdate, error) {
72+
l := logrus.NewEntry(p.l)
73+
if pod != nil {
74+
l = l.WithFields(logrus.Fields{"namespace": pod.Namespace, "pod": pod.Name})
75+
}
76+
if container != nil {
77+
l = l.WithField("container", container.Name)
78+
}
79+
ctx = log.WithLogger(ctx, l)
80+
log.G(ctx).Debug("Create container")
81+
82+
adjustment := &api.ContainerAdjustment{}
83+
err := adjustRdt(ctx, adjustment, container.Name, pod.Annotations)
84+
if err != nil {
85+
return nil, nil, err
86+
}
87+
return adjustment, nil, nil
88+
}
89+
90+
func adjustRdt(ctx context.Context, adjustment *api.ContainerAdjustment, container string, annotations map[string]string) error {
91+
rdtAnnotationKeySuffix := ".rdt.noderesource.dev/container." + container
92+
93+
for k, v := range annotations {
94+
if strings.HasSuffix(k, rdtAnnotationKeySuffix) {
95+
fieldName := strings.TrimSuffix(k, rdtAnnotationKeySuffix)
96+
switch fieldName {
97+
case "closid":
98+
adjustClosID(ctx, adjustment, v)
99+
case "schemata":
100+
adjustSchemata(ctx, adjustment, v)
101+
case "enablemonitoring":
102+
if err := adjustEnableMonitoring(ctx, adjustment, v); err != nil {
103+
return err
104+
}
105+
default:
106+
log.G(ctx).WithField("field_name", fieldName).Info("Unknown rdt field")
107+
}
108+
}
109+
}
110+
return nil
111+
}
112+
113+
func adjustClosID(ctx context.Context, adjustment *api.ContainerAdjustment, value string) {
114+
log.G(ctx).WithField("closid", value).Info("Adjust closid")
115+
adjustment.SetLinuxRDTClosID(value)
116+
}
117+
118+
func adjustSchemata(ctx context.Context, adjustment *api.ContainerAdjustment, value string) {
119+
schemata := strings.Split(value, ",")
120+
log.G(ctx).WithField("schemata", schemata).Info("Adjust schemata")
121+
adjustment.SetLinuxRDTSchemata(schemata)
122+
}
123+
124+
func adjustEnableMonitoring(ctx context.Context, adjustment *api.ContainerAdjustment, value string) error {
125+
enable, err := strconv.ParseBool(value)
126+
if err != nil {
127+
return err
128+
}
129+
log.G(ctx).WithField("enablemonitoring", enable).Info("Adjust enablemonitoring")
130+
adjustment.SetLinuxRDTEnableMonitoring(enable)
131+
return nil
132+
}

0 commit comments

Comments
 (0)