Showing preview only (2,479K chars total). Download the full file or copy to clipboard to get everything.
Repository: intel/cri-resource-manager
Branch: master
Commit: 886388e7a4a7
Files: 555
Total size: 2.2 MB
Directory structure:
gitextract_8uskpwqi/
├── .githooks/
│ ├── pre-commit.d/
│ │ ├── 00-gofmt
│ │ ├── 10-shellcheck
│ │ └── 20-go-version
│ └── run-hooks
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ ├── feature_request.md
│ │ └── new-release.md
│ └── workflows/
│ ├── common-build-docs.yaml
│ ├── common-build-images.yaml
│ ├── common-codeql.yaml
│ ├── common-trivy.yaml
│ ├── common-verify-code.yaml
│ ├── publish-devel-images.yaml
│ ├── publish-docs.yml
│ ├── release.yaml
│ ├── trivy-csv.tpl
│ ├── verify-periodic.yaml
│ ├── verify-pr-code.yaml
│ └── verify-pr-docs.yaml
├── .gitignore
├── CODEOWNERS
├── Jenkinsfile
├── LICENSE
├── Makefile
├── README.md
├── SECURITY.md
├── cmd/
│ ├── cri-resmgr/
│ │ ├── cri-resource-manager.service.in
│ │ ├── cri-resource-manager.sysconf
│ │ ├── fallback.cfg.sample
│ │ └── main.go
│ ├── cri-resmgr-agent/
│ │ ├── Dockerfile
│ │ ├── agent-deployment.yaml
│ │ └── main.go
│ ├── cri-resmgr-agent-probe/
│ │ └── main.go
│ └── cri-resmgr-webhook/
│ ├── Dockerfile
│ ├── handlers.go
│ ├── main.go
│ ├── mutating-webhook-config.yaml
│ ├── webhook-deployment.yaml
│ └── webhook.go
├── demo/
│ ├── blockio/
│ │ ├── bb-scanner.yaml
│ │ ├── cri-resmgr-config.default.yaml
│ │ └── run.sh
│ └── lib/
│ ├── command.bash
│ ├── distro.bash
│ ├── host.bash
│ ├── numactlH2numajson.py
│ ├── topology.py
│ ├── topology2qemuopts.py
│ └── vm.bash
├── dockerfiles/
│ └── cross-build/
│ ├── Dockerfile.debian-11
│ ├── Dockerfile.debian-12
│ ├── Dockerfile.debian-sid
│ ├── Dockerfile.fedora
│ ├── Dockerfile.opensuse-leap-15.6
│ ├── Dockerfile.ubuntu-18.04
│ ├── Dockerfile.ubuntu-20.04
│ ├── Dockerfile.ubuntu-22.04
│ └── Dockerfile.ubuntu-24.04
├── docs/
│ ├── Dockerfile
│ ├── _templates/
│ │ └── layout.html
│ ├── conf.py
│ ├── contributing.md
│ ├── demos/
│ │ ├── blockio.md
│ │ └── index.rst
│ ├── developers-guide/
│ │ ├── architecture.md
│ │ ├── cri-test.md
│ │ ├── e2e-test.md
│ │ ├── index.rst
│ │ ├── policy-writers-guide.md
│ │ ├── testing.rst
│ │ └── unit-test.md
│ ├── index.html
│ ├── index.rst
│ ├── installation.md
│ ├── introduction.md
│ ├── migration-to-NRI.md
│ ├── node-agent.md
│ ├── policy/
│ │ ├── balloons.md
│ │ ├── blockio.md
│ │ ├── container-affinity.md
│ │ ├── cpu-allocator.md
│ │ ├── dynamic-pools.md
│ │ ├── index.rst
│ │ ├── podpools.md
│ │ ├── rdt.md
│ │ ├── static-pools.md
│ │ └── topology-aware.md
│ ├── quick-start.md
│ ├── reference/
│ │ ├── agent-command-line-reference.md
│ │ ├── configuration-reference.md
│ │ ├── index.rst
│ │ └── resmgr-command-line-reference.md
│ ├── releases/
│ │ ├── conf.py
│ │ └── index.md
│ ├── requirements.txt
│ ├── security.md
│ ├── setup.md
│ └── webhook.md
├── elf/
│ └── avx512.c
├── go.mod
├── go.sum
├── packaging/
│ ├── deb.in/
│ │ ├── changelog
│ │ ├── compat
│ │ ├── control
│ │ └── rules
│ └── rpm/
│ └── cri-resource-manager.spec.in
├── pkg/
│ ├── agent/
│ │ ├── agent.go
│ │ ├── api/
│ │ │ └── v1/
│ │ │ ├── api.go
│ │ │ ├── api.pb.go
│ │ │ ├── api.proto
│ │ │ ├── api_grpc.pb.go
│ │ │ └── constants.go
│ │ ├── config-updater.go
│ │ ├── flags.go
│ │ ├── kubernetes.go
│ │ ├── server.go
│ │ └── watcher.go
│ ├── apis/
│ │ └── resmgr/
│ │ ├── expression.go
│ │ ├── expression_test.go
│ │ ├── generated/
│ │ │ ├── clientset/
│ │ │ │ └── versioned/
│ │ │ │ ├── clientset.go
│ │ │ │ ├── doc.go
│ │ │ │ ├── fake/
│ │ │ │ │ ├── clientset_generated.go
│ │ │ │ │ ├── doc.go
│ │ │ │ │ └── register.go
│ │ │ │ ├── scheme/
│ │ │ │ │ ├── doc.go
│ │ │ │ │ └── register.go
│ │ │ │ └── typed/
│ │ │ │ └── resmgr/
│ │ │ │ └── v1alpha1/
│ │ │ │ ├── adjustment.go
│ │ │ │ ├── doc.go
│ │ │ │ ├── fake/
│ │ │ │ │ ├── doc.go
│ │ │ │ │ ├── fake_adjustment.go
│ │ │ │ │ └── fake_resmgr_client.go
│ │ │ │ ├── generated_expansion.go
│ │ │ │ └── resmgr_client.go
│ │ │ ├── informers/
│ │ │ │ └── externalversions/
│ │ │ │ ├── factory.go
│ │ │ │ ├── generic.go
│ │ │ │ ├── internalinterfaces/
│ │ │ │ │ └── factory_interfaces.go
│ │ │ │ └── resmgr/
│ │ │ │ ├── interface.go
│ │ │ │ └── v1alpha1/
│ │ │ │ ├── adjustment.go
│ │ │ │ └── interface.go
│ │ │ └── listers/
│ │ │ └── resmgr/
│ │ │ └── v1alpha1/
│ │ │ ├── adjustment.go
│ │ │ └── expansion_generated.go
│ │ └── v1alpha1/
│ │ ├── adjustment-schema.yaml
│ │ ├── adjustment.go
│ │ ├── doc.go
│ │ ├── register.go
│ │ ├── types.go
│ │ └── zz_generated.deepcopy.go
│ ├── avx/
│ │ ├── collector.go
│ │ ├── elfdump.go
│ │ └── register.go
│ ├── blockio/
│ │ ├── blockio.go
│ │ ├── blockio_test.go
│ │ └── config.go
│ ├── cgroups/
│ │ ├── cgroupblkio.go
│ │ ├── cgroupblkio_test.go
│ │ ├── cgroupcontrol.go
│ │ ├── cgroupid.go
│ │ ├── cgrouppath.go
│ │ └── cgroupstats.go
│ ├── cgroupstats/
│ │ └── collector.go
│ ├── config/
│ │ ├── config.go
│ │ ├── data.go
│ │ ├── duration.go
│ │ ├── error.go
│ │ ├── help.go
│ │ ├── log.go
│ │ └── options.go
│ ├── cpuallocator/
│ │ ├── allocator.go
│ │ └── cpuallocator_test.go
│ ├── cri/
│ │ ├── client/
│ │ │ ├── client.go
│ │ │ └── v1/
│ │ │ └── client.go
│ │ ├── relay/
│ │ │ ├── image-service.go
│ │ │ ├── relay.go
│ │ │ └── runtime-service.go
│ │ ├── resource-manager/
│ │ │ ├── agent/
│ │ │ │ └── agent.go
│ │ │ ├── builtin-policies.go
│ │ │ ├── cache/
│ │ │ │ ├── affinity.go
│ │ │ │ ├── affinity_test.go
│ │ │ │ ├── cache.go
│ │ │ │ ├── cache_test.go
│ │ │ │ ├── container.go
│ │ │ │ ├── container_test.go
│ │ │ │ ├── error.go
│ │ │ │ ├── pod.go
│ │ │ │ └── utils.go
│ │ │ ├── config/
│ │ │ │ ├── api/
│ │ │ │ │ └── v1/
│ │ │ │ │ ├── api.pb.go
│ │ │ │ │ ├── api.proto
│ │ │ │ │ └── api_grpc.pb.go
│ │ │ │ ├── config.go
│ │ │ │ └── server.go
│ │ │ ├── control/
│ │ │ │ ├── blockio/
│ │ │ │ │ └── blockio.go
│ │ │ │ ├── control.go
│ │ │ │ ├── cpu/
│ │ │ │ │ ├── api.go
│ │ │ │ │ ├── cache.go
│ │ │ │ │ └── cpu.go
│ │ │ │ ├── cri/
│ │ │ │ │ └── cri.go
│ │ │ │ ├── flags.go
│ │ │ │ ├── memory/
│ │ │ │ │ └── memory.go
│ │ │ │ ├── page-migrate/
│ │ │ │ │ ├── demoter.go
│ │ │ │ │ ├── demoter_test.go
│ │ │ │ │ ├── flags.go
│ │ │ │ │ ├── page-migrate.go
│ │ │ │ │ └── page-mover.go
│ │ │ │ └── rdt/
│ │ │ │ └── rdt.go
│ │ │ ├── controllers.go
│ │ │ ├── error.go
│ │ │ ├── events/
│ │ │ │ └── events.go
│ │ │ ├── events.go
│ │ │ ├── flags.go
│ │ │ ├── introspect/
│ │ │ │ └── introspect.go
│ │ │ ├── kubernetes/
│ │ │ │ ├── kubernetes.go
│ │ │ │ └── resources.go
│ │ │ ├── metrics/
│ │ │ │ ├── avx.go
│ │ │ │ ├── metrics.go
│ │ │ │ └── prometheus.go
│ │ │ ├── no-test-api.go
│ │ │ ├── policy/
│ │ │ │ ├── builtin/
│ │ │ │ │ ├── balloons/
│ │ │ │ │ │ ├── balloons-policy.go
│ │ │ │ │ │ ├── balloons-policy_test.go
│ │ │ │ │ │ ├── cputree.go
│ │ │ │ │ │ ├── cputree_test.go
│ │ │ │ │ │ ├── fillmethod.go
│ │ │ │ │ │ ├── flags.go
│ │ │ │ │ │ └── metrics.go
│ │ │ │ │ ├── dynamic-pools/
│ │ │ │ │ │ ├── cpu.go
│ │ │ │ │ │ ├── dyp.go
│ │ │ │ │ │ ├── dyp_test.go
│ │ │ │ │ │ ├── flags.go
│ │ │ │ │ │ └── metrics.go
│ │ │ │ │ ├── none/
│ │ │ │ │ │ └── none-policy.go
│ │ │ │ │ ├── podpools/
│ │ │ │ │ │ ├── flags.go
│ │ │ │ │ │ ├── metrics.go
│ │ │ │ │ │ ├── podpools-policy.go
│ │ │ │ │ │ └── podpools-policy_test.go
│ │ │ │ │ ├── static/
│ │ │ │ │ │ ├── flags.go
│ │ │ │ │ │ └── static-policy.go
│ │ │ │ │ ├── static-plus/
│ │ │ │ │ │ └── static-plus-policy.go
│ │ │ │ │ ├── static-pools/
│ │ │ │ │ │ ├── config.go
│ │ │ │ │ │ ├── node.go
│ │ │ │ │ │ ├── stp-policy.go
│ │ │ │ │ │ └── stp-policy_test.go
│ │ │ │ │ └── topology-aware/
│ │ │ │ │ ├── affinity.go
│ │ │ │ │ ├── cache.go
│ │ │ │ │ ├── cache_test.go
│ │ │ │ │ ├── coldstart.go
│ │ │ │ │ ├── coldstart_test.go
│ │ │ │ │ ├── error.go
│ │ │ │ │ ├── flags.go
│ │ │ │ │ ├── hint.go
│ │ │ │ │ ├── hint_test.go
│ │ │ │ │ ├── logging.go
│ │ │ │ │ ├── mocks_test.go
│ │ │ │ │ ├── node.go
│ │ │ │ │ ├── pod-preferences.go
│ │ │ │ │ ├── pod-preferences_test.go
│ │ │ │ │ ├── pools.go
│ │ │ │ │ ├── pools_test.go
│ │ │ │ │ ├── resources.go
│ │ │ │ │ └── topology-aware-policy.go
│ │ │ │ ├── error.go
│ │ │ │ ├── flags.go
│ │ │ │ └── policy.go
│ │ │ ├── requests.go
│ │ │ ├── resource-manager.go
│ │ │ ├── sockets/
│ │ │ │ └── sockets.go
│ │ │ ├── test-api.go
│ │ │ └── visualizer/
│ │ │ ├── bubbles/
│ │ │ │ ├── assets/
│ │ │ │ │ ├── css/
│ │ │ │ │ │ └── style.css
│ │ │ │ │ ├── index.html
│ │ │ │ │ └── js/
│ │ │ │ │ ├── ui-json-adapter.js
│ │ │ │ │ └── ui.js
│ │ │ │ ├── assets.go
│ │ │ │ ├── assets_generate.go
│ │ │ │ └── doc.go
│ │ │ ├── builtins.go
│ │ │ ├── flags.go
│ │ │ └── visualizer.go
│ │ └── server/
│ │ ├── server.go
│ │ └── services.go
│ ├── dump/
│ │ ├── doc.go
│ │ ├── dump.go
│ │ ├── dump_test.go
│ │ └── flags.go
│ ├── instrumentation/
│ │ ├── flags.go
│ │ ├── grpc.go
│ │ ├── http/
│ │ │ ├── http.go
│ │ │ └── http_test.go
│ │ ├── instrumentation.go
│ │ ├── instrumentation_test.go
│ │ ├── jaeger.go
│ │ ├── prometheus.go
│ │ └── service.go
│ ├── log/
│ │ ├── default.go
│ │ ├── flags.go
│ │ ├── grpc-logger.go
│ │ ├── klogcontrol/
│ │ │ └── klogcontrol.go
│ │ ├── log.go
│ │ ├── ratelimit.go
│ │ ├── ratelimit_test.go
│ │ ├── signal.go
│ │ └── stdlog-logger.go
│ ├── metrics/
│ │ ├── metrics.go
│ │ └── register/
│ │ ├── register_metrics.go
│ │ └── register_metrics_avx.go
│ ├── pidfile/
│ │ ├── pidfile.go
│ │ └── pidfile_test.go
│ ├── policycollector/
│ │ └── collector.go
│ ├── procstats/
│ │ └── procstats.go
│ ├── sysfs/
│ │ ├── error.go
│ │ ├── parsers.go
│ │ ├── system.go
│ │ └── utils.go
│ ├── testutils/
│ │ └── verify.go
│ ├── topology/
│ │ ├── go.mod
│ │ ├── test-cleanup.sh
│ │ ├── test-setup.sh
│ │ ├── topology.go
│ │ └── topology_test.go
│ ├── utils/
│ │ ├── cpuset/
│ │ │ ├── cpuset.go
│ │ │ └── cpuset_test.go
│ │ ├── json.go
│ │ ├── net.go
│ │ ├── parse.go
│ │ ├── sort.go
│ │ └── tar.go
│ └── version/
│ └── version.go
├── runtime-deps.csv
├── sample-configs/
│ ├── balloons-policy.cfg
│ ├── blockio.cfg
│ ├── cri-full-message-dump.cfg
│ ├── cri-resmgr-configmap.example.yaml
│ ├── external-adjustment.yaml
│ ├── podpools-policy.cfg
│ ├── static-policy.cfg
│ ├── static-pools-policy.conf.example
│ └── topology-aware-policy.cfg
├── scripts/
│ ├── build/
│ │ ├── docker-build-image
│ │ ├── get-buildid
│ │ └── update-gh-pages.sh
│ ├── code-generator/
│ │ ├── boilerplate.go.txt
│ │ └── generate-groups.sh
│ ├── hack/
│ │ ├── create-webhook-secrets.sh
│ │ ├── go-mod-replace-helper.sh
│ │ ├── go-mod-tree
│ │ └── install-protobuf
│ └── testing/
│ ├── crictl
│ ├── jaeger
│ ├── kube-cgroups
│ ├── pairwise
│ ├── prometheus
│ ├── prometheus.yaml
│ └── set-path
└── test/
├── critest/
│ ├── run.sh
│ ├── topology-aware-policy.cfg
│ └── tsl
├── e2e/
│ ├── benchmarks.test-suite/
│ │ └── memtier_benchmark/
│ │ ├── cri-resmgr.cfg
│ │ ├── memtier-benchmark-02.yaml.in
│ │ ├── memtier-benchmark.yaml.in
│ │ ├── n4c16/
│ │ │ ├── test01-memtier-stress-ng/
│ │ │ │ ├── code.var.sh
│ │ │ │ └── post-process.sh
│ │ │ ├── test02-multi-memtier/
│ │ │ │ └── code.var.sh
│ │ │ └── topology.var.json
│ │ ├── redis-secret.yaml.in
│ │ ├── redis-service.yaml.in
│ │ ├── redis.yaml.in
│ │ ├── stress-ng-benchmark.yaml.in
│ │ └── stress-ng.yaml.in
│ ├── besteffort.yaml.in
│ ├── blockio.test-suite/
│ │ ├── blockio/
│ │ │ └── n4c16/
│ │ │ ├── test00-slowreader/
│ │ │ │ └── code.var.sh
│ │ │ ├── topology.var.json
│ │ │ └── vm-files/
│ │ │ └── etc/
│ │ │ ├── containers/
│ │ │ │ └── blockio.yaml
│ │ │ └── crio/
│ │ │ └── crio.conf.d/
│ │ │ └── 55-blockio
│ │ ├── containerd_src.var.in.sh
│ │ ├── crio_src.var.in.sh
│ │ ├── k8scri.var.in.sh
│ │ └── omit_cri_resmgr.var.sh
│ ├── burstable.yaml.in
│ ├── cri-resmgr-topology-aware.cfg
│ ├── guaranteed.yaml.in
│ ├── packages.test-suite/
│ │ ├── debian-11/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── debian-12/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── debian-sid/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── fedora/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── opensuse-15.6/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── ubuntu-18.04/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── ubuntu-20.04/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── ubuntu-22.04/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ └── ubuntu-24.04/
│ │ ├── binsrc.var
│ │ ├── cri-resmgr.cfg
│ │ ├── distro.var
│ │ ├── pkgtest/
│ │ │ ├── test01-systemd/
│ │ │ │ └── code.var.sh
│ │ │ └── topology.var.json
│ │ └── reinstall_cri_resmgr.var
│ ├── policies.test-suite/
│ │ ├── balloons/
│ │ │ ├── balloons-busybox.yaml.in
│ │ │ ├── balloons-configmap.yaml.in
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── n4c16/
│ │ │ │ ├── test01-basic-placement/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test02-prometheus-metrics/
│ │ │ │ │ ├── balloons-metrics.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test03-reserved/
│ │ │ │ │ ├── balloons-reserved.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test05-namespace/
│ │ │ │ │ ├── balloons-namespace.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test06-update-configmap/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test07-maxballoons/
│ │ │ │ │ ├── balloons-maxballoons-impossible.cfg
│ │ │ │ │ ├── balloons-maxballoons.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test08-numa/
│ │ │ │ │ ├── balloons-numa.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test09-isolated/
│ │ │ │ │ ├── balloons-isolated.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test10-allocator-opts/
│ │ │ │ │ ├── balloons-allocator-opts.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ ├── n4c32/
│ │ │ │ ├── test01-dynamic-baloons/
│ │ │ │ │ ├── balloons-dynamic.cfg
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── multicontainerpod.yaml.in
│ │ │ │ └── topology.var.json
│ │ │ └── verify.source.sh
│ │ ├── check-correct-policy.source.sh
│ │ ├── dynamic-pools/
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── dyp-busybox.yaml.in
│ │ │ ├── dyp-configmap.yaml.in
│ │ │ ├── n4c16/
│ │ │ │ ├── test01-basic-placement/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test02-prometheus-metrics/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── dyp-metrics.cfg
│ │ │ │ ├── test03-rebalancing/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test04-reserved/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── dyp-reserved.cfg
│ │ │ │ ├── test05-namespace/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── dyp-namespace.cfg
│ │ │ │ ├── test06-update-configmap/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test07-numa/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── dyp-numa.cfg
│ │ │ │ └── topology.var.json
│ │ │ └── verify.source.sh
│ │ ├── podpools/
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── n4c16/
│ │ │ │ ├── podpools-configmap.yaml.in
│ │ │ │ ├── py_consts.var.py
│ │ │ │ ├── test01-basic-placement/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test02-fill-order/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test03-qos/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test04-overbook-cpus/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test05-agent-updates-config/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test06-prometheus-metrics/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── podpools-metrics.cfg
│ │ │ │ ├── test07-custom-default-pool/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── podpools-custom-default.cfg
│ │ │ │ └── topology.var.json
│ │ │ └── podpools-busybox.yaml.in
│ │ ├── static-pools/
│ │ │ ├── README.txt
│ │ │ ├── cmk-exclusive.yaml.in
│ │ │ ├── cmk-isolate.yaml.in
│ │ │ ├── cmk-tolerating-guaranteed.yaml.in
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── n4c16/
│ │ │ │ ├── cri-resmgr-static-pools.cfg
│ │ │ │ ├── py_consts.var.py
│ │ │ │ ├── test00-node-status/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test01-exclusive-pods/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test02-pods-without-cmk/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test03-cmk-isolate/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test04-cmk-isolate-noaffinity/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test05-negative-tests/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test99-cleanup/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── topology.var.json
│ │ │ │ └── vm-files/
│ │ │ │ └── etc/
│ │ │ │ └── cmk/
│ │ │ │ └── pools.conf
│ │ │ └── static-pools-lib.source.sh
│ │ └── topology-aware/
│ │ ├── c4pmem4/
│ │ │ ├── test01-pmem-node-assigning/
│ │ │ │ └── code.var.sh
│ │ │ ├── test02-annotation-memory-type/
│ │ │ │ ├── code.var.sh
│ │ │ │ └── memtype-guaranteed.yaml.in
│ │ │ ├── test02-annotation-memory-type-deprecated-syntax/
│ │ │ │ ├── code.var.sh
│ │ │ │ └── memtype-guaranteed.yaml.in
│ │ │ ├── test03-coldstart/
│ │ │ │ ├── bb-coldstart.yaml.in
│ │ │ │ └── code.var.sh
│ │ │ ├── test03-coldstart-deprecated-syntax/
│ │ │ │ ├── bb-coldstart.yaml.in
│ │ │ │ └── code.var.sh
│ │ │ ├── test04-dynamic-page-demotion/
│ │ │ │ ├── bb-memload.yaml.in
│ │ │ │ ├── code.var.sh
│ │ │ │ └── cri-resmgr-dynamic-page-demotion.cfg
│ │ │ ├── test04-dynamic-page-demotion-deprecated-syntax/
│ │ │ │ ├── bb-memload.yaml.in
│ │ │ │ ├── code.var.sh
│ │ │ │ └── cri-resmgr-dynamic-page-demotion.cfg
│ │ │ ├── test05-guarantee-memory/
│ │ │ │ └── code.var.sh
│ │ │ └── topology.var.json
│ │ ├── cri-resmgr.cfg
│ │ └── n4c16/
│ │ ├── test00-basic-placement/
│ │ │ ├── code.var.sh
│ │ │ └── cri-resmgr.cfg.in
│ │ ├── test01-always-fits/
│ │ │ └── code.var.sh
│ │ ├── test02-shrink-and-grow-shared/
│ │ │ └── code.var.sh
│ │ ├── test03-simple-affinity/
│ │ │ ├── code.var.sh
│ │ │ └── guaranteed+affinity.yaml.in
│ │ ├── test04-available-resources/
│ │ │ ├── code.var.sh
│ │ │ └── cri-resmgr-available-resources.cfg.in
│ │ ├── test05-reserved-resources/
│ │ │ ├── code.var.sh
│ │ │ └── cri-resmgr-reserved.cfg.in
│ │ ├── test06-fuzz/
│ │ │ ├── code.var.sh
│ │ │ ├── codelib.sh
│ │ │ ├── fuzz.aal
│ │ │ ├── fuzz.fmbt.conf
│ │ │ └── generate.sh
│ │ ├── test07-mixed-allocations/
│ │ │ ├── code.var.sh
│ │ │ └── guaranteed-annotated.yaml.in
│ │ ├── test08-isolcpus/
│ │ │ ├── code.var.sh
│ │ │ └── guaranteed-annotated.yaml.in
│ │ ├── test09-container-exit/
│ │ │ └── code.var.sh
│ │ ├── test10-additional-reserved-namespaces/
│ │ │ ├── code.var.sh
│ │ │ └── cri-resmgr-reserved-namespaces.cfg.in
│ │ ├── test11-reserved-cpu-annotations/
│ │ │ ├── code.var.sh
│ │ │ ├── cri-resmgr-reserved-annotations.cfg.in
│ │ │ └── reserved-annotated.yaml.in
│ │ └── topology.var.json
│ ├── run.sh
│ ├── run_all_configurations.sh
│ └── run_tests.sh
└── functional/
├── e2e_test.go
└── fake_cri_server_test.go
================================================
FILE CONTENTS
================================================
================================================
FILE: .githooks/pre-commit.d/00-gofmt
================================================
#!/bin/bash
# Copyright 2012 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# git gofmt pre-commit hook
#
# To use, store as .git/hooks/pre-commit inside your repository and make sure
# it has execute permissions.
#
# This script does not handle file names that contain spaces.
if [ -z "$(command -v gofmt)" ]; then
echo >&2 "WARNING: Cannot check/enforce Go code formatting: can't find gofmt."
echo >&2 "WARNING: Please consider installing gofmt."
exit 0
fi
gofiles=$(git diff --cached --name-only --diff-filter=ACM | grep '\.go$')
[ -z "$gofiles" ] && exit 0
# shellcheck disable=SC2086
unformatted=$(gofmt -l $gofiles)
[ -z "$unformatted" ] && exit 0
# Some files are not gofmt'd. Print message and fail.
echo >&2 "Go files must be formatted with gofmt. Please run:"
for fn in $unformatted; do
echo >&2 " gofmt -w $PWD/$fn"
done
exit 1
================================================
FILE: .githooks/pre-commit.d/10-shellcheck
================================================
#!/bin/bash
# git shellcheck pre-commit hook
#
# To use, store as .git/hooks/pre-commit/shellcheck inside your repository
# and make sure it has execute permissions.
#
# This script does not handle file names that contain spaces.
#
if [ -z "$(command -v shellcheck)" ]; then
echo >&2 "WARNING: Cannot shellcheck scripts: can't find shellcheck."
echo >&2 "WARNING: Please consider installing shellcheck."
exit 0
fi
shfiles=$(git diff --cached --name-only --diff-filter=ACM -- '*.sh' '*.bash')
#echo >&2 "[$0: shfiles: $shfiles]"
for f in $(git diff --cached --name-only --diff-filter=ACM); do
if grep -EHn '^#!/bin/.*sh *' "$f" | grep -q ':1:#!'; then
shfiles="$shfiles $f"
fi
done
shfiles="$(echo "$shfiles" | tr -s '\t ' '\n' | sort | uniq)"
#echo >&2 "[$0: shfiles: $shfiles]"
# shellcheck disable=SC2086
if [ -z "$shfiles" ] || shellcheck $shfiles; then
exit 0
fi
# Some files do not pass ShellCheck. Print message and fail.
echo >&2 "shell scripts must pass ShellCheck. Please fix them."
exit 1
================================================
FILE: .githooks/pre-commit.d/20-go-version
================================================
#!/bin/bash
WORKFLOWS=".github/workflows/verify.yml"
if git diff --cached go.mod | grep -q '^+go '; then
gomod=$(go list -m -f '{{.GoVersion}}')
else
exit 0
fi
status=0
for wf in $WORKFLOWS; do
workflow=$(grep 'go-version:' $wf | sed 's/^.*: //')
if [ "$gomod" != "$workflow" ]; then
echo >&2 "ERROR: inconsistent golang versions, $gomod in go.mod but $workflow in $wf..."
status=1
fi
done
if [ "$status" != 0 ]; then
echo >&2 "Please consider fixing these inconsistencies before committing..."
fi
exit $status
================================================
FILE: .githooks/run-hooks
================================================
#!/bin/bash
type=${0##*/}
hdir=$0.d
orig=${0%/*}/../.git/hooks/$type
exec 1>&2
for hlet in "$hdir"/???*; do
case $hlet in
*~|*.swp)
continue
;;
[0-9][0-9]-*)
;;
esac
if [ ! -x "$hlet" ]; then
continue
fi
echo "<checking $type/${hlet##*/}>"
$hlet
r=$?
if [ $r != 0 ]; then
exit $r
fi
done
if [ -x "$orig" ]; then
echo "<checking .git/hooks/$type>"
$orig
exit $?
fi
================================================
FILE: .github/ISSUE_TEMPLATE/bug_report.md
================================================
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''
---
**Describe the bug**
<!-- A clear and concise description of what the bug is
-->
**Expected behavior**
<!-- A clear and concise description of what you expected to happen
-->
**To Reproduce**
<!-- Steps to reproduce the behavior
-->
**Environment**
<!-- OS, kernel, container runtime, Kubernetes version
-->
**Additional context**
<!-- Add any other context about the problem here
-->
================================================
FILE: .github/ISSUE_TEMPLATE/feature_request.md
================================================
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Describe the solution you'd like**
<!--
A clear and concise description of what you want to happen
-->
**Why this is needed**
<!--
A clear and concise description of the use case and/or justification for the feature
-->
================================================
FILE: .github/ISSUE_TEMPLATE/new-release.md
================================================
---
name: New release
about: Propose a new release
title: Release v0.0.0
labels: ''
assignees: ''
---
## Release Process
<!--
If making adjustments to the checklist please also file a PR against this issue
template (.github/ISSUE_TEMPLATE/new-release.md) to incorporate the changes for
future releases.
-->
- [ ] In the issue description, add a changelog section, describing changes since the last release.
- Local release preparations
- [ ] Perform mandatory internal release checks and preparations.
- [ ] Run `make release-tests` to run an extended set of tests prior to a release.
- [ ] Sync/tidy up dependencies.
- [ ] Run `go mod tidy`.
- [ ] Run `git commit -m 'go.mod,go.sum: update dependencies.' go.{mod,sum}`, if necessary.
- [ ] Run `git tag -a -m "CRI Resource Manager release $VERSION" $VERSION`.
- Publishing
- [ ] Push the tag with `git push $VERSION`. This will automatically build container images and release assets and upload the release assets to a new draft release,
- [ ] Check that release assets were created for the tag
- Container images are published
- https://hub.docker.com/r/intel/cri-resmgr-agent/tags
- https://hub.docker.com/r/intel/cri-resmgr-webhook/tags
- Release assets are uploaded to the draft release
- RPM packages
- DEB package
- Binary tarball
- Source+dependencies tarball (vendored dist)
- [ ] Update the automatically created draft release corresponding to the tag.
- [ ] Write the change log to the release.
- [ ] Mark the release as a non-production pre-release if necessary.
- [ ] Save as draft.
- [ ] Get the change log OK'd by other maintainers.
- [ ] Publish the draft as a release.
- [ ] Add a link to the tagged release in this issue.
- [ ] Close this issue.
## Changelog
<!--
Capture changes since the last release here.
For major releases have separate sections for major changes and a more detailed changelog.
For minor releases list the most important bug fixes and other improvements.
-->
### Major changes
### Detailed changelog
================================================
FILE: .github/workflows/common-build-docs.yaml
================================================
name: Build documentation
on:
workflow_call:
inputs:
publish:
default: false
required: false
type: boolean
permissions:
contents: read
jobs:
update-gh-pages:
runs-on: ubuntu-22.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Fetch gh-pages
run: git fetch --no-tags --prune --depth=1 origin refs/heads/gh-pages:refs/heads/gh-pages
- name: Install build dependencies
run: |
pip3 install --user -r docs/requirements.txt
echo "`python3 -m site --user-base`/bin" >> $GITHUB_PATH
- name: Add docs from this revision to gh-pages
run: |
git config user.name "Github"
git config user.email "no-reply@github.com"
./scripts/build/update-gh-pages.sh
- name: Publish gh-pages
if: ${{ inputs.publish }}
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git gh-pages
================================================
FILE: .github/workflows/common-build-images.yaml
================================================
name: Build container images
on:
workflow_call:
inputs:
image-tag:
default: ${{ github.ref_name }}
required: false
type: string
publish:
default: false
required: false
type: boolean
github-environment:
default: null
required: false
type: string
permissions:
contents: read
jobs:
build-images:
name: Build and publish container images
runs-on: ubuntu-22.04
environment: ${{ inputs.github-environment }}
env:
IMAGE_REPO: intel
IMAGE_VERSION: ${{ inputs.image-tag }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build images
run: "make images IMAGE_VERSION=${IMAGE_VERSION} Q="
- name: Login to Docker Hub
if: ${{ inputs.publish }}
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push images
if: ${{ inputs.publish }}
run: "make images-push IMAGE_VERSION=${IMAGE_VERSION} Q="
================================================
FILE: .github/workflows/common-codeql.yaml
================================================
name: CodeQL scanning
on:
workflow_call:
inputs:
export-report:
default: false
required: false
type: boolean
permissions:
contents: read
jobs:
codeql-scan:
runs-on: ubuntu-22.04
permissions:
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: go
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
- name: Generate CodeQL Security Report
if: ${{ inputs.export-report }}
uses: rsdmike/github-security-report-action@v3.0.4
with:
template: report
token: ${{ secrets.GITHUB_TOKEN }}
- name: Upload PDF report as an artifact
if: ${{ inputs.export-report }}
uses: actions/upload-artifact@v4
with:
name: codeql-report
path: report.pdf
================================================
FILE: .github/workflows/common-trivy.yaml
================================================
name: Trivy scanning
on:
workflow_call:
inputs:
upload-to-github-security-tab:
default: false
required: false
type: boolean
export-csv:
default: false
required: false
type: boolean
permissions:
contents: read
jobs:
trivy-scan-licenses:
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Trivy in fs mode
uses: aquasecurity/trivy-action@master
with:
scan-type: fs
scan-ref: .
exit-code: 1
scanners: license
severity: "UNKNOWN,MEDIUM,HIGH,CRITICAL"
trivy-scan-vulns:
runs-on: ubuntu-22.04
permissions:
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Run Trivy in fs mode
continue-on-error: true
uses: aquasecurity/trivy-action@master
with:
scan-type: fs
scan-ref: .
exit-code: 1
list-all-pkgs: true
format: json
output: trivy-report.json
- name: Show report in human-readable format
uses: aquasecurity/trivy-action@master
with:
scan-type: convert
vuln-type: ''
severity: ''
image-ref: trivy-report.json
format: table
- name: Convert report to sarif
if: ${{ inputs.upload-to-github-security-tab }}
uses: aquasecurity/trivy-action@master
with:
scan-type: convert
vuln-type: ''
severity: ''
image-ref: trivy-report.json
format: sarif
output: trivy-report.sarif
- name: Upload sarif report to GitHub Security tab
if: ${{ inputs.upload-to-github-security-tab }}
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-report.sarif
- name: Convert report to csv
if: ${{ inputs.export-csv }}
uses: aquasecurity/trivy-action@master
with:
scan-type: convert
vuln-type: ''
severity: ''
image-ref: trivy-report.json
format: template
template: "@.github/workflows/trivy-csv.tpl"
output: trivy-report.csv
- name: Upload CSV report as an artifact
if: ${{ inputs.export-csv }}
uses: actions/upload-artifact@v4
with:
name: trivy-report
path: trivy-report.csv
================================================
FILE: .github/workflows/common-verify-code.yaml
================================================
name: Verify code
on:
- workflow_call
permissions:
contents: read
jobs:
build-and-test:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
id: go
- name: Install golangci-lint
run: curl -sfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.64.7
- name: Gofmt
run: make format
- name: Build
run: make
- name: Test
run: make test
- name: Golangci-lint
run: |
export PATH=$PATH:$(go env GOPATH)/bin
make golangci-lint
- name: Codecov report
run: bash <(curl -s https://codecov.io/bash)
trivy-scan:
uses: "./.github/workflows/common-trivy.yaml"
permissions:
contents: read
security-events: write
with:
upload-to-github-security-tab: true
codeql-scan:
uses: "./.github/workflows/common-codeql.yaml"
permissions:
contents: read
security-events: write
================================================
FILE: .github/workflows/publish-devel-images.yaml
================================================
name: Build and publish devel container images
on:
push:
branches: ["master"]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
trivy-scan:
uses: "./.github/workflows/common-trivy.yaml"
permissions:
contents: read
security-events: write
publish-images:
uses: "./.github/workflows/common-build-images.yaml"
needs: [trivy-scan]
secrets: inherit
with:
publish: true
image-tag: "devel"
github-environment: "staging"
================================================
FILE: .github/workflows/publish-docs.yml
================================================
name: Publish documentation
on:
push:
branches:
- master
- release-*
# Path filters are ignored for tags
paths:
- "docs/**"
- "Makefile"
tags:
- v*
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false
jobs:
update-gh-pages:
uses: "./.github/workflows/common-build-docs.yaml"
permissions:
contents: write
with:
publish: true
================================================
FILE: .github/workflows/release.yaml
================================================
name: Build and publish release artifacts
on:
push:
tags: [ 'v*' ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
trivy-scan:
uses: "./.github/workflows/common-trivy.yaml"
permissions:
contents: read
security-events: write
with:
export-csv: true
codeql:
uses: "./.github/workflows/common-codeql.yaml"
permissions:
contents: read
security-events: write
with:
export-report: true
publish-images:
uses: "./.github/workflows/common-build-images.yaml"
needs: [trivy-scan]
secrets: inherit
with:
publish: true
image-tag: ${{ github.ref_name }}
github-environment: "release"
build-packages:
needs: [trivy-scan]
permissions:
contents: write
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build packages
run: "make cross-packages Q="
- name: Build vendored dist tarball
run: "make vendored-dist Q="
- name: Upload release assets
uses: softprops/action-gh-release@v1
with:
name: ${{ github.ref_name }}
draft: true
append_body: true
files: |
packages/release-assets/*
vendored-cri-resource-manager-*.tar.gz
================================================
FILE: .github/workflows/trivy-csv.tpl
================================================
{{ range . }}
Trivy Vulnerability Scan Results ({{- .Target -}})
VulnerabilityID,Severity,CVSS Score,Title,Library,Vulnerable Version,Fixed Version,Information URL,Triage Information
{{ range .Vulnerabilities }}
{{- .VulnerabilityID }},
{{- .Severity }},
{{- range $key, $value := .CVSS }}
{{- if (eq $key "nvd") }}
{{- .V3Score -}}
{{- end }}
{{- end }},
{{- quote .Title }},
{{- quote .PkgName }},
{{- quote .InstalledVersion }},
{{- quote .FixedVersion }},
{{- .PrimaryURL }}
{{ else -}}
No vulnerabilities found at this time.
{{ end }}
Trivy Dependency Scan Results ({{ .Target }})
ID,Name,Version,Notes
{{ range .Packages -}}
{{- quote .ID }},
{{- quote .Name }},
{{- quote .Version }}
{{ else -}}
No dependencies found at this time.
{{ end }}
{{ end }}
================================================
FILE: .github/workflows/verify-periodic.yaml
================================================
name: Verify branches periodic
on:
schedule:
- cron: '30 2 * * 0'
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
verify-code:
uses: "./.github/workflows/common-verify-code.yaml"
permissions:
contents: read
security-events: write
================================================
FILE: .github/workflows/verify-pr-code.yaml
================================================
name: Verify code
on:
pull_request
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
verify:
uses: "./.github/workflows/common-verify-code.yaml"
permissions:
contents: read
security-events: write
================================================
FILE: .github/workflows/verify-pr-docs.yaml
================================================
name: Verify documentation
on:
pull_request:
paths:
- "docs/**"
- "Makefile"
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
verify-docs:
uses: "./.github/workflows/common-build-docs.yaml"
permissions:
contents: write
security-events: write
================================================
FILE: .gitignore
================================================
*~
*.swp
*_gendata.go
/bin
coverage.html
coverage.txt
.git-hooks.redirected
*.tar
*.tar.*
*.spec
.static.*
/debian
/packages
/_build
/_work
*.stamp
test/e2e/**/output
================================================
FILE: CODEOWNERS
================================================
* @kad @klihub @marquiz @mythi @askervin @jukkar @fmuyassarov
================================================
FILE: Jenkinsfile
================================================
pipeline {
agent {
label "cri-rm"
}
environment {
IMAGE_REPO = "cloud-native-image-registry.westus.cloudapp.azure.com"
}
stages {
stage('Build and push images') {
steps {
script {
withDockerRegistry([credentialsId: "${env.DOCKER_REGISTRY}", url: "https://${env.IMAGE_REPO}"]) {
if (env.BRANCH_NAME == 'master') {
sh "make images-push IMAGE_REPO=${env.IMAGE_REPO} IMAGE_VERSION=devel Q="
} else {
sh "make images-push IMAGE_REPO=${env.IMAGE_REPO} Q="
}
}
}
}
}
}
}
================================================
FILE: LICENSE
================================================
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
================================================
FILE: Makefile
================================================
# We use bashisms in this Makefile.
SHELL := /bin/bash
# Go compiler/toolchain and extra related binaries we ues/need.
GO_PARALLEL :=
GO_CMD := go
GO_BUILD := $(GO_CMD) build $(GO_PARALLEL)
GO_GEN := $(GO_CMD) generate -x
GO_INSTALL := $(GO_CMD) install
GO_FMT := gofmt
GO_CYCLO := gocyclo
GO_LINT := golint
GO_CILINT := golangci-lint
GO_VERSION ?= 1.24.1
GOLICENSES_VERSION ?= v1.5.0
# TEST_TAGS is the set of extra build tags passed for tests.
# We disable AVX collector for tests by default.
TEST_TAGS := noavx,test
GO_TEST := $(GO_CMD) test $(GO_PARALLEL) -tags $(TEST_TAGS)
GO_VET := $(GO_CMD) vet -tags $(TEST_TAGS)
TEST_SETUP := test-setup.sh
TEST_CLEANUP := test-cleanup.sh
# Disable some golangci_lint checkers for now until we have an more acceptable baseline...
GO_CILINT_CHECKERS := -D unused,staticcheck,errcheck,deadcode,structcheck,gosimple,revive -E gofmt
GO_CILINT_RUNFLAGS := --build-tags $(TEST_TAGS)
# Protoc compiler and protobuf definitions we might need to recompile.
PROTOC := $(shell command -v protoc;)
PROTOBUFS = $(shell find cmd pkg -name \*.proto)
PROTOCODE := $(patsubst %.proto,%.pb.go,$(PROTOBUFS))
PROTO_INCLUDE = -I$(PWD):/usr/local/include:/usr/include
PROTO_OPTIONS = --proto_path=. $(PROTO_INCLUDE) \
--go_opt=paths=source_relative --go_out=. \
--go-grpc_opt=paths=source_relative --go-grpc_out=.
PROTO_COMPILE = $(PROTOC) $(PROTO_OPTIONS)
# ShellCheck for checking shell scripts.
SHELLCHECK := shellcheck
CLANG := clang
KERNEL_VERSION ?= $(shell uname -r)
KERNEL_HEADERS_DIR ?= /lib/modules/$(KERNEL_VERSION)/source
KERNEL_BUILD_DIR ?= /lib/modules/$(KERNEL_VERSION)/build
# Directory for full kernel sources
KERNEL_SRC_DIR ?= /usr/src/linux
# Binaries and directories for installation.
INSTALL := install
PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
UNITDIR ?= $(PREFIX)/lib/systemd/system
DOCDIR ?= $(PREFIX)/share/doc/cri-resource-manager
SYSCONFDIR ?= /etc
CONFIGDIR ?= /etc/cri-resmgr
DEFAULTDIR ?= $(shell \
[ -d /etc/rpm ] && { echo /etc/sysconfig; exit 0; }; \
[ -f /etc/debian_version ] && { echo /etc/default; exit 0; }; \
echo unknown; exit 1)
# Directories (in cmd) with go code we'll want to build and install.
BUILD_DIRS = $(shell find cmd -name \*.go | sed 's:cmd/::g;s:/.*::g' | uniq)
BUILD_BINS = $(foreach dir,$(BUILD_DIRS),bin/$(dir))
# Directories (in cmd) with go code we'll want to create Docker images from.
IMAGE_DIRS = $(shell find cmd -name Dockerfile | sed 's:cmd/::g;s:/.*::g' | uniq)
IMAGE_VERSION := $(shell git describe --dirty 2> /dev/null || echo unknown)
ifdef IMAGE_REPO
override IMAGE_REPO := $(IMAGE_REPO)/
endif
# List of our active go modules.
GO_LIST_MODULES := $(GO_CMD) list ./... | grep -v vendor/
GO_PKG_SRC = $(shell find pkg -name \*.go)
# List of visualizer collateral files to go generate.
UI_ASSETS := $(shell for i in pkg/cri/resource-manager/visualizer/*; do \
if [ -d "$$i" -a -e "$$i/assets_generate.go" ]; then \
echo $$i/assets_gendata.go; \
fi; \
done)
# Right now we don't depend on libexec/%.o on purpose so make sure the file
# is always up-to-date when elf/avx512.c is changed.
GEN_TARGETS := pkg/avx/programbytes_gendata.go $(PROTOCODE)
# Determine binary version and buildid, and versions for rpm, deb, and tar packages.
BUILD_VERSION := $(shell scripts/build/get-buildid --version --shell=no)
BUILD_BUILDID := $(shell scripts/build/get-buildid --buildid --shell=no)
RPM_VERSION := $(shell scripts/build/get-buildid --rpm --shell=no)
DEB_VERSION := $(shell scripts/build/get-buildid --deb --shell=no)
TAR_VERSION := $(shell scripts/build/get-buildid --tar --shell=no)
# Kubernetes version we pull in as modules and our external API versions.
KUBERNETES_VERSION := $(shell grep 'k8s.io/kubernetes ' go.mod | sed 's/^.* //')
RESMGR_API_VERSION := $(shell ls pkg/apis/resmgr | grep '^v[0-9]*')
# Git (tagged) version and revisions we'll use to linker-tag our binaries with.
RANDOM_ID := "$(shell head -c20 /dev/urandom | od -An -tx1 | tr -d ' \n')"
ifdef STATIC
STATIC_LDFLAGS:=-extldflags=-static
BUILD_TAGS:=-tags osusergo,netgo
endif
LDFLAGS = \
-ldflags "$(STATIC_LDFLAGS) -X=github.com/intel/cri-resource-manager/pkg/version.Version=$(BUILD_VERSION) \
-X=github.com/intel/cri-resource-manager/pkg/version.Build=$(BUILD_BUILDID) \
-B 0x$(RANDOM_ID)"
# Build non-optimized version for debugging on make DEBUG=1.
DEBUG ?= 0
ifeq ($(DEBUG),1)
GCFLAGS=-gcflags "all=-N -l"
else
GCFLAGS=
endif
# Release/end-to-end testing. Specify E2E_TESTS to override the default test set.
E2E_RUN := reinstall_cri_resmgr=1 test/e2e/run_tests.sh
# tar-related commands and options.
TAR := tar
TAR_UPDATE := $(TAR) -uf
GZIP := gzip
GZIP_DC := gzip -dc
GZEXT := .gz
# Metadata for packages, changelog, etc.
USER_NAME ?= $(shell git config user.name)
USER_EMAIL ?= $(shell git config user.email)
BUILD_DATE ?= $(shell date -R)
# RPM spec files we might want to generate.
SPEC_FILES = $(shell find packaging -name \*.spec.in | sed 's/.spec.in/.spec/g' | uniq)
# Systemd collateral.
SYSTEMD_DIRS = $(shell find cmd -name \*.service -o -name \*.socket | sed 's:cmd/::g;s:/.*::g'|uniq)
SYSCONF_DIRS = $(shell find cmd -name \*.sysconf | sed 's:cmd/::g;s:/.*::g' | uniq)
DOCKER := docker
# Extra options to pass to docker (for instance --network host).
DOCKER_OPTIONS =
# Set this to empty to prevent 'docker build' from trying to pull all image refs.
DOCKER_PULL := --pull
# Docker boilerplate/commands to build debian/ubuntu packages.
DOCKER_DEB_BUILD := \
cd /build && \
tar -xvf /build/input/cri-resource-manager-$(TAR_VERSION).tar.gz && \
cd cri-resource-manager-$(TAR_VERSION) && \
cp -r /build/input/debian . && \
dpkg-buildpackage -uc && \
cp ../*.{buildinfo,changes,deb,dsc} /output
# Docker boilerplate/commands to build rpm packages.
DOCKER_RPM_BUILD := \
mkdir -p ~/rpmbuild/{SOURCES,SPECS} && \
cp -v /build/input/*.spec ~/rpmbuild/SPECS && \
cp -v /build/input/*.tar.* ~/rpmbuild/SOURCES && \
for spec in ~/rpmbuild/SPECS/*.spec; do \
rpmbuild -bb $$spec; \
done && \
cp -v $$(rpm --eval %{_rpmdir}/%{_arch})/*.rpm /output
# Docker boilerplate/commands to build binary tarballs.
DOCKER_TAR_BUILD := \
cd ~ && \
$(GZIP_DC) /build/input/cri-resource-manager-$(TAR_VERSION).tar$(GZ_EXT) | \
$(TAR) -xf - && \
cd cri-resource-manager-$(TAR_VERSION) && \
$(MAKE) OUTPUT=/output/ binary-dist
# Docker boilerplate/commands to build binaries.
DOCKER_BIN_BUILD := \
mkdir ~/build && cd ~/build && \
tar -xvzf /build/input/cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) && \
cd cri-resource-manager-$(TAR_VERSION) && \
make && \
cp -v bin/* /output
# Documentation-related variables
SPHINXOPTS ?= -W
SPHINXBUILD = sphinx-build
SITE_BUILDDIR ?= _build
# Docker base command for working with html documentation.
DOCKER_SITE_BUILDER_IMAGE := cri-resmgr-site-builder
DOCKER_SITE_CMD := $(DOCKER) run --rm -v "`pwd`:/docs" --user=`id -u`:`id -g` \
-p 8081:8081 \
-e SITE_BUILDDIR=$(SITE_BUILDDIR) -e SPHINXOPTS=$(SPHINXOPTS)
# Supported distros with debian native packaging format.
SUPPORTED_DEB_DISTROS := $(shell \
grep -l 'apt-get ' dockerfiles/cross-build/Dockerfile.* | \
egrep -v '((~)|(swp))$$' | \
sed 's:^.*Dockerfile.::g')
# Supported distros with rpm native packaging format.
SUPPORTED_RPM_DISTROS := $(shell \
egrep -l '(dnf )|(yum )|(zypper )' dockerfiles/cross-build/Dockerfile.* | \
egrep -v '((~)|(swp))$$' | \
sed 's:^.*Dockerfile.::g')
# Directory to leave built distro packages and collateral in.
PACKAGES_DIR := packages
# Directory to leave build distro binaries in.
BINARIES_DIR := binaries
# Directory to use to build distro packages.
BUILD_DIR := build
# dist tarball target name
ifneq ($(wildcard .git/.),)
DIST_TARGET = dist-git
else
DIST_TARGET = dist-cwd
endif
# Paths to exclude from tarballs generated by dist-cwd.
DIST_EXCLUDE := \
--exclude="./$$tarball*" \
--exclude='./cri-resource-manager-*' \
--exclude='./$(PACKAGES_DIR)*' \
--exclude='./$(BUILD_DIR)*'
# Path name transformations for tarballs generated by dist-cwd.
DIST_TRANSFORM := \
--transform='s:^.:cri-resource-manager-$(TAR_VERSION):'
# Determine distro ID, version and package type.
DISTRO_ID := $(shell . /etc/os-release; echo "$${ID:-unknown}")
DISTRO_VERSION := $(shell . /etc/os-release; echo "$${VERSION_ID:-unknown}")
DISTRO_PACKAGE := $(shell echo $(DISTRO_ID) | tr -d ' \t' | \
sed -E 's/.*((fedora)|(suse)).*/rpm/;s/.*((ubuntu)|(debian)).*/deb/')
# Be quiet by default but let folks override it with Q= or V=1 on the command line.
ifneq ($(V),1)
Q := @
endif
# Default target: just build everything.
all: build
#
# Generic targets: build, install, clean, build images.
#
build: $(BUILD_BINS)
build-static:
$(MAKE) STATIC=1 build
install: $(BUILD_BINS) $(foreach dir,$(BUILD_DIRS),install-bin-$(dir)) \
$(foreach dir,$(BUILD_DIRS),install-systemd-$(dir)) \
$(foreach dir,$(BUILD_DIRS),install-sysconf-$(dir)) \
$(foreach dir,$(BUILD_DIRS),install-config-$(dir))
clean: clean-bin clean-spec clean-deb clean-ui-assets clean-html
images: $(foreach dir,$(IMAGE_DIRS),image-$(dir))
images-push: $(foreach dir,$(IMAGE_DIRS),image-push-$(dir))
#
# Rules for building and installing binaries, or building docker images, and cleaning up.
#
KERNEL_INCLUDE_DIRS = /include \
/include/uapi \
/include/generated/uapi \
/arch/x86/include \
/arch/x86/include/uapi \
/arch/x86/include/generated/uapi
KERNEL_INCLUDES := $(strip $(foreach kernel_dir,$(KERNEL_HEADERS_DIR) $(KERNEL_BUILD_DIR),$(addprefix -I,$(wildcard $(addprefix $(kernel_dir),$(KERNEL_INCLUDE_DIRS))))))
libexec/%.o: elf/%.c
$(Q)if [ -z "$(KERNEL_INCLUDES)" ]; then echo "Cannot build $@: invalid KERNEL_HEADERS_DIR=$(KERNEL_HEADERS_DIR)"; exit 1; fi
$(Q)echo "Building $@"
$(Q)mkdir -p libexec
$(Q)$(CLANG) -nostdinc -D __KERNEL__ $(KERNEL_INCLUDES) -O2 -Wall -target bpf -c $< -o $@
bin/%: .static.%.$(STATIC)
$(Q)bin=$(notdir $@); src=./cmd/$$bin; \
echo "Building $$([ -n "$(STATIC)" ] && echo 'static ')$@ (version $(BUILD_VERSION), build $(BUILD_BUILDID))..."; \
mkdir -p bin && \
$(GO_BUILD) $(BUILD_TAGS) $(LDFLAGS) $(GCFLAGS) -o bin/ $$src
.static.%.$(STATIC):
$(Q)if [ ! -f "$@" ]; then \
touch "$@"; \
fi; \
old="$@"; old="$${old%.*}"; \
if [ -n "$(STATIC)" ]; then \
rm -f "$$old."; \
else \
rm -f "$$old.1"; \
fi
.PRECIOUS: $(foreach dir,$(BUILD_DIRS),.static.$(dir).1 .static.$(dir).)
install-bin-%: bin/%
$(Q)bin=$(patsubst install-bin-%,%,$@); dir=cmd/$$bin; \
echo "Installing $$bin in $(DESTDIR)$(BINDIR)..."; \
$(INSTALL) -d $(DESTDIR)$(BINDIR) && \
$(INSTALL) -m 0755 -t $(DESTDIR)$(BINDIR) bin/$$bin; \
install-systemd-%:
$(Q)bin=$(patsubst install-systemd-%,%,$@); dir=cmd/$$bin; \
echo "Installing systemd collateral for $$bin..."; \
$(INSTALL) -d $(DESTDIR)$(UNITDIR) && \
for f in $$(find $$dir -name \*.service -o -name \*.socket); do \
echo " $$f in $(DESTDIR)$(UNITDIR)..."; \
$(INSTALL) -m 0644 -t $(DESTDIR)$(UNITDIR) $$f.in; \
done; \
for f in $$(find $$dir -name \*.service.in -o -name \*.socket.in); do \
echo " $$f in $(DESTDIR)$(UNITDIR)..."; \
df=$${f##*/}; df=$${df%.in}; \
$(INSTALL) -m 0644 -T $$f $(DESTDIR)$(UNITDIR)/$$df; \
sed -E -i -e "s:__DEFAULTDIR__:$(DEFAULTDIR):g" \
-e "s:__BINDIR__:$(BINDIR):g" $(DESTDIR)$(UNITDIR)/$$df; \
done
install-sysconf-%:
$(Q)bin=$(patsubst install-sysconf-%,%,$@); dir=cmd/$$bin; \
echo "Installing sysconf/default collateral for $$bin..."; \
$(INSTALL) -d $(DESTDIR)$(DEFAULTDIR) && \
for f in $$(find $$dir -name \*.sysconf); do \
echo " $$f in $(DESTDIR)$(DEFAULTDIR)..."; \
df=$${f##*/}; df=$${df%.sysconf}; \
$(INSTALL) -m 0644 -T $$f $(DESTDIR)$(DEFAULTDIR)/$$df; \
done
install-config-%:
$(Q)bin=$(patsubst install-config-%,%,$@); dir=cmd/$$bin; \
echo "Installing sample configuration collateral for $$bin..."; \
$(INSTALL) -d $(DESTDIR)$(CONFIGDIR) && \
for f in $$(find $$dir -name \*.cfg.sample); do \
echo " $$f in $(DESTDIR)$(CONFIGDIR)..."; \
df=$${f##*/}; \
$(INSTALL) -m 0644 -T $$f $(DESTDIR)$(CONFIGDIR)/$${df}; \
done
install-minimal-docs:
$(Q)echo "Installing minimal documentation to $(DOCDIR)..."; \
$(INSTALL) -d $(DESTDIR)$(DOCDIR) && \
for f in LICENSE docs/security.md; do \
echo " $$f in $(DESTDIR)$(DOCDIR)..."; \
df=$${f##*/}; \
$(INSTALL) -m 0644 -T $$f $(DESTDIR)$(DOCDIR)/$${df}; \
done
install-licenses:
$(Q)for cmd in $(BUILD_DIRS); do \
install -D LICENSE $(DESTDIR)/licenses/$$cmd/LICENSE && \
go-licenses save ./cmd/$$cmd \
--ignore github.com/intel/cri-resource-manager \
--save_path $(DESTDIR)/licenses/$$cmd/go-licenses; \
done
clean-bin: $(foreach dir,$(BUILD_DIRS),clean-$(dir))
$(Q)rm -f .static.*
clean-%:
$(Q)bin=$(patsubst clean-%,%,$@); src=cmd/$$bin; \
echo "Cleaning up $$bin..."; \
rm -f bin/$$bin
clean-gen:
$(Q)rm -f $(GEN_TARGETS)
image-%:
$(Q)bin=$(patsubst image-%,%,$@); \
$(DOCKER) build . -f "cmd/$$bin/Dockerfile" \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg GOLICENSES_VERSION=$(GOLICENSES_VERSION) \
-t $(IMAGE_REPO)$$bin:$(IMAGE_VERSION)
image-push-%:
$(Q)bin=$(patsubst image-push-%,%,$@); \
if [ -z "$(IMAGE_REPO)" ]; then echo "ERROR: no IMAGE_REPO specified"; exit 1; fi; \
$(DOCKER) push $(IMAGE_REPO)$$bin:$(IMAGE_VERSION)
#
# Rules for format checking, various code quality and complexity checks and measures.
#
format:
$(Q)report=`$(GO_FMT) -s -d -w $$(find cmd pkg test/functional -name \*.go)`; \
if [ -n "$$report" ]; then \
echo "$$report"; \
exit 1; \
fi
vet:
$(Q)$(GO_VET) $(shell $(GO_LIST_MODULES))
cyclomatic-check:
$(Q)report=`$(GO_CYCLO) -over 15 cmd pkg`; \
if [ -n "$$report" ]; then \
echo "Complexity is over 15 in"; \
echo "$$report"; \
exit 1; \
fi
lint:
$(Q)rc=0; \
for f in $$(find -name \*.go | grep -v \.\/vendor); do \
$(GO_LINT) -set_exit_status $$f || rc=1; \
done; \
exit $$rc
golangci-lint:
$(Q)$(GO_CILINT) run $(GO_CILINT_RUNFLAGS) $(GO_CILINT_CHECKERS)
shellcheck:
$(Q)for f in $$(git grep -n '^#!/bin/.*sh *' | grep ':1:#!' | sed 's/:1:.*//'); do \
echo "shellchecking $$f..."; \
$(SHELLCHECK) $$f; \
done
#
# Rules for running unit/module tests.
#
test: test-setup test-run test-cleanup
race-test racetest: test-setup racetest-run test-cleanup
test-setup:
$(Q)for i in $$(find . -name $(TEST_SETUP)); do \
echo "+ Running test setup $$i..."; \
(cd $${i%/*}; \
if [ -x "$(TEST_SETUP)" ]; then \
./$(TEST_SETUP); \
fi); \
done
test-cleanup:
$(Q)for i in $$(find . -name $(TEST_CLEANUP)); do \
echo "- Running test cleanup $$i..."; \
(cd $${i%/*}; \
if [ -x "$(TEST_CLEANUP)" ]; then \
./$(TEST_CLEANUP); \
fi); \
done
test-run:
ifndef WHAT
$(Q)$(GO_TEST) -race -coverprofile=coverage.txt -covermode=atomic \
$(shell $(GO_LIST_MODULES))
else
$(Q)if [ -n '$(TESTS)' ]; then \
run="-run $(TESTS)"; \
fi; \
cd $(WHAT) && \
$(GO_TEST) $$run -v -cover -coverprofile cover.out || rc=1; \
$(GO_CMD) tool cover -html=cover.out -o coverage.html; \
rm cover.out; \
echo "Coverage report: file://$$(realpath coverage.html)"; \
exit $$rc
endif
racetest-run:
ifndef WHAT
$(Q)$(GO_TEST) -race -coverprofile=coverage.txt -covermode=atomic \
$(shell $(GO_LIST_MODULES))
else
$(Q)cd $(WHAT) && \
$(GO_TEST) -race -coverprofile=cover.out -covermode=atomic || rc=1; \
$(GO_CMD) tool cover -html=cover.out -o coverage.html; \
rm cover.out; \
echo "Coverage report: file://$$(realpath coverage.html)"; \
exit $$rc
endif
release-tests: e2e-tests
e2e-tests: build-static
$(Q)tests="$(if $(E2E_TESTS),$(E2E_TESTS),test/e2e/policies.test-suite)"; \
$(E2E_RUN) $$tests; \
if [ "$$?" != "0" ]; then \
echo "You drop into interactive mode upon failures if you run e2e tests as"; \
echo " on_verify_fail=interactive $(E2E_RUN) $$tests"; \
exit 1; \
fi
packaging-tests: cross-packages
$(Q)cleanup=1 omit_agent=1 $(E2E_RUN) test/e2e/packages.test-suite
#
# Rules for building distro packages.
#
ifneq ($(DISTRO_ID),fedora)
packages: cross-$(DISTRO_PACKAGE).$(DISTRO_ID)-$(DISTRO_VERSION)
else
packages: cross-$(DISTRO_PACKAGE).$(DISTRO_ID)
endif
cross-packages: cross-rpm cross-deb cross-tar
cross-rpm: $(foreach d,$(SUPPORTED_RPM_DISTROS),cross-rpm.$(d))
cross-deb: $(foreach d,$(SUPPORTED_DEB_DISTROS),cross-deb.$(d))
cross-bin: $(foreach d,$(SUPPORTED_RPM_DISTROS),cross-bin.$(d)) \
$(foreach d,$(SUPPORTED_DEB_DISTROS),cross-bin.$(d))
#
# Rules for building dist-tarballs, rpm, and deb packages.
#
dist: $(DIST_TARGET)
dist-git:
$(Q)echo "Using git to create dist tarball $(TAR_VERSION) from $(BUILD_BUILDID)..."; \
tardir=cri-resource-manager-$(TAR_VERSION) && \
tarball=cri-resource-manager-$(TAR_VERSION).tar && \
git archive --format=tar --prefix=$$tardir/ HEAD > $$tarball && \
mkdir -p $$tardir && \
echo $(BUILD_VERSION) > $$tardir/version && \
echo $(BUILD_BUILDID) > $$tardir/buildid && \
$(TAR) -uf $$tarball $$tardir && \
rm -f $$tarball.* && \
$(GZIP) $$tarball && \
rm -fr $$tardir
dist-cwd:
$(Q)echo "Using tar to create dist tarball $(TAR_VERSION) from $$(pwd)..."; \
tardir=cri-resource-manager-$(TAR_VERSION) && \
tarball=cri-resource-manager-$(TAR_VERSION).tar && \
$(TAR) $(DIST_EXCLUDE) $(DIST_TRANSFORM) -cvf - . > $$tarball && \
mkdir -p $$tardir && \
echo $(BUILD_VERSION) > $$tardir/version && \
echo $(BUILD_BUILDID) > $$tardir/buildid && \
$(TAR_UPDATE) $$tarball $$tardir && \
rm -f $$tarball.* && \
$(GZIP) $$tarball && \
rm -fr $$tardir
vendored-dist: dist
$(Q)echo "Creating vendored dist tarball $(TAR_VERSION)..."; \
tardir=cri-resource-manager-$(TAR_VERSION) && \
tarball=cri-resource-manager-$(TAR_VERSION).tar && \
cp $$tarball$(GZEXT) vendored-$$tarball$(GZEXT) && \
$(GZIP_DC) vendored-$$tarball$(GZEXT) | tar -xf - && \
go mod vendor -v && \
mkdir -p $$tardir && \
mv vendor $$tardir && \
rm -f vendored-$$tarball* && \
$(TAR) -cf vendored-$$tarball $$tardir && \
$(GZIP) vendored-$$tarball && \
rm -fr $$tardir
binary-dist:
$(Q)tarball=$(OUTPUT)cri-resource-manager-$(TAR_VERSION).$$(uname -m).tar; \
echo "Creating binary dist tarball $$tarball..."; \
tardir=binary-dist; \
rm -fr $$tarball* $$tardir && \
$(MAKE) DESTDIR=$$tardir \
BUILD_DIRS=cri-resmgr \
PREFIX=/opt/intel \
DEFAULTDIR=/etc/default \
UNITDIR=$(SYSCONFDIR)/systemd/system install install-minimal-docs && \
$(MAKE) DESTDIR=$$tardir/opt/intel/ install-licenses && \
$(TAR) -C $$tardir -cf $$tarball . && \
$(GZIP) $$tarball && \
rm -fr $$tardir
spec: clean-spec $(SPEC_FILES)
%.spec:
$(Q)echo "Generating RPM spec file $@..."; \
cp $@.in $@ && \
sed -E -i -e "s/__VERSION__/$(RPM_VERSION)/g" \
-e "s/__TARVERSION__/$(TAR_VERSION)/g" \
-e "s/__BUILDID__/$(BUILD_BUILDID)/g" $@
clean-spec:
$(Q)rm -f $(SPEC_FILES)
cross-rpm.%: docker/cross-build/% clean-spec spec dist
$(Q)distro=$(patsubst cross-rpm.%,%,$@); \
builddir=$(BUILD_DIR)/docker/$$distro; \
outdir=$(PACKAGES_DIR)/$$distro; \
echo "Docker cross-building $$distro packages..."; \
mkdir -p $(PACKAGES_DIR)/$$distro && \
rm -fr $$builddir && mkdir -p $$builddir/{input,build} && \
cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) $$builddir/input && \
cp packaging/rpm/cri-resource-manager.spec $$builddir/input && \
$(DOCKER) run --rm $(DOCKER_OPTIONS) --user $$USER \
--env USER_NAME="$(USER_NAME)" --env USER_EMAIL=$(USER_EMAIL) \
-v $$(pwd)/$$builddir:/build \
-v $$(pwd)/$$outdir:/output \
-v "`go env GOMODCACHE`:/home/$$USER/go/pkg/mod" \
$$distro-build /bin/bash -c '$(DOCKER_RPM_BUILD)' && \
rm -fr $$builddir && \
install -D -m644 $$outdir/cri-resource-manager-$(RPM_VERSION)-0.x86_64.rpm $(PACKAGES_DIR)/release-assets/cri-resource-manager-$(RPM_VERSION)-0.$$distro.x86_64.rpm
src.rpm source-rpm: spec dist
mkdir -p ~/rpmbuild/{SOURCES,SPECS} && \
cp packaging/rpm/cri-resource-manager.spec ~/rpmbuild/SPECS && \
cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) ~/rpmbuild/SOURCES && \
rpmbuild -bs ~/rpmbuild/SPECS/cri-resource-manager.spec
rpm: source-rpm
rpmbuild -bb ~/rpmbuild/SPECS/cri-resource-manager.spec
debian/%: packaging/deb.in/%
$(Q)echo "Generating debian packaging file $@..."; \
tardir=cri-resource-manager-$(TAR_VERSION) && \
tarball=cri-resource-manager-$(TAR_VERSION).tar && \
mkdir -p debian; \
cp $< $@ && \
sed -E -i -e "s/__PACKAGE__/cri-resource-manager/g" \
-e "s/__TARBALL__/$$tarball/g" \
-e "s/__VERSION__/$(DEB_VERSION)/g" \
-e "s/__AUTHOR__/$(USER_NAME)/g" \
-e "s/__EMAIL__/$(USER_EMAIL)/g" \
-e "s/__DATE__/$(BUILD_DATE)/g" $@
clean-deb:
$(Q)rm -fr debian
cross-deb.%: docker/cross-build/% \
clean-deb debian/changelog debian/control debian/rules debian/compat dist
$(Q)distro=$(patsubst cross-deb.%,%,$@); \
echo "Docker cross-building $$distro packages..."; \
builddir=$(BUILD_DIR)/docker/$$distro; \
outdir=$(PACKAGES_DIR)/$$distro; \
mkdir -p $(PACKAGES_DIR)/$$distro && \
rm -fr $$builddir && mkdir -p $$builddir/{input,build} && \
cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) $$builddir/input && \
cp -r debian $$builddir/input && \
$(DOCKER) run --rm $(DOCKER_OPTIONS) --user $$USER \
--env USER_NAME="$(USER_NAME)" --env USER_EMAIL=$(USER_EMAIL) \
-v $$(pwd)/$$builddir:/build \
-v $$(pwd)/$$outdir:/output \
-v "`go env GOMODCACHE`:/home/$$USER/go/pkg/mod" \
$$distro-build /bin/bash -c '$(DOCKER_DEB_BUILD)' && \
rm -fr $$builddir && \
install -D -m644 $$outdir/cri-resource-manager_$(DEB_VERSION)_amd64.deb $(PACKAGES_DIR)/release-assets/cri-resource-manager_$(DEB_VERSION)_$${distro}_amd64.deb
deb: debian/changelog debian/control debian/rules debian/compat dist
dpkg-buildpackage -uc
cross-bin.%: docker/cross-build/% dist
$(Q)distro=$(patsubst cross-bin.%,%,$@); \
echo "Docker cross-building $$distro binaries..."; \
builddir=$(BUILD_DIR)/docker/$$distro; \
outdir=$(BINARIES_DIR)/$$distro; \
mkdir -p $(BINARIES_DIR)/$$distro && \
rm -fr $$builddir && mkdir -p $$builddir/{input,build} && \
cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) $$builddir/input && \
$(DOCKER) run --rm $(DOCKER_OPTIONS) --user $$USER \
--env USER_NAME="$(USER_NAME)" --env USER_EMAIL=$(USER_EMAIL) \
-v $$(pwd)/$$builddir:/build \
-v $$(pwd)/$$outdir:/output \
-v "`go env GOMODCACHE`:/home/$$USER/go/pkg/mod" \
$$distro-build /bin/bash -c '$(DOCKER_BIN_BUILD)' && \
rm -fr $$builddir
cross-tar cross-tarball: dist docker/cross-build/fedora
$(Q)distro=tarball; \
builddir=$(BUILD_DIR)/docker/$$distro; \
outdir=$(PACKAGES_DIR)/$$distro; \
echo "Docker cross-building $$distro packages..."; \
mkdir -p $$outdir && \
rm -fr $$builddir && mkdir -p $$builddir/{input,build} && \
cp cri-resource-manager-$(TAR_VERSION).tar$(GZEXT) $$builddir/input && \
$(DOCKER) run --rm $(DOCKER_OPTIONS) --user $$USER \
--env USER_NAME="$(USER_NAME)" --env USER_EMAIL=$(USER_EMAIL) \
-v $$(pwd)/$$builddir:/build \
-v $$(pwd)/$$outdir:/output \
-v "`go env GOMODCACHE`:/home/$$USER/go/pkg/mod" \
fedora-build /bin/bash -c '$(DOCKER_TAR_BUILD)' && \
rm -fr $$builddir && \
install -D -m644 -t $(PACKAGES_DIR)/release-assets $$outdir/cri-resource-manager-$(TAR_VERSION).x86_64.tar.gz
# Build a docker image (for distro cross-building).
docker/cross-build/%: dockerfiles/cross-build/Dockerfile.%
$(Q)distro=$(patsubst docker/cross-build/%,%,$@) && \
echo "Building cross-build docker image for $$distro..." && \
img=$${distro}-build && $(DOCKER) rm $$distro-build || : && \
scripts/build/docker-build-image $$distro-build \
$(DOCKER_PULL) \
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg GOLICENSES_VERSION=$(GOLICENSES_VERSION) \
$(DOCKER_OPTIONS)
# Rule for recompiling a changed protobuf.
%.pb.go: %.proto
$(Q)if [ -n "$(PROTOC)" -o ! -e "$@" ]; then \
echo "Generating go code ($@) for updated protobuf $<..."; \
$(PROTO_COMPILE) $<; \
else \
echo "WARNING: no protoc found, compiling with OUTDATED $@..."; \
fi
# Rule for installing in-repo git hooks.
install-git-hooks:
$(Q)if [ -d .git -a ! -e .git-hooks.redirected ]; then \
echo -n "Redirecting git hooks to .githooks..."; \
git config core.hookspath .githooks && \
touch .git-hooks.redirected && \
echo "done."; \
fi
# Rules for installing protoc and related utilities.
install-protoc:
$(Q)./scripts/hack/install-protobuf
install-protoc-gen-go:
$(Q)$(GO_INSTALL) google.golang.org/protobuf/cmd/protoc-gen-go@v1.28.0
install-protoc-gen-go-grpc:
$(Q)$(GO_INSTALL) google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2.0
install-protoc-tools: install-protoc install-protoc-gen-go install-protoc-gen-go-grpc
#
# go dependencies for our binaries (careful with that axe, Eugene...)
#
bin/cri-resmgr: $(wildcard cmd/cri-resmgr/*.go) $(UI_ASSETS) $(GEN_TARGETS) \
$(shell for dir in \
$(shell go list -f '{{ join .Deps "\n"}}' ./cmd/cri-resmgr/... | \
grep cri-resource-manager/pkg/ | \
sed 's#github.com/intel/cri-resource-manager/##g'); do \
find $$dir -name \*.go; \
done | sort | uniq)
bin/cri-resmgr-agent: $(wildcard cmd/cri-resmgr-agent/*.go) \
$(shell for dir in \
$(shell go list -f '{{ join .Deps "\n"}}' ./cmd/cri-resmgr-agent/... | \
grep cri-resource-manager/pkg/ | \
sed 's#github.com/intel/cri-resource-manager/##g'); do \
find $$dir -name \*.go; \
done | sort | uniq)
bin/webhook: $(wildcard cmd/cri-resmgr-webhook/*.go) \
$(shell for dir in \
$(shell go list -f '{{ join .Deps "\n"}}' ./cmd/cri-resmgr-webhook/... | \
grep cri-resource-manager/pkg/ | \
sed 's#github.com/intel/cri-resource-manager/##g'); do \
find $$dir -name \*.go; \
done | sort | uniq)
#
# rules to run go generators
#
clean-ui-assets:
$(Q)echo "Cleaning up generated UI assets..."; \
for i in $(UI_ASSETS); do \
echo " - $$i"; \
rm -f $$i; \
done
%_gendata.go::
$(Q)echo "Generating $@..."; \
cd $(dir $@) && \
$(GO_GEN) || exit 1 && \
cd - > /dev/null
pkg/sysfs/sst_types%.go: pkg/sysfs/_sst_types%.go pkg/sysfs/gen_sst_types.sh
$(Q)cd $(@D) && \
KERNEL_SRC_DIR=$(KERNEL_SRC_DIR) $(GO_GEN)
#
# API generation
#
# unconditionally generate all apis
generate-apis: generate-resmgr-api
# unconditionally generate (external) resmgr api
generate-resmgr-api:
$(Q)$(call generate-api,resmgr,$(RESMGR_API_VERSION))
# automatic update of generated code for resource-manager external api
pkg/apis/resmgr/$(RESMGR_API_VERSION)/zz_generated.deepcopy.go: \
pkg/apis/resmgr/$(RESMGR_API_VERSION)/types.go
$(Q)$(call generate-api,resmgr,$(RESMGR_API_VERSION))
# macro to generate code for api $(1), version $(2)
generate-api = \
echo "Generating '$(1)' api, version $(2)..." && \
KUBERNETES_VERSION=$(KUBERNETES_VERSION) \
./scripts/code-generator/generate-groups.sh all \
github.com/intel/cri-resource-manager/pkg/apis/$(1)/generated \
github.com/intel/cri-resource-manager/pkg/apis $(1):$(2) \
--output-base $(shell pwd)/generate && \
cp -r generate/github.com/intel/cri-resource-manager/pkg/apis/$(1) pkg/apis && \
rm -fr generate/github.com/intel/cri-resource-manager/pkg/apis/$(1)
#
# dependencies for UI assets baked in using vfsgendev (can't come up with a working pattern rule)
#
pkg/cri/resource-manager/visualizer/bubbles/assets_gendata.go:: \
$(wildcard pkg/cri/resource-manager/visualizer/bubbles/assets/*.html) \
$(wildcard pkg/cri/resource-manager/visualizer/bubbles/assets/js/*.js) \
$(wildcard pkg/cri/resource-manager/visualizer/bubbles/assets/css/*.css)
# phony targets
.PHONY: all build install clean test images images-push release-tests e2e-tests \
format vet cyclomatic-check lint golangci-lint \
cross-packages cross-rpm cross-deb \
#
# Rules for documentation
#
vhtml: _work/venv/.stamp
. _work/venv/bin/activate && \
make -C docs html && \
cp -r docs/_build .
html: clean-html
$(Q)BUILD_VERSION=$(BUILD_VERSION) \
$(SPHINXBUILD) -c docs . "$(SITE_BUILDDIR)" $(SPHINXOPTS)
cp docs/index.html "$(SITE_BUILDDIR)"
for d in $$(find docs -name figures -type d); do \
mkdir -p $(SITE_BUILDDIR)/$$d && cp $$d/* $(SITE_BUILDDIR)/$$d; \
done
serve-html: html
$(Q)cd $(SITE_BUILDDIR) && python3 -m http.server 8081
clean-html:
rm -rf $(SITE_BUILDDIR)
site-build: .$(DOCKER_SITE_BUILDER_IMAGE).image.stamp
$(Q)$(DOCKER_SITE_CMD) $(DOCKER_SITE_BUILDER_IMAGE) make html
site-serve: .$(DOCKER_SITE_BUILDER_IMAGE).image.stamp
$(Q)$(DOCKER_SITE_CMD) -it $(DOCKER_SITE_BUILDER_IMAGE) make serve-html
.$(DOCKER_SITE_BUILDER_IMAGE).image.stamp: docs/Dockerfile docs/requirements.txt
docker build -t $(DOCKER_SITE_BUILDER_IMAGE) docs
touch $@
# Set up a Python3 environment with the necessary tools for document creation.
_work/venv/.stamp: docs/requirements.txt
rm -rf ${@D}
python3 -m venv ${@D}
. ${@D}/bin/activate && pip install -r $<
touch $@
================================================
FILE: README.md
================================================
# CRI Resource Manager for Kubernetes\*
## ⚠️ The project is no longer maintained ⚠️
The CRI Resource manager project is no longer maintained. No further updates,
bug fixes or releases are planned.
We recommend users migrate to
[NRI Plugins](https://github.com/containers/nri-plugins), which provides
similar functionality and is actively maintained.
Thank you for being part of this journey!
### See our [Documentation][documentation] site for detailed documentation.
[documentation]: https://intel.github.io/cri-resource-manager
================================================
FILE: SECURITY.md
================================================
# Security Policy
Intel is committed to rapidly addressing security vulnerabilities affecting our customers and providing clear guidance on the solution, impact, severity and mitigation.
## Reporting a Vulnerability
Please report any security vulnerabilities in this project utilizing the guidelines [here](https://www.intel.com/content/www/us/en/security-center/vulnerability-handling-guidelines.html).
================================================
FILE: cmd/cri-resmgr/cri-resource-manager.service.in
================================================
[Unit]
Description=A CRI proxy with (hardware) resource aware container placement policies.
Documentation=https://github.com/intel/cri-resource-manager
Before=kubelet.service
LogRateLimitIntervalSec=5
LogRateLimitBurst=100000
[Service]
Type=simple
EnvironmentFile=__DEFAULTDIR__/cri-resource-manager
ExecStart=__BINDIR__/cri-resmgr $CONFIG_OPTIONS $POLICY_OPTIONS
Restart=always
[Install]
WantedBy=multi-user.target
================================================
FILE: cmd/cri-resmgr/cri-resource-manager.sysconf
================================================
# Configuration options to pass to cri-resmgr when started via systemd.
# Use a fallback file for configuration if/when we can't acquire one from the agent.
CONFIG_OPTIONS="--fallback-config /etc/cri-resmgr/fallback.cfg"
# Enable this for preventing the active policy to be changed during startup.
#POLICY_OPTIONS="--disable-policy-switch"
================================================
FILE: cmd/cri-resmgr/fallback.cfg.sample
================================================
#
# If you pass this file to cri-resmgr using the --fallback-config
# command line option, it will be used if configuration cannot be
# acquired from any other source (agent, or last configuration
# stored in the cache).
#
# Switching Policies:
# Recent versions of cri-resmgr will allow changing the active
# policy during startup. If you want to prevent this from hap-
# pening you can pass the --disable-policy-switch option to
# cri-resmgr on the command line.
#
# With the stock packaging you can control whether startup-
# phase policy switching is allowed using the POLICY_OPTIONS
# variable in the sysconf file.
#
# If switching policies is disabled, you can still reset the
# active policy manually when cri-resmgr is not running. This
# allows cri-resmgr to start up next with a new policy. You
# do this by passing the --reset-policy command line option
# to cri-resmgr. The full sequence of switching policies this
# way is
# - stop cri-resmgr (systemctl stop cri-resource-manager),
# - reset the active policy (cri-resmgr --reset-policy),
# - start cri-resmgr (systemctl start cri-resource-manager)
#
policy:
Active: topology-aware
ReservedResources:
CPU: 750m
logger:
Debug: resource-manager,cache,resource-control
dump:
Config: off:.*,full:((Create)|(Remove)|(Run)|(Update)|(Start)|(Stop)).*
================================================
FILE: cmd/cri-resmgr/main.go
================================================
// Copyright 2019 Intel Corporation. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package main
import (
"flag"
"fmt"
"os"
"strings"
"syscall"
"time"
"github.com/intel/goresctrl/pkg/rdt"
"github.com/intel/cri-resource-manager/pkg/cri/resource-manager"
"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/policy"
"github.com/intel/cri-resource-manager/pkg/instrumentation"
"github.com/intel/cri-resource-manager/pkg/config"
logger "github.com/intel/cri-resource-manager/pkg/log"
version "github.com/intel/cri-resource-manager/pkg/version"
)
var log = logger.Default()
func main() {
rate := logger.Rate{Limit: logger.Every(1 * time.Minute)}
logger.SetGrpcLogger("grpc", &rate)
logger.SetStdLogger("stdlog")
rdt.SetLogger(logger.Get("rdt"))
printConfig := flag.Bool("print-config", false, "Print configuration and exit.")
listPolicies := flag.Bool("list-policies", false, "List available policies.")
flag.Parse()
switch {
case *printConfig:
config.Print(nil)
os.Exit(0)
case *listPolicies:
fmt.Printf("Available policies:\n")
for _, available := range policy.AvailablePolicies() {
fmt.Printf(" * %s: %s\n", available.Name, available.Description)
}
os.Exit(0)
default:
if args := flag.Args(); len(args) > 0 {
switch args[0] {
case "config-help", "help":
config.Describe(args[1:]...)
os.Exit(0)
default:
log.Error("unknown command line arguments: %s", strings.Join(flag.Args(), ","))
flag.Usage()
os.Exit(1)
}
}
}
logger.Flush()
logger.SetupDebugToggleSignal(syscall.SIGUSR1)
log.Info("cri-resmgr (version %s, build %s) starting...", version.Version, version.Build)
if err := instrumentation.Start(); err != nil {
log.Fatal("failed to set up instrumentation: %v", err)
}
defer instrumentation.Stop()
m, err := resmgr.NewResourceManager()
if err != nil {
log.Fatal("failed to create resource manager instance: %v", err)
}
if err := m.Start(); err != nil {
log.Fatal("failed to start resource manager: %v", err)
}
for {
time.Sleep(15 * time.Second)
}
}
================================================
FILE: cmd/cri-resmgr-agent/Dockerfile
================================================
ARG GO_VERSION=1.24
FROM golang:${GO_VERSION}-bullseye as builder
ARG GOLICENSES_VERSION
WORKDIR /go/build
# Fetch go dependencies in a separate layer for caching
RUN go install github.com/google/go-licenses@${GOLICENSES_VERSION}
COPY go.mod go.sum ./
COPY pkg/topology/ pkg/topology/
RUN go mod download -x
# Build agent and agent-probe, fully statically linked binary
COPY . .
RUN CGO_ENABLED=0 make build-static BUILD_DIRS="cri-resmgr-agent cri-resmgr-agent-probe" && \
install -D /go/build/bin/* -t /install_root/bin
# Save licenses
RUN make install-licenses BUILD_DIRS="cri-resmgr-agent cri-resmgr-agent-probe" DESTDIR=/install_root
FROM scratch as final
COPY --from=builder /install_root /
ENTRYPOINT ["/bin/cri-resmgr-agent"]
================================================
FILE: cmd/cri-resmgr-agent/agent-deployment.yaml
================================================
apiVersion: v1
kind: ServiceAccount
metadata:
name: cri-resmgr-agent
namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: cri-resmgr-agent
rules:
- apiGroups:
- ""
- criresmgr.intel.com
resources:
- nodes
- configmaps
- adjustments
- labels
- annotations
verbs:
- get
- patch
- update
- watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: cri-resmgr-agent
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cri-resmgr-agent
subjects:
- kind: ServiceAccount
name: cri-resmgr-agent
namespace: kube-system
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
labels:
app: cri-resmgr-agent
name: cri-resmgr-agent
namespace: kube-system
spec:
selector:
matchLabels:
app: cri-resmgr-agent
template:
metadata:
labels:
app: cri-resmgr-agent
spec:
serviceAccount: cri-resmgr-agent
containers:
- name: cri-resmgr-agent
env:
- name: NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
image: IMAGE_PLACEHOLDER
imagePullPolicy: Always # for testing
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
readOnlyRootFilesystem: true
volumeMounts:
- name: resmgrsockets
mountPath: /var/run/cri-resmgr
resources:
limits:
cpu: 1
memory: 512Mi
livenessProbe:
exec:
command: ["/bin/cri-resmgr-agent-probe"]
initialDelaySeconds: 5
periodSeconds: 30
#
# Notes: This is NOT a readiness probe for the agent itself.
#
# We (mis)use this readiness probe to propagate information
# back to the control plane about any failure on the node to
# activate the last updated configuration. Since success or
# failure is reflected by whether the agent's pod on the node
# is marked Ready, any error in configuration should now be a
# watchable condition, at least indirectly. One can get more
# details about the specifics of any configuration errors by
# watching the readiness of the agent's and fetching its log
# messages if it ever becomes not ready.
#
readinessProbe:
exec:
command: ["/bin/cri-resmgr-agent-probe", "-query", "config-status"]
initialDelaySeconds: 5
periodSeconds: 30
volumes:
- name: resmgrsockets
hostPath:
path: /var/run/cri-resmgr
================================================
FILE: cmd/cri-resmgr-agent/main.go
================================================
/*
Copyright 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"flag"
"github.com/intel/cri-resource-manager/pkg/agent"
"github.com/intel/cri-resource-manager/pkg/log"
"github.com/intel/cri-resource-manager/pkg/version"
)
func main() {
// Disable buffering and make sure that all messages have been emitted at
// program exit
log.Flush()
defer log.Flush()
flag.Parse()
a, err := agent.NewResourceManagerAgent()
if err != nil {
log.Fatal("failed to create resource manager agent instance: %v", err)
}
log.Info("cri-resmgr agent (version %s, build %s) starting...", version.Version, version.Build)
if err := a.Run(); err != nil {
log.Fatal("%v", err)
}
}
================================================
FILE: cmd/cri-resmgr-agent-probe/main.go
================================================
/*
Copyright 2020 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"context"
"flag"
"fmt"
"net"
"time"
"google.golang.org/grpc"
agent_v1 "github.com/intel/cri-resource-manager/pkg/agent/api/v1"
v1 "github.com/intel/cri-resource-manager/pkg/agent/api/v1"
"github.com/intel/cri-resource-manager/pkg/cri/resource-manager/sockets"
"github.com/intel/cri-resource-manager/pkg/log"
)
func main() {
socket := flag.String("agent-socket", sockets.ResourceManagerAgent, "Unix domain socket where agent is serving")
query := flag.String("query", "", fmt.Sprintf("query to send, use %q to query status of last config push to resmgr", v1.ConfigStatus))
// Disable logger buffering and make sure that everything has been flushed
// when program exits
log.Flush()
defer log.Flush()
flag.Parse()
// Try to connect to agent
dialOpts := []grpc.DialOption{
grpc.WithInsecure(),
grpc.WithDialer(func(sock string, timeout time.Duration) (net.Conn, error) {
return net.Dial("unix", sock)
}),
}
conn, err := grpc.Dial(*socket, dialOpts...)
if err != nil {
log.Fatal("failed to connect to agent: %v", err)
}
cli := agent_v1.NewAgentClient(conn)
// Do health check
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
rpl, err := cli.HealthCheck(ctx, &agent_v1.HealthCheckRequest{
Query: *query,
})
if err != nil {
log.Fatal("%v", err)
}
if rpl.Error != "" {
log.Fatal("health check negative: %s", rpl.Error)
}
log.Info("Health check OK")
}
================================================
FILE: cmd/cri-resmgr-webhook/Dockerfile
================================================
ARG GO_VERSION=1.24
FROM golang:${GO_VERSION}-bullseye as builder
ARG GOLICENSES_VERSION
WORKDIR /go/build
# Fetch go dependencies in a separate layer for caching
RUN go install github.com/google/go-licenses@${GOLICENSES_VERSION}
COPY go.mod go.sum ./
COPY pkg/topology/ pkg/topology/
RUN go mod download -x
# Build webhook, fully statically linked binary
COPY . .
RUN CGO_ENABLED=0 make build-static BUILD_DIRS=cri-resmgr-webhook && \
install -D /go/build/bin/* -t /install_root/bin
# Save licenses
RUN make install-licenses BUILD_DIRS=cri-resmgr-webhook DESTDIR=/install_root
FROM scratch as final
USER 65534:65534
COPY --from=builder /install_root /
ENTRYPOINT ["/bin/cri-resmgr-webhook"]
================================================
FILE: cmd/cri-resmgr-webhook/handlers.go
================================================
/*
Copyright 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"encoding/json"
"errors"
"fmt"
"io"
"log"
"net/http"
admissionv1 "k8s.io/api/admission/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/serializer"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"sigs.k8s.io/yaml"
)
type jsonPatch struct {
Op string `json:"op"`
Path string `json:"path"`
Value interface{} `json:"value"`
}
type podResourceRequirements struct {
InitContainers map[string]corev1.ResourceRequirements `json:"initContainers"`
Containers map[string]corev1.ResourceRequirements `json:"containers"`
}
var scheme = runtime.NewScheme()
var codecs = serializer.NewCodecFactory(scheme)
// Module inatialization
func init() {
utilruntime.Must(corev1.AddToScheme(scheme))
utilruntime.Must(admissionv1.AddToScheme(scheme))
}
// Helper for creating an AdmissionResponse with an error
func errResponse(err error) *admissionv1.AdmissionResponse {
return &admissionv1.AdmissionResponse{
Result: &metav1.Status{
Message: err.Error(),
},
}
}
// Dump req/rsp in human-readable form
func stringify(r interface{}) string {
out, err := yaml.Marshal(r)
if err != nil {
return fmt.Sprintf("!!!!!\nUnable to stringify %T: %v\n!!!!!", r, err)
}
return string(out)
}
// Handle HTTP requests
func handle(w http.ResponseWriter, r *http.Request) {
var body []byte
if r.Body != nil {
if data, err := io.ReadAll(r.Body); err == nil {
body = data
}
}
// Check Content-Type
contentType := r.Header.Get("Content-Type")
if contentType != "application/json" {
log.Printf("ERROR: incorrect Content-Type (received %s, expect application/json", contentType)
return
}
// Deserialize AdmissionReview request and create an AdmissionReview response
arReq := admissionv1.AdmissionReview{}
arRsp := admissionv1.AdmissionReview{}
deserializer := codecs.UniversalDeserializer()
if _, _, err := deserializer.Decode(body, nil, &arReq); err != nil {
log.Printf("ERROR: deserializing admission request failed: %v", err)
arRsp.Response = errResponse(err)
} else if arReq.Request == nil {
log.Printf("REQUEST empty")
arRsp.Response = errResponse(errors.New("Empty request"))
} else {
log.Printf("REQUEST:\n%s", stringify(&arReq))
if arReq.Request.Resource.Group != "" || arReq.Request.Resource.Version != "v1" {
arRsp.Response = errResponse(fmt.Errorf("Unexpected resource group/version '%s/%s'", arReq.Request.Resource.Group, arReq.Request.Resource.Version))
} else {
res := arReq.Request.Resource.Resource
switch res {
case "pods":
arRsp.Kind = "AdmissionReview"
arRsp.APIVersion = "admission.k8s.io/v1"
arRsp.Response = mutatePodObject(&arReq.Request.Object)
default:
arRsp.Response = errResponse(fmt.Errorf("Unexpected resource %s", arReq.Request.Resource))
}
}
// Use the same UID in response that was used in the request
arRsp.Response.UID = arReq.Request.UID
}
log.Printf("RESPONSE:\n%s", stringify(arRsp.Response))
respBytes, err := json.Marshal(arRsp)
if err != nil {
log.Printf("ERROR: json marshal failed: %v", err)
}
if _, err := w.Write(respBytes); err != nil {
log.Printf("ERROR: failed to write HTTP response: %v", err)
}
}
// Handle AdmissionReview requests for Pod objects
func mutatePodObject(rawObj *runtime.RawExtension) *admissionv1.AdmissionResponse {
pod := corev1.Pod{}
deserializer := codecs.UniversalDeserializer()
if _, _, err := deserializer.Decode(rawObj.Raw, nil, &pod); err != nil {
log.Printf("ERROR: failed to deserialize Pod object: %v", err)
return errResponse(err)
}
reviewResponse := admissionv1.AdmissionResponse{}
reviewResponse.Allowed = true
patches := []jsonPatch{}
// Add a patch to add an empty annotations object if no annotations are found
if pod.ObjectMeta.Annotations == nil {
patches = append(patches, jsonPatch{Op: "add", Path: "/metadata/annotations", Value: map[string]string{}})
}
patch, err := patchResourceAnnotation(&pod)
if err != nil {
return errResponse(err)
}
patches = append(patches, patch)
reviewResponse.Patch, err = json.Marshal(patches)
if err != nil {
log.Printf("ERROR: failed to marshal Pod patch: %v", err)
return errResponse(err)
}
patchType := admissionv1.PatchTypeJSONPatch
reviewResponse.PatchType = &patchType
return &reviewResponse
}
// Create a Pod (JSON) patch adding resource annotation
func patchResourceAnnotation(pod *corev1.Pod) (jsonPatch, error) {
patch := jsonPatch{Op: "add", Path: "/metadata/annotations/intel.com~1resources"}
// Create annotation that includes all resources of all (init)containers
resourceAnnotation := podResourceRequirements{InitContainers: map[string]corev1.ResourceRequirements{},
Containers: map[string]corev1.ResourceRequirements{}}
for _, container := range pod.Spec.Containers {
resourceAnnotation.Containers[container.Name] = container.Resources
}
for _, container := range pod.Spec.InitContainers {
resourceAnnotation.InitContainers[container.Name] = container.Resources
}
resourceAnnotationBytes, err := json.Marshal(resourceAnnotation)
if err != nil {
log.Printf("ERROR: failed to marshal 'intel.com/resources' annotations: %v", err)
return patch, err
}
// Patch Pod annotations to include the "resources" annotation
patch.Value = string(resourceAnnotationBytes)
return patch, nil
}
================================================
FILE: cmd/cri-resmgr-webhook/main.go
================================================
/*
Copyright 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"flag"
"log"
)
// Parse command line
func parseArgs() args {
args := args{}
flag.IntVar(&args.port, "port", 443, "Port on which to listen for connections")
flag.StringVar(&args.certFile, "cert-file", "", "x509 certificate used for authenticating connections")
flag.StringVar(&args.keyFile, "key-file", "", "Private x509 key matching --cert-file")
flag.Parse()
return args
}
func main() {
args := parseArgs()
if err := Run(args); err != nil {
log.Fatal(err)
}
}
================================================
FILE: cmd/cri-resmgr-webhook/mutating-webhook-config.yaml
================================================
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
name: cri-resmgr
webhooks:
- name: cri-resmgr.intel.com
sideEffects: None
admissionReviewVersions: ["v1"]
rules:
- apiGroups:
- ""
apiVersions:
- v1
operations:
- CREATE
- UPDATE
resources:
- pods
clientConfig:
service:
namespace: cri-resmgr
name: cri-resmgr-webhook
caBundle: CA_BUNDLE_PLACEHOLDER
================================================
FILE: cmd/cri-resmgr-webhook/webhook-deployment.yaml
================================================
apiVersion: v1
kind: Namespace
metadata:
name: cri-resmgr
labels:
name: cri-resmgr
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: cri-resmgr-webhook
namespace: cri-resmgr
labels:
app: cri-resmgr-webhook
spec:
replicas: 1
selector:
matchLabels:
app: cri-resmgr-webhook
template:
metadata:
labels:
app: cri-resmgr-webhook
spec:
containers:
- name: cri-resmgr-webhook
image: IMAGE_PLACEHOLDER
# Convenience pull policy for development
imagePullPolicy: Always
# Mount the tls cert/key in the default location
volumeMounts:
- name: certs
mountPath: /etc/cri-resmgr-webhook/certs.d/
readOnly: true
args:
- "-cert-file=/etc/cri-resmgr-webhook/certs.d/svc.crt"
- "-key-file=/etc/cri-resmgr-webhook/certs.d/svc.key"
- "-port=8443"
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop: ["ALL"]
readOnlyRootFilesystem: true
runAsNonRoot: true
resources:
limits:
cpu: 1
memory: 256Mi
livenessProbe:
httpGet:
scheme: HTTPS
port: 8443
httpHeaders:
- name: "Content-Type"
value: "application/json"
initialDelaySeconds: 5
periodSeconds: 30
nodeSelector:
node-role.kubernetes.io/control-plane: ""
tolerations:
- key: "node-role.kubernetes.io/control-plane"
operator: "Equal"
value: ""
effect: "NoSchedule"
volumes:
# This example deployment uses k8s secrests to store TLS secrets
# You need to manually generate the cert/key pair, and, the accompanying secret
# Expected filenames are "svc.crt" and "svc.key"
- name: certs
secret:
secretName: cri-resmgr-webhook-secret
---
apiVersion: v1
kind: Service
metadata:
name: cri-resmgr-webhook
namespace: cri-resmgr
spec:
selector:
app: cri-resmgr-webhook
ports:
- port: 443
targetPort: 8443
protocol: TCP
================================================
FILE: cmd/cri-resmgr-webhook/webhook.go
================================================
/*
Copyright 2019 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package main
import (
"crypto/tls"
"fmt"
"log"
"net/http"
)
type args struct {
port int
certFile string
keyFile string
}
// Load server certificate and private key
func loadTLS(certFile, keyFile string) *tls.Config {
cert, err := tls.LoadX509KeyPair(certFile, keyFile)
if err != nil {
log.Fatalf("Failed to initialize TLS config: %v", err)
}
return &tls.Config{
Certificates: []tls.Certificate{cert},
}
}
// Run is the main entry point for the webhook server
func Run(args args) error {
// Attach handlers
http.HandleFunc("/", handle)
// Create and run HTTP server
server := &http.Server{
Addr: fmt.Sprintf(":%d", args.port),
TLSConfig: loadTLS(args.certFile, args.keyFile),
}
log.Printf("Listening on port %d", args.port)
return server.ListenAndServeTLS("", "")
}
================================================
FILE: demo/blockio/bb-scanner.yaml
================================================
# bb-scanner continuously calculates checksums of files found
# under /scan. Output reveals added, deleted, renamed and modified
# files together with timestamps.
#
# bb-scanner is configured as a low-priority activity:
# 1. CPU usage is limited to 10 %.
# 2. Disk/SSD bandwidth is limited by SlowReader configuration.
#
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: bb-scanner
labels:
app: bb-scanner
spec:
selector:
matchLabels:
app: bb-scanner
template:
metadata:
name: bb-scanner
labels:
app: bb-scanner
annotations:
blockioclass.cri-resource-manager.intel.com/pod: SlowReader
spec:
terminationGracePeriodSeconds: 1
containers:
- image: busybox
command:
- sh
- -c
- while true; do
find /scan -type f -print0 | xargs -0 md5sum | sort > curr.md5;
date +%s >> /output/diffs.md5;
diff -U1 prev.md5 curr.md5 >> /output/diffs.md5;
cp curr.md5 /output/files.md5;
mv curr.md5 prev.md5;
done
imagePullPolicy: IfNotPresent
name: busybox
resources:
limits:
cpu: 100m
volumeMounts:
- mountPath: /scan/usr-bin
name: usr-bin
readOnly: true
- mountPath: /scan/usr-lib
name: usr-lib
readOnly: true
- mountPath: /output
name: output
readOnly: false
volumes:
- name: usr-bin
hostPath:
path: /usr/bin
type: DirectoryOrCreate
- name: usr-lib
hostPath:
path: /usr/lib
type: DirectoryOrCreate
- name: output
hostPath:
path: /var/cache/bb-scanner
type: DirectoryOrCreate
restartPolicy: Always
================================================
FILE: demo/blockio/cri-resmgr-config.default.yaml
================================================
apiVersion: v1
kind: ConfigMap
metadata:
name: cri-resmgr-config.default
namespace: kube-system
data:
policy: |+
Active: none
logger: |+
Debug: blockio,cgroupblkio
blockio: |+
Classes:
SlowReader:
- Devices:
- /dev/vda
ThrottleReadBps: 512k
================================================
FILE: demo/blockio/run.sh
================================================
#!/bin/bash
DEMO_TITLE="CRI Resource Manager: Block I/O Demo"
PV='pv -qL'
SCRIPT_DIR="$(dirname "${BASH_SOURCE[0]}")"
LIB_DIR=$SCRIPT_DIR/../lib
BIN_DIR=${bindir-$(realpath "$SCRIPT_DIR/../../bin")}
OUTPUT_DIR=${outdir-$SCRIPT_DIR/output}
COMMAND_OUTPUT_DIR=$OUTPUT_DIR/commands
# shellcheck disable=SC1091
# shellcheck source=../lib/command.bash
source "$LIB_DIR/command.bash"
# shellcheck disable=SC1091
# shellcheck source=../lib/host.bash
source "$LIB_DIR/host.bash"
# shellcheck disable=SC1091
# shellcheck source=../lib/vm.bash
source "$LIB_DIR/vm.bash"
usage() {
echo "$DEMO_TITLE"
echo "Usage: [VAR=VALUE] ./run.sh MODE"
echo " MODE: \"play\" plays the demo."
echo " \"record\" plays and records the demo."
echo " \"test\" runs fast, reports pass or fail."
echo " VARs:"
echo " vm: govm virtual machine name."
echo " The default is \"crirm-demo-blockio\"."
echo " speed: Demo play speed."
echo " The default is 10 (keypresses per second)."
echo " cleanup: 0: leave VM running. (\"play\" mode default)"
echo " 1: delete VM (\"test\" mode default)"
echo " 2: stop VM, but do not delete it."
echo " outdir: Save output under given directory."
echo " The default is \"${SCRIPT_DIR}/output\"."
echo " binsrc: Where to get cri-resmgr to the VM."
echo " \"github\": go get and build in VM (\"play\" mode default)."
echo " \"local\": copy from source tree bin/ (\"test\" mode default)"
echo " (set bindir=/path/to/cri-resmgr* to override bin/)"
}
error() {
(echo ""; echo "error: $1" ) >&2
exit 1
}
out() {
if [ -n "$PV" ]; then
speed=${speed-10}
echo "$1" | $PV "$speed"
else
echo "$1"
fi
echo ""
}
record() {
clear
out "Recording this screencast..."
host-command "asciinema rec -t \"$DEMO_TITLE\" crirm-demo-blockio.cast -c \"./run.sh play\""
}
screen-create-vm() {
speed=60 out "### Running the demo in VM \"$vm\"."
host-create-vm "$vm"
vm-networking
if [ -z "$VM_IP" ]; then
error "creating VM failed"
fi
}
screen-install-k8s() {
speed=60 out "### Installing Kubernetes to the VM."
vm-install-cri
vm-install-k8s
}
screen-install-cri-resmgr() {
speed=60 out "### Installing CRI Resource Manager to VM."
vm-install-cri-resmgr
}
screen-launch-cri-resmgr() {
policy=${policy-none}
speed=60 out "### Launching cri-resmgr."
vm-command "(echo \"policy:\"; echo \" Active: $policy\") > cri-resmgr.fallback.cfg"
vm-command "cri-resmgr -relay-socket /var/run/cri-resmgr/cri-resmgr.sock -runtime-socket /var/run/containerd/containerd.sock -fallback-config cri-resmgr.fallback.cfg >cri-resmgr.output.txt 2>&1 &"
}
screen-create-singlenode-cluster() {
speed=60 out "### Setting up single-node Kubernetes cluster."
speed=60 out "### CRI Resource Manager + containerd will act as the container runtime."
vm-create-singlenode-cluster
}
screen-launch-cri-resmgr-agent() {
speed=60 out "### Launching cri-resmgr-agent."
speed=60 out "### The agent will make cri-resmgr configurable with ConfigMaps."
vm-command "NODE_NAME=\$(hostname) cri-resmgr-agent -kubeconfig \$HOME/.kube/config >cri-resmgr-agent.output.txt 2>&1 &"
}
screen-measure-io-speed() {
process=$1
measuretime=2
vm-command "echo 3 > /proc/sys/vm/drop_caches"
out "### Measuring $process read speed -- twice."
cmd="pid=\$(ps -A | awk \"/$process/{print \\\$1}\"); [ -n \"\$pid\" ] && { echo \$(grep read_bytes /proc/\$pid/io; sleep $measuretime; grep read_bytes /proc/\$pid/io) | awk \"{print \\\"$process read speed: \\\"(\\\$4-\\\$2)/$measuretime/1024\\\" kBps\\\"}\"; }"
speed=360 outcolor=10 vm-command "$cmd"
sleep 1
speed=360 outcolor=10 vm-command "$cmd"
}
demo-blockio() {
out "### Let the show begin!"
out "### Configuring cri-resmgr: introduce a SlowReader block I/O class."
host-command "scp cri-resmgr-config.default.yaml $VM_SSH_USER@$VM_IP:"
vm-command "cat cri-resmgr-config.default.yaml"
out "### Note: SlowReaders can read from each of the listed devices up to $(vm-command-q "awk '/ThrottleRead/{print \$2}' < cri-resmgr-config.default.yaml")Bps."
vm-command "kubectl apply -f cri-resmgr-config.default.yaml"
out "### Our test workload, bb-scanner, is annotated as a SlowReader."
host-command "scp bb-scanner.yaml $VM_SSH_USER@$VM_IP:"
vm-command "grep -A1 annotations: bb-scanner.yaml"
out "### Flushing caches and deploying bb-scanner."
vm-command "echo 3 > /proc/sys/vm/drop_caches"
vm-command "kubectl create -f bb-scanner.yaml"
out "### Now bb-scanner is running md5sum to all mounted directories, non-stop."
vm-wait-process --timeout 60 md5sum
screen-measure-io-speed md5sum
out "### Reconfiguring cri-resmgr: set SlowReader read speed to 2 MBps."
out "### This applies to all pods and containers in this block I/O class,"
out "### both new and already running, like our bb-scanner."
vm-command "sed -i 's/ThrottleReadBps:.*/ThrottleReadBps: 2Mi/' cri-resmgr-config.default.yaml"
vm-command "cat cri-resmgr-config.default.yaml"
vm-command "kubectl apply -f cri-resmgr-config.default.yaml"
# Give some time for new config to become effective and process
# I/O to accelerate.
sleep 2;
screen-measure-io-speed md5sum
out "### Thanks for watching!"
out "### Cleaning up: deleting bb-scanner."
vm-command "kubectl delete daemonset bb-scanner"
}
# Validate parameters
mode=$1
distro=${distro:="ubuntu-20.04"}
cri=${cri:="containerd"}
vm=${vm:="blockio-$distro-$cri"}
echo "vm is here: \"$vm\""
host-set-vm-config "$vm" "$distro" "$cri"
if [ "$mode" == "play" ]; then
speed=${speed-10}
cleanup=${cleanup-0}
binsrc=${binsrc-github}
elif [ "$mode" == "test" ]; then
PV=
cleanup=${cleanup-1}
binsrc=${binsrc-local}
elif [ "$mode" == "record" ]; then
record
else
usage
error "missing valid MODE"
exit 1
fi
# Prepare for test/demo
mkdir -p "$OUTPUT_DIR"
mkdir -p "$COMMAND_OUTPUT_DIR"
rm -f "$COMMAND_OUTPUT_DIR"/0*
( echo x > "$OUTPUT_DIR"/x && rm -f "$OUTPUT_DIR"/x ) || {
error "output directory outdir=\"$OUTPUT_DIR\" is not writable"
}
if [ "$binsrc" == "local" ]; then
[ -f "${BIN_DIR}/cri-resmgr" ] || error "missing \"${BIN_DIR}/cri-resmgr\""
[ -f "${BIN_DIR}/cri-resmgr-agent" ] || error "missing \"${BIN_DIR}/cri-resmgr-agent\""
fi
if [ -z "$VM_IP" ] || [ -z "$VM_SSH_USER" ] || [ -z "$VM_NAME" ]; then
screen-create-vm
fi
if ! vm-command-q "dpkg -l | grep -q kubelet"; then
screen-install-k8s
fi
if ! vm-command-q "[ -f /usr/bin/cri-resmgr ] || [ -f /usr/local/bin/cri-resmgr ]"; then
screen-install-cri-resmgr
fi
# start cri-resmgr if not already running
if ! vm-command-q "pidof cri-resmgr" >/dev/null; then
screen-launch-cri-resmgr
fi
# create kubernetes cluster or wait that it is online
if vm-command-q "[ ! -f /var/lib/kubelet/config.yaml ]"; then
screen-create-singlenode-cluster
else
# wait for kube-apiserver to launch (may be down if the VM was just booted)
vm-wait-process kube-apiserver
fi
# start cri-resmgr-agent if not already running
if ! vm-command-q "pidof cri-resmgr-agent >/dev/null"; then
screen-launch-cri-resmgr-agent
fi
# Run test/demo
demo-blockio
# Cleanup
if [ "$cleanup" == "0" ]; then
echo "The VM, Kubernetes and cri-resmgr are left running. Next steps:"
vm-print-usage
elif [ "$cleanup" == "1" ]; then
host-stop-vm $vm
host-delete-vm $vm
elif [ "$cleanup" == "2" ]; then
host-stop-vm $vm
fi
# Summarize results
SUMMARY_FILE="$OUTPUT_DIR/summary.txt"
echo -n "" > "$SUMMARY_FILE" || error "cannot write summary to \"$SUMMARY_FILE\""
first_speed="$(grep "^md5sum read speed:" "$COMMAND_OUTPUT_DIR"/0* | head -n 1 | awk '{print $4}')"
last_speed="$(grep "^md5sum read speed:" "$COMMAND_OUTPUT_DIR"/0* | tail -n 1 | awk '{print $4}')"
echo "First md5sum read speed (512 kBps throttling): $first_speed kBps" >> "$SUMMARY_FILE"
echo "Last md5sum read speed (2 MBps throttling): $last_speed kBps" >> "$SUMMARY_FILE"
# Declare verdict in test mode
exit_status=0
if [ "$mode" == "test" ]; then
min_first=100 max_first=600 min_last=1500 max_last=2500
[[ "$first_speed" -gt "$min_first" ]] || exit_status=1
[[ "$first_speed" -lt "$max_first" ]] || exit_status=1
[[ "$last_speed" -gt "$min_last" ]] || exit_status=1
[[ "$last_speed" -lt "$max_last" ]] || exit_status=1
if [ "$exit_status" == "1" ]; then
echo "Error: speeds outside acceptable ranges ($min_first..$max_first kBps and $min_last..$max_last kBps)." >> "$SUMMARY_FILE"
echo "Test verdict: FAIL" >> "$SUMMARY_FILE"
else
echo "Speeds within acceptable ranges ($min_first..$max_first kBps and $min_last..$max_last kBps)." >> "$SUMMARY_FILE"
echo "Test verdict: PASS" >> "$SUMMARY_FILE"
fi
echo ""
cat "$SUMMARY_FILE"
fi
exit $exit_status
================================================
FILE: demo/lib/command.bash
================================================
# Hooks for displaying and logging how shell commands (local and
# remote) are executed, and handling their output and exit status.
#
# Example in a Bash script, run-on-mytargethost function:
# command-start mytargethost "ls -la"
# ssh mytargethost $COMMAND 2>&1 | command-handle-output
# command-end ${PIPESTATUS[0]}
# [ "$COMMAND_STATUS" == "0" ] || command-error "non-zero exit status"
#
# command-start and command-end set environment variables:
# COMMAND, COMMAND_STATUS, COMMAND_OUTPUT
export LC_NUMERIC=C
# These exports force ssh-* to fail instead of prompting for a passphrase.
export DISPLAY=bogus-none
export SSH_ASKPASS=/bin/false
SSH_KEY="${HOME}/.ssh/id_rsa"
SSH_OPTS="-o StrictHostKeyChecking=No"
SSH="ssh $SSH_OPTS"
SCP="scp $SSH_OPTS"
epochrealtime() {
[ -n "$EPOCHREALTIME" ] && echo "$EPOCHREALTIME" || echo "$SECONDS"
}
COMMAND_COUNTER=0
command_init_time=$(epochrealtime)
command-start() {
# example: command-start vm prompt "mkdir $MYDIR"
COMMAND_TARGET="$1"
COMMAND_PROMPT="$2"
COMMAND="$3"
COMMAND_STATUS=""
COMMAND_OUTPUT=""
COMMAND_COUNTER=$(( COMMAND_COUNTER + 1 ))
local command_start_time=$(epochrealtime)
local time_since_start=$(echo "$command_start_time - $command_init_time" | bc)
COMMAND_OUT_FILE="$COMMAND_OUTPUT_DIR/$(printf %04g $COMMAND_COUNTER)-$COMMAND_TARGET"
echo "# start time: $time_since_start" > "$COMMAND_OUT_FILE" || {
echo "cannot write command output to file \"$COMMAND_OUT_FILE\""
exit 1
}
echo "# command: $COMMAND" >> "$COMMAND_OUT_FILE"
echo -e -n "${COMMAND_PROMPT}"
if [ -n "$PV" ]; then
echo "$COMMAND" | $PV $speed
else
echo "$COMMAND"
fi
if [ -n "$outcolor" ]; then
COMMAND_OUTSTART="\e[38;5;${outcolor}m"
COMMAND_OUTEND="\e[0m"
else
COMMAND_OUTSTART=""
COMMAND_OUTEND=""
fi
}
command-handle-output() {
# example: sh -c $command | command-handle-output
tee "$COMMAND_OUT_FILE.tmp" | ( echo -e -n "$COMMAND_OUTSTART"; cat; echo -e -n "$COMMAND_OUTEND" )
cat "$COMMAND_OUT_FILE.tmp" >> "$COMMAND_OUT_FILE"
if [ -n "$PV" ]; then
echo | $PV $speed
fi
}
command-runs-in-bg() {
echo "(runs in background)"
echo ""
}
command-end() {
# example: command-end EXIT_STATUS
COMMAND_STATUS=$1
local command_end_time=$(epochrealtime)
local time_since_start=$(echo "$command_end_time - $command_init_time" | bc)
( echo "# exit status: $COMMAND_STATUS"; echo "# end time: $time_since_start" ) >> "$COMMAND_OUT_FILE"
COMMAND_OUTPUT=$(<"$COMMAND_OUT_FILE.tmp")
rm -f "$COMMAND_OUT_FILE.tmp"
}
command-error() { # script API
# Usage: command-error MESSAGE
#
# Print executed command, observed output, exit status and MESSAGE.
# Stop script execution.
( echo "command: $COMMAND";
echo "output: $COMMAND_OUTPUT";
echo "exit status: $COMMAND_STATUS";
echo "error: $1" ) >&2
command-exit-if-not-interactive
}
command-exit-if-not-interactive() {
if [ -z "$INTERACTIVE_MODE" ] || [ "$INTERACTIVE_MODE" == "0" ]; then
exit ${1:-1}
fi
}
command-debug-log() {
if [ "$(type -t -- debug-log)" = "function" ]; then
debug-log "$@"
return 0
else
if [ -n "$OUTPUT_DIR" ] && [ -d "$OUTPUT_DIR" ]; then
touch "$OUTPUT_DIR"/debug-log
echo "$@" >> "$OUTPUT_DIR"/debug-log
return 0
fi
fi
echo "$@" 1>&2
}
================================================
FILE: demo/lib/distro.bash
================================================
# shellcheck disable=SC2120
GO_URLDIR=https://golang.org/dl
GO_VERSION=1.24.1
GOLANG_URL=$GO_URLDIR/go$GO_VERSION.linux-amd64.tar.gz
CRICTL_VERSION=${CRICTL_VERSION:-"v1.25.0"}
MINIKUBE_VERSION=${MINIKUBE_VERSION:-v1.27.0}
###########################################################################
#
# distro-agnostic interface
#
# To add a new distro implement distro-specific versions of these
# functions. You can omit implementing those which already resolve
# to an existing function which works for the new distro.
#
# To add a new API function, add an new briding resolution entry below.
#
distro-image-url() { distro-resolve "$@"; }
distro-ssh-user() { distro-resolve "$@"; }
distro-pkg-type() { distro-resolve "$@"; }
distro-install-repo-key() { distro-resolve "$@"; }
distro-install-repo() { distro-resolve "$@"; }
distro-refresh-pkg-db() { distro-resolve "$@"; }
distro-install-pkg() { distro-resolve "$@"; }
distro-install-pkg-local() { distro-resolve "$@"; }
distro-remove-pkg() { distro-resolve "$@"; }
distro-setup-proxies() { distro-resolve "$@"; }
distro-setup-oneshot() { distro-resolve "$@"; }
distro-install-utils() { distro-resolve "$@"; }
distro-install-golang() { distro-resolve "$@"; }
distro-install-runc() { distro-resolve "$@"; }
distro-install-containerd() { distro-resolve "$@"; }
distro-config-containerd() { distro-resolve "$@"; }
distro-restart-containerd() { distro-resolve "$@"; }
distro-install-crio() { distro-resolve "$@"; }
distro-config-crio() { distro-resolve "$@"; }
distro-restart-crio() { distro-resolve "$@"; }
distro-install-crictl() { distro-resolve "$@"; }
distro-install-cri-dockerd(){ distro-resolve "$@"; }
distro-install-minikube() { distro-resolve "$@"; }
distro-install-k8s() { distro-resolve "$@"; }
distro-install-kernel-dev() { distro-resolve "$@"; }
distro-k8s-cni() { distro-resolve "$@"; }
distro-k8s-cni-subnet() { distro-resolve "$@"; }
distro-set-kernel-cmdline() { distro-resolve "$@"; }
distro-govm-env() { distro-resolve "$@"; }
distro-bootstrap-commands() { distro-resolve "$@"; }
distro-env-file-dir() { distro-resolve "$@"; }
###########################################################################
# distro-specific function resolution
distro-resolve() {
local apifn="${FUNCNAME[1]}" fn prefn postfn
# shellcheck disable=SC2086
{
fn="$(distro-resolve-fn $apifn)"
prefn="$(distro-resolve-fn $apifn-pre)"
postfn="$(distro-resolve-fn $apifn-post)"
command-debug-log "$VM_DISTRO/${FUNCNAME[1]}: pre: ${prefn:--}, fn: ${fn:--}, post: ${postfn:--}"
}
[ -n "$prefn" ] && { $prefn "$@" || return $?; }
$fn "$@" || return $?
[ -n "$postfn" ] && { $postfn "$@" || return $?; }
return 0
}
distro-resolve-fn() {
# We try resolving distro-agnostic implementations by looping through
# a list of candidate function names in decreasing order of precedence
# and returning the first one found. The candidate list has version-
# exact and unversioned distro-specific functions and a set fallbacks
# based on known distro, derivative, and package type relations.
#
# For normal functions the last fallback is 'distro-unresolved' which
# prints and returns an error. For pre- and post-functions there is no
# similar setup. IOW, unresolved normal distro functions fail while
# unresolved pre- and post-functions get ignored (in distro-resolve).
local apifn="$1" candidates fn
case $apifn in
distro-*) apifn="${apifn#distro-}";;
*) error "internal error: can't resolve non-API function $apifn";;
esac
candidates="${VM_DISTRO/./_}-$apifn ${VM_DISTRO%%-*}-$apifn"
case $VM_DISTRO in
ubuntu*) candidates="$candidates debian-$apifn";;
fedora*) candidates="$candidates rpm-$apifn";;
*suse*) candidates="$candidates rpm-$apifn";;
sles*) candidates="$candidates opensuse-$apifn rpm-$apifn";;
esac
case $apifn in
*-pre|*-post) ;;
*) candidates="$candidates default-$apifn distro-unresolved";;
esac
for fn in $candidates; do
if [ "$(type -t -- "$fn")" = "function" ]; then
echo "$fn"
return 0
fi
done
}
# distro-unresolved terminates failed API function resolution with an error.
distro-unresolved() {
local apifn="${FUNCNAME[2]}"
command-error "internal error: can't resolve \"$apifn\" for \"$VM_DISTRO\""
return 1
}
###########################################################################
#
# Ubuntu, Debian
#
ubuntu-18_04-image-url() {
echo "https://cloud-images.ubuntu.com/bionic/current/bionic-server-cloudimg-amd64.img"
}
ubuntu-20_04-image-url() {
echo "https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img"
}
ubuntu-22_04-image-url() {
echo "https://cloud-images.ubuntu.com/releases/jammy/release/ubuntu-22.04-server-cloudimg-amd64.img"
}
ubuntu-24_04-image-url() {
echo "https://cloud-images.ubuntu.com/releases/noble/release/ubuntu-24.04-server-cloudimg-amd64.img"
}
debian-11-image-url() {
echo "https://cloud.debian.org/images/cloud/bullseye/latest/debian-11-generic-amd64.qcow2"
}
debian-12-image-url() {
echo "https://cloud.debian.org/images/cloud/bookworm/latest/debian-12-generic-amd64.qcow2"
}
debian-sid-image-url() {
echo "https://cloud.debian.org/images/cloud/sid/daily/latest/debian-sid-generic-amd64-daily.qcow2"
}
ubuntu-download-kernel() {
# Usage:
# ubuntu-download-kernel list
# ubuntu-download-kernel VERSION
#
# List or download Ubuntu kernel team kernels.
#
# Example:
# ubuntu-download-kernel list | grep 5.9
# ubuntu-download-kernel 5.9-rc8
# vm-command "dpkg -i kernels/linux*rc8*deb"
# vm-reboot
# vm-command "uname -a"
local version=$1
[ -n "$version" ] ||
error "missing kernel version to install"
if [ "$version" == "list" ]; then
wget -q -O- https://kernel.ubuntu.com/~kernel-ppa/mainline/ | grep -E '^<tr>.*href="v[5-9]' | sed 's|^.*href="v\([0-9][^"]*\)/".*$|\1|g'
return 0
fi
vm-command "mkdir -p kernels; rm -f kernels/linux*$version*deb; for deb in \$(wget -q -O- https://kernel.ubuntu.com/~kernel-ppa/mainline/v$version/ | awk -F'\"' '/amd64.*deb/{print \$2}' | grep -v -E 'headers|lowlatency'); do ( cd kernels; wget -q https://kernel.ubuntu.com/~kernel-ppa/mainline/v$version/\$deb ); done; echo; echo 'Downloaded kernel packages:'; du -h kernels/*.deb" ||
command-error "downloading kernel $version failed"
}
ubuntu-ssh-user() {
echo ubuntu
}
debian-ssh-user() {
echo debian
}
ubuntu-apparmor-disable-runc() {
vm-command "[ -f /etc/apparmor.d/runc ] && ln -s /etc/apparmor.d/runc /etc/apparmor.d/disable/ && apparmor_parser -R /etc/apparmor.d/runc"
}
ubuntu-config-containerd() {
ubuntu-apparmor-disable-runc
default-config-containerd
}
ubuntu-config-crio() {
ubuntu-apparmor-disable-runc
default-config-crio
}
debian-pkg-type() {
echo deb
}
debian-install-repo-key() {
local key
# apt-key needs gnupg2, that might not be available by default
vm-command "command -v gpg >/dev/null 2>&1" || {
vm-command "apt-get update && apt-get install -y gnupg2"
}
for key in "$@"; do
vm-command "curl -L -s $key | apt-key add -" ||
command-error "failed to install repo key $key"
done
}
debian-install-repo() {
if [ $# = 1 ]; then
# shellcheck disable=SC2086,SC2048
set -- $*
fi
vm-command "echo $* > /etc/apt/sources.list.d/$3-$4.list && apt-get update" ||
command-error "failed to install apt repository $*"
}
debian-refresh-pkg-db() {
vm-command "apt-get update" ||
command-error "failed to refresh apt package DB"
}
debian-install-pkg() {
# dpkg configure may ask "The default action is to keep your
# current version", for instance when a test has added
# /etc/containerd/config.toml and then apt-get installs
# containerd. 'yes ""' will continue with the default answer (N:
# keep existing) in this case. Without 'yes' installation fails.
# Add apt-get option "--reinstall" if any environment variable
# reinstall_<pkg>=1
local pkg
local opts=""
for pkg in "$@"; do
if [ "$(eval echo \$reinstall_$pkg)" == "1" ]; then
opts="$opts --reinstall"
break
fi
done
vm-command "yes \"\" | DEBIAN_FRONTEND=noninteractive apt-get install $opts -y --allow-downgrades $*" ||
command-error "failed to install $*"
}
debian-remove-pkg() {
vm-command "for pkg in $*; do dpkg -l \$pkg >& /dev/null && apt remove -y --purge \$pkg || :; done" ||
command-error "failed to remove package(s) $*"
}
debian-install-pkg-local() {
local force=""
if [ "$1" == "--force" ]; then
force="--force-all"
shift
fi
vm-command "dpkg -i $force $*" ||
command-error "failed to install local package(s)"
}
debian-install-golang() {
debian-refresh-pkg-db
debian-install-pkg golang git-core
}
debian-install-kernel-dev() {
distro-refresh-pkg-db
distro-install-pkg git-core build-essential linux-source bc kmod cpio flex libncurses5-dev libelf-dev libssl-dev dwarves bison
vm-command "[ -d linux ] || git clone https://github.com/torvalds/linux"
vm-command '[ -f linux/.config ] || cp -v /boot/config-$(uname -r) linux/.config'
echo "Kernel ready for patching and configuring."
echo "build: cd linux && make bindeb-pkg"
echo "install: dpkg -i linux-*.deb"
}
debian-11-install-containerd-pre() {
debian-install-repo-key https://download.docker.com/linux/debian/gpg
debian-install-repo "deb https://download.docker.com/linux/debian bullseye stable"
}
debian-11-install-containerd() {
vm-command-q "[ -f /usr/bin/containerd ]" || {
distro-install-pkg containerd.io
}
}
debian-sid-config-containerd-post() {
vm-command "sed -e 's|bin_dir = \"/usr/lib/cni\"|bin_dir = \"/opt/cni/bin\"|g' -i /etc/containerd/config.toml"
}
debian-install-cri-dockerd-pre() {
debian-refresh-pkg-db
debian-install-pkg docker.io conntrack
vm-command "addgroup $(vm-ssh-user) docker"
distro-install-golang
}
debian-install-crio-pre() {
debian-refresh-pkg-db
debian-install-pkg libgpgme11 conmon runc containernetworking-plugins conntrack || true
}
debian-install-k8s() {
local _k8s=$k8s
debian-refresh-pkg-db
debian-install-pkg gpg apt-transport-https curl
if [[ -z "$k8s" ]] || [[ "$k8s" == "latest" ]]; then
vm-command "curl -s https://api.github.com/repos/kubernetes/kubernetes/releases/latest | grep tag_name | sed -e 's/.*v\([0-9]\+\.[0-9]\+\).*/\1/g'"
_k8s=$COMMAND_OUTPUT
fi
echo "installing Kubernetes v${_k8s}"
vm-command "curl -fsSL https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/Release.key -o /tmp/Release.key" || \
command-error "failed to download Kubernetes v${_k8s} key"
if vm-command "command -v apt-key >/dev/null"; then
vm-command "sudo apt-key add /tmp/Release.key"
vm-command "echo 'deb https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/ /' > /etc/apt/sources.list.d/kubernetes.list && apt update" || \
command-error "failed to add Kubernetes v${_k8s} repo"
else
vm-command "sudo gpg --dearmor --batch --yes -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg /tmp/Release.key"
vm-command "echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v${_k8s}/deb/ /' > /etc/apt/sources.list.d/kubernetes.list && apt update" || \
command-error "failed to add Kubernetes v${_k8s} repo"
fi
debian-install-pkg "kubeadm" "kubelet" "kubectl"
}
debian-set-kernel-cmdline() {
local e2e_defaults="$*"
vm-command "echo 'GRUB_CMDLINE_LINUX_DEFAULT=\"\${GRUB_CMDLINE_LINUX_DEFAULT} ${e2e_defaults}\"' > /etc/default/grub.d/60-e2e-defaults.cfg" || {
command-error "writing new command line parameters failed"
}
vm-command "update-grub" || {
command-error "updating grub failed"
}
}
debian-env-file-dir() {
echo "/etc/default"
}
debian-sid-govm-env() {
echo "DISABLE_VGA=N"
}
###########################################################################
#
# Generic Fedora
#
YUM_INSTALL="yum install --disableplugin=fastestmirror -y"
YUM_REMOVE="yum remove --disableplugin=fastestmirror -y"
fedora-image-url() {
fedora-40-image-url
}
fedora-40-image-url() {
echo "https://mirrors.xtom.de/fedora/releases/40/Cloud/x86_64/images/Fedora-Cloud-Base-Generic.x86_64-40-1.14.qcow2"
}
fedora-ssh-user() {
echo fedora
}
fedora-install-utils() {
distro-install-pkg /usr/bin/pidof
}
fedora-install-repo() {
distro-install-pkg dnf-plugins-core
vm-command "dnf config-manager --add-repo $*" ||
command-error "failed to install DNF repository $*"
}
fedora-install-pkg() {
local pkg
local do_reinstall=0
for pkg in "$@"; do
if [ "$(eval echo \$reinstall_$pkg)" == "1" ]; then
do_reinstall=1
break
fi
done
vm-command "dnf install -y $*" ||
command-error "failed to install $*"
# When requesting reinstallation, detect which packages were
# already installed and reinstall those.
# (Unlike apt and zypper, dnf offers no option for reinstalling
# existing and installing new packages on the same run.)
if [ "$do_reinstall" == "1" ]; then
local reinstall_pkgs
reinstall_pkgs=$(awk -F '[ -]' -v ORS=" " '/Package .* already installed/{print $2}' <<< "$COMMAND_OUTPUT")
if [ -n "$reinstall_pkgs" ]; then
vm-command "dnf reinstall -y $reinstall_pkgs"
fi
fi
}
fedora-remove-pkg() {
vm-command "dnf remove -y $*" ||
command-error "failed to remove package(s) $*"
}
fedora-install-pkg-local() {
local force=""
if [ "$1" == "--force" ]; then
force="--nodeps --force"
shift
fi
vm-command "rpm -Uvh $force $*" ||
command-error "failed to install local package(s)"
}
fedora-install-kernel-dev() {
fedora-install-pkg fedpkg fedora-packager rpmdevtools ncurses-devel pesign grubby git-core
vm-command "(set -x -e
echo root >> /etc/pesign/users
echo $(vm-ssh-user) >> /etc/pesign/users
/usr/libexec/pesign/pesign-authorize
fedpkg clone -a kernel
cd kernel
git fetch
git switch ${VM_DISTRO/edora-/} # example: git switch f40 in fedora-40
sed -i 's/# define buildid .local/%define buildid .e2e/g' kernel.spec
)" || {
echo "installing kernel development environment failed"
return 1
}
echo "Kernel ready for patching and configuring."
echo "build: cd kernel && dnf builddep -y kernel.spec && fedpkg local"
echo "install: cd kernel/x86_64 && dnf install -y --nogpgcheck kernel-{core-,modules-,}[5-9]*.e2e.fc*.x86_64.rpm"
}
fedora-install-golang() {
fedora-install-pkg wget tar gzip git-core
from-tarball-install-golang
}
fedora-install-crio-version() {
distro-install-pkg runc conmon
vm-command "ln -sf /usr/lib64/libdevmapper.so.1.02 /usr/lib64/libdevmapper.so.1.02.1" || true
if [ -z "$crio_src" ]; then
vm-command "dnf -y module enable cri-o:${crio_version:-$1}"
fi
}
fedora-install-containernetworking-plugins() {
distro-install-pkg containernetworking-plugins
vm-command "[ -x /opt/cni/bin/loopback ] || { mkdir -p /opt/cni/bin; mount --bind /usr/libexec/cni /opt/cni/bin; }"
vm-command "grep /usr/libexec/cni /etc/fstab || echo /usr/libexec/cni /opt/cni/bin none defaults,bind,nofail 0 0 >> /etc/fstab"
}
fedora-install-cri-dockerd-pre() {
distro-install-pkg docker git-core conntrack
vm-command "systemctl enable docker --now; usermod --append --groups docker $(vm-ssh-user)"
distro-install-golang
}
fedora-install-crio-pre() {
fedora-install-crio-version 1.21
fedora-install-containernetworking-plugins
}
fedora-install-crio() {
if [ -n "$crio_src" ]; then
default-install-crio
else
distro-install-pkg cri-o
vm-command "systemctl enable --now crio" ||
command-error "failed to enable cri-o"
fi
}
fedora-install-containerd-pre() {
distro-install-repo https://download.docker.com/linux/fedora/docker-ce.repo
fedora-install-containernetworking-plugins
}
fedora-install-containerd-post() {
vm-command "systemctl enable containerd"
}
fedora-install-k8s() {
_k8s=$k8s
if [[ -z "$_k8s" ]] || [[ "$_k8s" == "latest" ]]; then
vm-command "curl -s https://api.github.com/repos/kubernetes/kubernetes/releases/latest | grep tag_name | sed -e 's/.*v\([0-9]\+\.[0-9]\+\).*/\1/g'"
_k8s=$COMMAND_OUTPUT
fi
local repo="/etc/yum.repos.d/kubernetes.repo"
cat <<EOF |
[kubernetes]
name=Kubernetes
baseurl=https://pkgs.k8s.io/core:/stable:/v$_k8s/rpm/
enabled=1
gpgcheck=1
gpgkey=https://pkgs.k8s.io/core:/stable:/v$_k8s/rpm/repodata/repomd.xml.key
EOF
vm-pipe-to-file $repo
if [ -n "$k8s" ]; then
k8sverparam="-${k8s}-0"
else
k8sverparam=""
fi
distro-install-pkg iproute-tc kubelet$k8sverparam kubeadm$k8sverparam kubectl$k8sverparam
vm-command "systemctl enable --now kubelet" ||
command-error "failed to enable kubelet"
}
fedora-bootstrap-commands-post() {
cat <<EOF
reboot_needed=0
mkdir -p /etc/sudoers.d
echo 'Defaults !requiretty' > /etc/sudoers.d/10-norequiretty
setenforce 0
sed -E -i 's/^SELINUX=.*$/SELINUX=permissive/' /etc/selinux/config
echo PATH='\$PATH:/usr/local/bin:/usr/local/sbin' > /etc/profile.d/usr-local-path.sh
EOF
if [[ "${cgroups:-}" != "v2" ]]; then
cat <<EOF
if grep -q NAME=Fedora /etc/os-release; then
if ! grep -q systemd.unified_cgroup_hierarchy=0 /proc/cmdline; then
sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"
reboot_needed=1
fi
fi
EOF
fi
# Using swapoff is not enough as we also need to disable the swap from systemd
# and then reboot the VM
cat <<EOF
if swapon --show | grep -q partition; then
sed -E -i '/^\\/.*[[:space:]]swap[[:space:]].*\$/d' /etc/fstab
systemctl --type swap
for swp in \`systemctl --type swap | awk '/\\.swap/ { print \$1 }'\`; do systemctl stop "\$swp"; systemctl mask "\$swp"; done
swapoff --all
reboot_needed=1
fi
EOF
cat <<EOF
if [ "\$reboot_needed" == "1" ]; then
shutdown -r now
fi
EOF
}
fedora-set-kernel-cmdline() {
local e2e_defaults="$*"
vm-command "mkdir -p /etc/default; touch /etc/default/grub; sed -i '/e2e:fedora-set-kernel-cmdline/d' /etc/default/grub"
vm-command "echo 'GRUB_CMDLINE_LINUX_DEFAULT=\"\${GRUB_CMDLINE_LINUX_DEFAULT} ${e2e_defaults}\" # by e2e:fedora-set-kernel-cmdline' >> /etc/default/grub" || {
command-error "writing new command line parameters failed"
}
vm-command "grub2-mkconfig -o /boot/grub2/grub.cfg" || {
command-error "updating grub failed"
}
}
###########################################################################
#
# OpenSUSE and SLES
#
ZYPPER="zypper --non-interactive --no-gpg-checks"
sles-image-url() {
echo "/DOWNLOAD-MANUALLY-TO-HOME/vms/images/SLES15-SP3-JeOS.x86_64-15.3-OpenStack-Cloud-GM.qcow2"
}
sles-ssh-user() {
echo "sles"
}
sles-install-utils() {
local sles_registered=0
local sles_version=""
vm-command "SUSEConnect -s" || {
command-error "cannot run SUSEConnect"
}
# Parse registration status and SLES version.
if [ "$(jq '.[] | select(.identifier == "SLES") | .status' <<< $COMMAND_OUTPUT)" == '"Registered"' ]; then
sles_registered=1
fi
sles_version="$(jq -r '.[] | select(.identifier == "SLES") | .version' <<< $COMMAND_OUTPUT)"
if [ -z "$sles_version" ]; then
command-error "cannot read SLES version information from SUSEConnect -s output"
fi
# Try automatic registration if registration code is provided.
if [ "$sles_registered" == 0 ] && [ -n "$VM_SLES_REGCODE" ]; then
vm-command "SUSEConnect -r $VM_SLES_REGCODE" || {
echo "ERROR:"
echo "ERROR: Registering to SUSE Customer Center failed."
echo "ERROR: - Verify VM_SLES_REGCODE and try again."
echo "ERROR: - Unset VM_SLES_REGCODE to skip registration (use unsupported repos)."
echo "ERROR:"
exit 1
}
sles_registered=1
fi
# Add correct repo, depending on registration status.
if [ "$sles_registered" == 0 ]; then
echo "WARNING:"
echo "WARNING: Unregistered SUSE Linux Enterprise Server."
echo "WARNING: VM_SLES_REGCODE is not set, automatic registration skipped."
echo "WARNING: Fallback to use OpenSUSE OSS repository."
echo "WARNING:"
sleep "${warning_delay:-0}"
vm-command-q "$ZYPPER lr openSUSE-Oss >/dev/null" || {
distro-install-repo "http://download.opensuse.org/distribution/leap/${sles_version}/repo/oss/" openSUSE-Oss
}
else
vm-command-q "$ZYPPER lr | grep -q SUSE-PackageHub" || {
vm-command "SUSEConnect -p PackageHub/${sles_version}/x86_64"
}
fi
distro-install-pkg sysvinit-tools psmisc
}
opensuse-image-url() {
opensuse-15_6-image-url
}
opensuse-15_6-image-url() {
echo "https://download.opensuse.org/pub/opensuse/distribution/leap/15.6/appliances/openSUSE-Leap-15.6-Minimal-VM.x86_64-Cloud.qcow2"
}
opensuse-tumbleweed-image-url() {
echo "https://ftp.uni-erlangen.de/opensuse/tumbleweed/appliances/openSUSE-MicroOS.x86_64-ContainerHost-OpenStack-Cloud.qcow2"
}
opensuse-install-utils() {
distro-install-pkg psmisc sysvinit-tools
}
opensuse-ssh-user() {
echo "opensuse"
}
opensuse-pkg-type() {
echo "rpm"
}
opensuse-set-kernel-cmdline() {
local e2e_defaults="$*"
vm-command "mkdir -p /etc/default; touch /etc/default/grub; sed -i '/e2e:opensuse-set-kernel-cmdline/d' /etc/default/grub"
vm-command "echo 'GRUB_CMDLINE_LINUX_DEFAULT=\"\${GRUB_CMDLINE_LINUX_DEFAULT} ${e2e_defaults}\" # by e2e:opensuse-set-kernel-cmdline' >> /etc/default/grub" || {
command-error "writing new command line parameters failed"
}
vm-command "grub2-mkconfig -o /boot/grub2/grub.cfg" || {
command-error "updating grub failed"
}
}
opensuse-setup-oneshot() {
# Remove bad version of containerd if it is already installed,
# otherwise valid version of the package will not be installed.
vm-command "rpm -q containerd && ( zypper info containerd | awk '/Repository/{print $3}' | grep -v Virtualization ) && echo Removing wrong containerd version && zypper --non-interactive rm containerd"
}
opensuse-install-repo() {
opensuse-wait-for-zypper
vm-command "$ZYPPER addrepo $* && $ZYPPER refresh" ||
command-error "failed to add zypper repository $*"
}
opensuse-refresh-pkg-db() {
opensuse-wait-for-zypper
vm-command "$ZYPPER refresh" ||
command-error "failed to refresh zypper package DB"
}
opensuse-install-pkg() {
opensuse-wait-for-zypper
# Add zypper option "--force" if environment variable reinstall_<pkg>=1
local pkg
local opts=""
for pkg in "$@"; do
if [ "$(eval echo \$reinstall_$pkg)" == "1" ]; then
opts="$opts --force"
break
fi
done
# In OpenSUSE 15.2 zypper exits with status 106 if already installed,
# in 15.3 the exit status is 0. Do not consider "already installed"
# as an error.
vm-command "$ZYPPER install $opts $*" || [ "$COMMAND_STATUS" == "106" ] ||
command-error "failed to install $*"
}
opensuse-install-pkg-local() {
opensuse-wait-for-zypper
local force=""
if [ "$1" == "--force" ]; then
force="--nodeps --force"
shift
fi
vm-command "rpm -Uvh $force $*" ||
command-error "failed to install local package(s)"
}
opensuse-remove-pkg() {
vm-command 'for i in $*; do rpm -q --quiet $i || continue; $ZYPPER remove $i || exit 1; done' ||
command-error "failed to remove package(s) $*"
}
opensuse-install-golang() {
distro-install-pkg wget tar gzip git-core
from-tarball-install-golang
}
opensuse-wait-for-zypper() {
vm-run-until --timeout 5 '( ! pgrep zypper >/dev/null ) || ( pkill -9 zypper; sleep 1; exit 1 )' ||
error "Failed to stop zypper running in the background"
}
opensuse-install-k8s() {
vm-command "( lsmod | grep -q br_netfilter ) || { echo br_netfilter > /etc/modules-load.d/50-br_netfilter.conf; modprobe br_netfilter; }"
vm-command "echo 1 > /proc/sys/net/ipv4/ip_forward"
vm-command "zypper ls"
if ! grep -q snappy <<< "$COMMAND_OUTPUT"; then
distro-install-repo "http://download.opensuse.org/repositories/system:/snappy/openSUSE_Leap_15.6 snappy"
distro-refresh-pkg-db
fi
distro-install-pkg "snapd apparmor-profiles socat ebtables conntrackd iptables ethtool cni-plugins"
distro-install-crictl
vm-command "mkdir -p /opt/cni && ln -fs /usr/lib/cni/ -T /opt/cni/bin"
vm-command "systemctl enable --now snapd"
vm-command "snap wait system seed.loaded"
for kubepart in kubelet kubectl kubeadm; do
local snapcmd=install
local k8sverparam
if vm-command-q "snap info $kubepart | grep -q tracking"; then
# $kubepart is already installed, either refresh or reinstall it.
if [ "$(eval echo \$reinstall_$kubepart)" == "1" ]; then
# Reinstalling $kubepart requested.
# snap has no option for direct reinstalling,
# so the package needs to be removed first.
vm-command "snap remove $kubepart"
snapcmd=install
else
snapcmd=refresh
fi
fi
# Specify snap channel if user has requested a specific k8s version.
if [[ "$k8s" == *.*.* ]]; then
echo "WARNING: cannot snap install k8s=X.Y.Z, installing latest X.Y"
k8sverparam="--channel ${k8s%.*}/edge"
elif [[ "$k8s" == *.* ]]; then
k8sverparam="--channel ${k8s}/edge"
elif [[ -z "$k8s" ]]; then
k8sverparam=""
else
error "invalid k8s version ${k8s}, expected k8s=X.Y"
fi
vm-command "snap $snapcmd $k8sverparam $kubepart --classic"
done
# Manage kubelet with systemd rather than snap
vm-command "snap stop kubelet"
cat <<EOF |
[Unit]
Description=kubelet: The Kubernetes Node Agent
Documentation=https://kubernetes.io/docs/
Wants=network-online.target
After=network-online.target
[Service]
ExecStart=/snap/bin/kubelet --bootstrap-kubeconfig=/etc/kubernetes/bootstrap-kubelet.conf --kubeconfig=/etc/kubernetes/kubelet.conf --config=/var/lib/kubelet/config.yaml --container-runtime-endpoint=${k8scri_sock} --pod-infra-container-image=k8s.gcr.io/pause:3.4.1
Restart=always
StartLimitInterval=0
RestartSec=10
[Install]
WantedBy=multi-user.target
EOF
vm-pipe-to-file /etc/systemd/system/kubelet.service
vm-command "systemctl enable --now kubelet" ||
command-error "failed to enable kubelet"
}
opensuse-install-kernel-dev() {
vm-command-q "zypper lr | grep -q openSUSE_Tools" ||
distro-install-repo "http://download.opensuse.org/repositories/openSUSE:/Tools/openSUSE_Factory/openSUSE:Tools.repo"
distro-install-pkg "git-core make gcc flex bison bc ncurses-devel patch bzip2 osc build python quilt"
vm-command "cd /root; [ -d kernel ] || git clone --depth=100 https://github.com/SUSE/kernel"
vm-command "cd /root; [ -d kernel-source ] || git clone --depth=100 https://github.com/SUSE/kernel-source"
vm-command "[ -f /etc/profile.d/linux_git.sh ] || echo export LINUX_GIT=/root/kernel > /etc/profile.d/linux_git.sh"
}
opensuse-bootstrap-commands-pre() {
cat <<EOF
sed -e '/Signature checking/a gpgcheck = off' -i /etc/zypp/zypp.conf
EOF
}
opensuse-govm-env() {
echo "DISABLE_VGA=N"
}
###########################################################################
#
# Generic rpm functions
#
rpm-pkg-type() {
echo rpm
}
rpm-install-repo-key() {
local key
for key in "$@"; do
vm-command "rpm --import $key" ||
command-error "failed to import repo key $key"
done
}
rpm-refresh-pkg-db() {
:
}
###########################################################################
#
# default implementations
#
default-bootstrap-commands() {
cat <<EOF
rm -f /etc/modules-load.d/k8s.conf; touch /etc/modules-load.d/k8s.conf
modprobe bridge && echo bridge >> /etc/modules-load.d/k8s.conf || :
modprobe nf-tables-bridge && echo nf-tables-bridge >> /etc/modules-load.d/k8s.conf || :
modprobe br_netfilter && echo br_netfilter >> /etc/modules-load.d/k8s.conf || :
touch /etc/sysctl.d/k8s.conf
echo "net.bridge.bridge-nf-call-ip6tables = 1" >> /etc/sysctl.d/k8s.conf
echo "net.bridge.bridge-nf-call-iptables = 1" >> /etc/sysctl.d/k8s.conf
echo "net.ipv4.ip_forward = 1" >> /etc/sysctl.d/k8s.conf
# rp_filter (partially) mitigates DDOS attacks with spoofed IP addresses
# by dropping packages with non-routable (unanswerable) source addresses.
# However, rp_filter > 0 breaks cilium networking. Make sure it's disabled.
echo "net.ipv4.conf.*.rp_filter = 0" >> /etc/sysctl.d/k8s.conf
/sbin/sysctl -p /etc/sysctl.d/k8s.conf || :
EOF
}
default-setup-proxies() {
# Notes:
# We blindly assume that upper- vs. lower-case env vars are identical.
# shellcheck disable=SC2154
if [ -z "$http_proxy$https_proxy$ftp_proxy$no_proxy" ]; then
return 0
fi
if vm-command-q "grep -q \"http_proxy=$http_proxy\" /etc/profile.d/proxy.sh && \
grep -q \"https_proxy=$https_proxy\" /etc/profile.d/proxy.sh && \
grep -q \"ftp_proxy=$ftp_proxy\" /etc/profile.d/proxy.sh && \
grep -q \"no_proxy=$no_proxy\" /etc/profile.d/proxy.sh" 2>/dev/null; then
# No changes in proxy configuration
return 0
fi
local file scope="" append="--append" hn ext_no_proxy
hn="$(vm-command-q hostname)"
local master_node_ip_comma=""
if [ -n "$k8smaster" ]; then
local master_user_ip
master_user_ip="$(vm-ssh-user-ip $k8smaster)"
master_node_ip_comma=${master_user_ip/*@},
fi
ext_no_proxy="$master_node_ip_comma$VM_IP,10.0.0.0/8,$CNI_SUBNET,$hn,.svc,.internal,192.168.0.0/16"
for file in /etc/environment /etc/profile.d/proxy.sh; do
cat <<EOF |
${scope}http_proxy=$http_proxy
${scope}https_proxy=$https_proxy
${scope}ftp_proxy=$ftp_proxy
${scope}no_proxy=$no_proxy,$ext_no_proxy
${scope}HTTP_PROXY=$http_proxy
${scope}HTTPS_PROXY=$https_proxy
${scope}FTP_PROXY=$ftp_proxy
${scope}NO_PROXY=$no_proxy,$ext_no_proxy
EOF
vm-pipe-to-file $append $file
scope="export "
append=""
done
# Setup proxies for systemd services that might be installed later
for file in /etc/systemd/system/{containerd,docker,crio}.service.d/proxy.conf; do
cat <<EOF |
[Service]
Environment=HTTP_PROXY=$http_proxy
Environment=HTTPS_PROXY=$https_proxy
Environment=NO_PROXY=$no_proxy,$ext_no_proxy
EOF
vm-pipe-to-file $file
done
# Setup proxies inside docker containers
for file in /{root,home/$VM_SSH_USER}/.docker/config.json; do
cat <<EOF |
{
"proxies": {
"default": {
"httpProxy": "$http_proxy",
"httpsProxy": "$https_proxy",
"noProxy": "$no_proxy,$ext_no_proxy"
}
}
}
EOF
vm-pipe-to-file $file
done
}
default-setup-oneshot() {
:
}
default-install-utils() {
# $distro-install-utils() is responsible for installing common
# utilities, such as pidof and killall, that the test framework
# and tests in general can expect to be found on VM.
:
}
default-k8s-cni() {
echo ${k8scni:-bridge}
}
default-k8s-cni-subnet() {
if [ "$(distro-k8s-cni)" == "flannel" ]; then
echo 10.244.0.0/16
else
echo 10.217.0.0/16
fi
}
default-install-runc() {
distro-install-pkg runc
}
default-install-containerd() {
vm-command-q "[ -f /usr/bin/containerd ]" || {
distro-install-pkg containerd
}
}
default-config-containerd() {
if vm-command-q "[ ! -f /etc/containerd/config.toml ]"; then
vm-command "mkdir -p /etc/containerd && containerd config default > /etc/containerd/config.toml"
fi
vm-sed-file /etc/containerd/config.toml 's/^.*disabled_plugins *= *.*$/disabled_plugins = []/'
if vm-command-q "containerd config dump | grep -v -q SystemdCgroup"; then
vm-command "containerd config dump > /etc/containerd/config.toml"
fi
vm-sed-file /etc/containerd/config.toml 's/SystemdCgroup = false/SystemdCgroup = true/g'
}
default-restart-containerd() {
vm-command "systemctl daemon-reload && systemctl restart containerd" ||
command-error "failed to restart containerd systemd service"
}
default-install-crio() {
[ -n "$crio_src" ] || error "crio install error: crio_src is not set"
[ -x "$crio_src/bin/crio" ] || error "crio install error: file not found $crio_src/bin/crio"
for f in crio crio-status pinns; do
vm-put-file "$crio_src/bin/$f" "/usr/bin/$f"
done
cat <<EOF |
[Unit]
Description=cri-o container runtime
Documentation=https://cri-o.io
After=network.target
[Service]
ExecStart=/usr/bin/crio
Delegate=yes
KillMode=process
Restart=always
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=1048576
TasksMax=infinity
[Install]
WantedBy=multi-user.target
EOF
vm-pipe-to-file /etc/systemd/system/crio.service
vm-command "mkdir -p /etc/systemd/system/crio.service.d"
vm-command "(echo \"[Service]\"; echo \"Environment=PATH=/sbin:/usr/sbin:$PATH:/usr/libexec/podman\") > /etc/systemd/system/crio.service.d/path.conf; systemctl daemon-reload"
}
default-config-crio() {
vm-command "mkdir -p /etc/containers"
echo '{"default": [{"type":"insecureAcceptAnything"}]}' | vm-pipe-to-file /etc/containers/policy.json
cat <<EOF |
[registries.search]
registries = ['docker.io']
EOF
vm-pipe-to-file /etc/containers/registries.conf
}
default-restart-crio() {
vm-command "systemctl daemon-reload && systemctl restart crio" ||
command-error "failed to restart crio systemd service"
}
default-install-minikube() {
vm-command "curl -Lo /usr/local/bin/minikube https://storage.googleapis.com/minikube/releases/${MINIKUBE_VERSION}/minikube-linux-amd64 && chmod +x /usr/local/bin/minikube"
distro-install-crictl
}
default-install-crictl() {
vm-command "set -e -x
wget https://github.com/kubernetes-sigs/cri-tools/releases/download/${CRICTL_VERSION}/crictl-${CRICTL_VERSION}-linux-amd64.tar.gz
sudo tar zxvf crictl-${CRICTL_VERSION}-linux-amd64.tar.gz -C /usr/local/bin
rm -f crictl-${CRICTL_VERSION}-linux-amd64.tar.gz
"
}
default-install-cri-dockerd() {
vm-command "set -e -x
git clone --depth=1 https://github.com/Mirantis/cri-dockerd.git
cd cri-dockerd
mkdir bin
go build -o bin/cri-dockerd
mkdir -p /usr/local/bin
install -o root -g root -m 0755 bin/cri-dockerd /usr/local/bin/cri-dockerd
cp -a packaging/systemd/* /etc/systemd/system
sed -i -e 's,/usr/bin/cri-dockerd,/usr/local/bin/cri-dockerd,' /etc/systemd/system/cri-docker.service
systemctl daemon-reload
systemctl enable cri-docker.service
systemctl enable --now cri-docker.socket
"
}
default-govm-env() {
echo "DISABLE_VGA=Y"
}
default-env-file-dir() {
echo "/etc/sysconfig"
}
###########################################################################
#
# generic supporting functions
#
from-tarball-install-golang() {
vm-command-q "go version | grep -q go$GOLANG_VERSION" || {
vm-command "wget --progress=dot:giga $GOLANG_URL -O go.tgz" && \
vm-command "tar -C /usr/local -xvzf go.tgz >/dev/null && rm go.tgz" && \
vm-command "echo 'PATH=/usr/local/go/bin:\$PATH' > /etc/profile.d/go.sh" && \
vm-command "echo \* installed \$(go version)"
}
}
create-ext4-var-lib-containerd() {
local dir="/var/lib/containerd" file="/loop-ext4.dsk" dev
echo "Creating loopback-mounted ext4 $dir..."
if ! dev="$(vm-command-q "losetup -f")" || [ -z "$dev" ]; then
command-error "failed to find unused loopback device"
fi
vm-command "dd if=/dev/zero of=$file bs=$((1024*1000)) count=$((1000*5))" ||
command-error "failed to create file for ext4 loopback mount"
vm-command "losetup $dev $file" ||
command-error "failed to attach $file to $dev"
vm-command "mkfs.ext4 $dev" ||
command-error "failed to create ext4 filesystem on $dev ($file)"
if vm-command "[ -d $dir ]"; then
vm-command "mv $dir $dir.orig" ||
command-error "failed to rename original $dir to $dir.orig"
fi
vm-command "mkdir -p $dir" ||
command-error "failed to create $dir"
cat <<EOF |
[Unit]
Description=Activate loop device
DefaultDependencies=no
After=systemd-udev-settle.service
Wants=systemd-udev-settle.service
[Service]
ExecStart=/sbin/losetup $dev $file
Type=oneshot
[Install]
WantedBy=local-fs.target
EOF
vm-pipe-to-file /etc/systemd/system/attach-loop-devices.service
vm-command "systemctl enable attach-loop-devices.service"
cat <<EOF |
$dev $dir ext4 defaults 1 2
EOF
vm-pipe-to-file --append /etc/fstab
vm-command "mount $dir" ||
command-error "failed to mount new ext4 $dir"
if vm-command "[ -d $dir.orig ]"; then
vm-command "tar -C $dir.orig -cf - . | tar -C $dir -xf -" ||
command-error "failed to copy $dir.orig to $dir"
fi
}
CNI_SUBNET=$(distro-k8s-cni-subnet)
================================================
FILE: demo/lib/host.bash
================================================
source "$(dirname "${BASH_SOURCE[0]}")/command.bash"
HOST_PROMPT=${HOST_PROMPT-"\e[38;5;11mhost>\e[0m "}
HOST_LIB_DIR="$(dirname "${BASH_SOURCE[0]}")"
HOST_PROJECT_DIR="$(dirname "$(dirname "$(realpath "$HOST_LIB_DIR")")")"
HOST_VM_IMAGE_DIR=~/vms/images
HOST_VM_DATA_DIR_TEMPLATE="~/vms/data/\${VM_NAME}"
if [ -z "$HOST_GORESCTRL_DIR" ]; then
HOST_GORESCTRL_DIR="$(realpath "$HOST_PROJECT_DIR/../goresctrl")"
fi
GOVM=${GOVM-govm}
host-command() {
command-start "host" "$HOST_PROMPT" "$1"
bash -c "$COMMAND" 2>&1 | command-handle-output
command-end ${PIPESTATUS[0]}
return $COMMAND_STATUS
}
host-require-govm() {
command -v "$GOVM" >/dev/null || error "cannot run govm \"$GOVM\". Check PATH or set GOVM=/path/to/govm."
}
host-require-cmd() {
command -v "$1" >/dev/null || error "cannot run \"$1\". Check dependencies."
}
host-get-vm-config() {
if [ -z "$1" ]; then
error "can't get VM configuration, name not set"
fi
VM_NAME="$1"
HOST_VM_DATA_DIR="$(eval "echo $HOST_VM_DATA_DIR_TEMPLATE")"
VM_DATA_CONFIG="$HOST_VM_DATA_DIR/vm-config"
if ! [ -f "$VM_DATA_CONFIG" ]; then
return 1
fi
source "$VM_DATA_CONFIG"
if [ -z "$VM_NAME" ] || [ -z "$VM_DISTRO" ] || [ -z "$VM_CRI" ] || [ -z "$VM_SSH_USER" ]; then
return 1
fi
VM_COMPOSE_YAML="$HOST_VM_DATA_DIR/govm-compose.yaml"
}
host-set-vm-config() {
if [ -z "$1" ]; then
error "can't configure VM, name not set"
fi
if [ -z "$2" ]; then
error "can't configure VM, distro not set"
fi
if [ -z "$3" ]; then
error "can't configure VM, CRI runtime not set"
fi
VM_NAME="$1"
VM_DISTRO="$2"
VM_CRI="$3"
VM_SSH_USER="$(vm-ssh-user)"
HOST_VM_DATA_DIR="$(eval "echo $HOST_VM_DATA_DIR_TEMPLATE")"
mkdir -p "$HOST_VM_DATA_DIR"
VM_COMPOSE_YAML="$HOST_VM_DATA_DIR/govm-compose.yaml"
VM_DATA_CONFIG="$HOST_VM_DATA_DIR/vm-config"
cat > "$VM_DATA_CONFIG" <<EOF
VM_NAME="$VM_NAME"
VM_DISTRO="$VM_DISTRO"
VM_CRI="$VM_CRI"
VM_SSH_USER="$VM_SSH_USER"
EOF
}
host-fetch-vm-image() {
local url=$(vm-image-url)
local file=$(basename $url)
local image decompress
[ -d "$HOST_VM_IMAGE_DIR" ] || mkdir -p "$HOST_VM_IMAGE_DIR" ||
error "cannot create directory for VM images: $HOST_VM_IMAGE_DIR"
case $file in
*.xz)
image=${file%.xz}
decompress="xz -d"
;;
*.bz2)
image=${file%.bz2}
decompress="bzip -d"
;;
*.gz)
image=${file%.gz}
decompress="gzip -d"
;;
*)
image="$file"
decompress=":"
;;
esac
[ -f "$HOST_VM_IMAGE_DIR/$image" ] || {
echo "VM image $HOST_VM_IMAGE_DIR/$image not found..."
[ -f "$HOST_VM_IMAGE_DIR/$file" ] || {
echo "downloading VM image $image..."
host-command "wget --progress=dot:giga -O \"$HOST_VM_IMAGE_DIR/$file\" \"$url\"" ||
error "failed to download VM image ($url)"
}
if [ -n "$decompress" ]; then
echo "decompressing VM image $file..."
( cd "$HOST_VM_IMAGE_DIR" && $decompress $file ) ||
error "failed to decompress $file to $image using $decompress"
fi
if [ ! -f "$HOST_VM_IMAGE_DIR/$image" ]; then
error "internal error, fetching+decompressing $url did not produce $HOST_VM_IMAGE_DIR/$image"
fi
}
VM_IMAGE="$HOST_VM_IMAGE_DIR/$image"
}
host-create-vm() {
# Usage: host-create-vm NAME [NUMANODELIST_JSON]
#
# If successful, VM_IP variable contains the IP address of the govm guest.
#
# If NUMANODELIST_JSON is given, Qemu CPU and memory parameters are
# generated from it. Example, create VM with four identical NUMA nodes:
# host-create-vm myvm '[{"cpu": 2, "mem": "2G", "nodes": 4}]'
#
# If NUMANODELIST_JSON is not given, Qemu CPU and memory parameters
# can be defined directly in VM_QEMU_CPUMEM environment variable.
# VM_QEMU_CPUMEM is expected to contain at least parameters
# -m MEMORY -smp CPUCORES
#
# Example: four numa nodes, 2 cores each
# VM_QEMU_CPUMEM="-m 8G,slots=4,maxmem=32G \
# -smp cpus=8 \
# -numa node,cpus=0-1,nodeid=0 \
# -numa node,cpus=2-3,nodeid=1 \
# -numa node,cpus=4-5,nodeid=2 \
# -numa node,cpus=6-7,nodeid=3 \
# -cpu host"
# host-create-vm my-four-numa-node-pc
#
# If NUMANODELIST_JSON parameter or VM_QEMU_CPUMEM environment
# variable defined, the VM will be created with "govm compose" and
# VM_GOVM_COMPOSE_TEMPLATE yaml. In both cases parameters in
# VM_QEMU_EXTRA environment variable are passed through to Qemu.
#
# Debug Qemu parameters and output with
# $ docker logs $(docker ps | awk '/govm/{print $1; exit}')
#
local TOPOLOGY="$2"
if [ -z "$VM_NAME" ]; then
error "cannot create VM: missing name"
fi
if [ -n "$TOPOLOGY" ]; then
if [ -n "$VM_QEMU_CPUMEM" ]; then
error "cannot take both VM_QEMU_CPUMEM and numa node JSON"
fi
VM_QEMU_CPUMEM=$(echo "$TOPOLOGY" | "$HOST_LIB_DIR/topology2qemuopts.py")
if [ "$?" -ne "0" ]; then
error "error in topology"
fi
fi
host-require-govm
# If VM does not exist, create it from scrach
${GOVM} ls | grep -q "$VM_NAME" || {
host-fetch-vm-image
mkdir -p "$(dirname "$VM_COMPOSE_YAML")"
vm-compose-govm-template > "$VM_COMPOSE_YAML"
host-command "${GOVM} compose -f \"$VM_COMPOSE_YAML\""
echo "# VM base image : $VM_IMAGE"
echo "# VM govm yaml : $VM_COMPOSE_YAML"
}
sleep 1
VM_CONTAINER_ID=$(${GOVM} ls | awk "/$VM_NAME/{print \$1}")
# Verify Qemu version. Refuse to run if Qemu < 5.0.
# Use "docker run IMAGE" instead of "docker exec CONTAINER",
# because the container may have already failed.
VM_CONTAINER_IMAGE=$(docker inspect $VM_CONTAINER_ID | jq '.[0].Image' -r | awk -F: '{print $2}')
echo "# VM name : $VM_NAME"
echo "# VM Linux distro: $VM_DISTRO"
echo "# VM CRI : $VM_CRI"
echo "# VM Docker image: $VM_CONTAINER_IMAGE"
echo "# VM Docker cntnr: $VM_CONTAINER_ID"
if [ -n "$VM_CONTAINER_IMAGE" ]; then
VM_CONTAINER_QEMU_VERSION=$(docker run --rm --entrypoint=/usr/bin/qemu-system-x86_64 $VM_CONTAINER_IMAGE -version | awk '/QEMU emulator version/{print $4}')
fi
if [ -n "$VM_CONTAINER_QEMU_VERSION" ]; then
if [[ "$VM_CONTAINER_QEMU_VERSION" > "5" ]]; then
echo "# VM Qemu version: $VM_CONTAINER_QEMU_VERSION"
else
if [[ "$QEMU_CPUMEM" =~ ",dies=" ]]; then
error "Too old Qemu version \"$VM_CONTAINER_QEMU_VERSION\". Topology with dies > 1 requires Qemu >= 5.0"
else
echo "# (Your Qemu does not support dies > 1, consider updating for full topology support)"
fi
fi
else
echo "Warning: cannot verify Qemu version on govm image. In case of failure, check it is >= 5.0" >&2
fi
echo "# VM Qemu output : docker logs $VM_CONTAINER_ID"
echo "# VM Qemu monitor: docker exec -it $VM_CONTAINER_ID nc local:/data/monitor"
VM_MONITOR="docker exec -i $VM_CONTAINER_ID nc local:/data/monitor"
host-wait-vm-ssh-server
host-wait-cloud-init
}
get-ssh-timeout() {
echo $((`date +%s` + $1))
}
host-wait-vm-ssh-server() {
timeout=`get-ssh-timeout 120`
while [ "${1#-}" != "$1" ] && [ -n "$1" ]; do
case "$1" in
--timeout)
timeout=`get-ssh-timeout $2`
shift; shift
;;
*)
invalid="${invalid}${invalid:+,}\"$1\""
shift
;;
esac
done
if [ -n "$invalid" ]; then
error "invalid options: $invalid"
return 1
fi
if [ -z "$VM_IP" ]; then
VM_IP=$(${GOVM} ls | awk "/$VM_NAME/{print \$4}")
while [ "x$VM_IP" == "x" ]; do
host-command "${GOVM} start \"$VM_NAME\""
sleep 5
VM_IP=$(${GOVM} ls | awk "/$VM_NAME/{print \$4}")
done
fi
echo "# VM SSH server : ssh $VM_SSH_USER@$VM_IP"
if [ -d "$HOME/vms/data/$VM_NAME" ]; then
SSH_OPTS="$SSH_OPTS -o ControlMaster=auto -o ControlPath=$HOME/vms/data/$VM_NAME/ssh -o ControlPersist=30"
SSH="${SSH%% *} $SSH_OPTS"
SCP="${SCP%% *} $SSH_OPTS"
export SSH SSH_OPTS SCP
fi
ssh-keygen -f "$HOME/.ssh/known_hosts" -R "$VM_IP" >/dev/null 2>&1
print_info=1
while ! $SSH ${VM_SSH_USER}@${VM_IP} -o ConnectTimeout=2 true 2>/dev/null; do
CURR_TIME=`date +%s`
if [ $CURR_TIME -gt $timeout ]; then
error "timeout"
fi
if [ "$print_info" == 1 ]; then
echo -n "Waiting for VM SSH server to respond..."
print_info=0
fi
sleep 2
echo -n "."
done
echo ""
}
host-wait-cloud-init() {
retries=60
retries_left=$retries
while true; do
$SSH -o ConnectTimeout=2 ${VM_SSH_USER}@${VM_IP} sudo cloud-init status --wait 2>/dev/null
[ "$?" -eq 0 -o "$?" -eq 2 ] && break
if [ "$retries" == "$retries_left" ]; then
echo -n "Waiting for VM cloud-init to finish..."
fi
sleep 2
echo -n "."
retries_left=$(( $retries_left - 1 ))
if [ "$retries_left" == "0" ]; then
error "timeout"
fi
done
[ "$retries" == "$retries_left" ] || echo ""
}
host-stop-vm() {
#VM_NAME=$1
host-require-govm
host-command "${GOVM} stop $VM_NAME" || {
command-error "stopping govm \"$VM_NAME\" failed"
}
}
host-delete-vm() {
#VM_NAME=$1
host-require-govm
host-command "${GOVM} delete $VM_NAME" || {
command-error "deleting govm \"$VM_NAME\" failed"
}
}
host-is-encrypted-ssh-key() {
ssh-keygen -y -f "$1" < /dev/null >& /dev/null
if [ $? != 0 ]; then
return 0
else
return 1
fi
}
host-mount-vm() {
# Usage: host-mount-vm
#
# Mount VM / to VM data directory on host.
# host-get-vm-config NAME must be run first.
local mountpoint="${HOST_VM_DATA_DIR}/sshfs"
local vm_sftp_server=""
local vm_sftp_server_candidates=(/usr/lib/openssh/sftp-server /usr/libexec/sftp-server)
local vm_sftp_server_candidate
command -v sshfs >/dev/null || {
error "host-mount-vm: missing sshfs"
}
if mount | grep "${mountpoint}"; then
echo "host-mount-vm: already mounted"
return 0
fi
for vm_sftp_server_candidate in "${vm_sftp_server_candidates[@]}"; do
if vm-command-q "command -v ${vm_sftp_server_candidate} >/dev/null"; then
vm_sftp_server="${vm_sftp_server_candidate}"
break
fi
done
if [ -z "${vm_sftp_server}" ]; then
error "cannot find sftp-server from vm"
fi
mkdir -p "${mountpoint}"
sshfs "${VM_SSH_USER}@${VM_IP}:/" "${mountpoint}" -o sftp_server="/usr/bin/sudo ${vm_sftp_server}" $SSH_OPTS || {
error "sshfs mount failed"
}
echo "host-mount-vm: mounted ${VM_NAME}:/ to ${mountpoint}"
}
================================================
FILE: demo/lib/numactlH2numajson.py
================================================
#!/usr/bin/env python3
"""numactlH2numajson - convert numactl -H output to numajson
Example:
numactl -H | numactlH2numajson
"""
import json
import math
import re
import sys
QEMU_DEFAULT_DIST_OTHER = 20
QEMU_DEFAULT_DIST_SELF = 10
def error(msg, exit_status=1):
sys.stderr.write("numactlH2numajson: %s\n" % (msg,))
if not exit_status is None:
sys.exit(1)
def round_size(size, size_unit, non_zero_numbers=3):
if size_unit == "kB":
size_mb = size / 1024
elif size_unit == "MB":
size_mb = size
elif size_unit == "GB":
size_mb = size * 1024
elif size_unit == "TB":
size_mb = size * 1024 * 1024
else:
raise Exception("unsupported size unit: %r" % (size_unit,))
if size_mb == 0:
return "0G"
size_mul = 10**int(math.log10(size_mb))
rounded = round(size_mb * 10**(non_zero_numbers-1) / size_mul) * size_mul / (10**(non_zero_numbers-1))
if size_mul < 1000:
return "%.0fM" % (rounded,)
else:
return "%.0fG" % (rounded/1000)
def add_dists_to_numalist(numalist, dists):
"""Add/replace distance information in numalist with node distances in dists.
dists[i][j] = distance from node i to node j.
dists can be a matrix or a dict: {sourcenode: {destnode: dist}}"""
dist_matrix = []
node = -1
node_group = {} # {node: group_index_in_numalist}
group_nodes = {} # {group_index_in_numalist: set_of_nodes}
for groupindex, numaspec in enumerate(numalist):
group_nodes[groupindex] = set()
nodecount = int(numaspec.get("nodes", 1))
for _ in range(nodecount):
node += 1
group_nodes[groupindex].add(node)
node_group[node] = groupindex
lastnode = node
if isinstance(dists, list):
# dists is a dist matrix.
dist_matrix = dists
else:
# dists is a dict. create dist_matrix from it.
for sourcenode in range(lastnode + 1):
dist_matrix.append([])
for destnode in range(lastnode + 1):
if sourcenode in dists and destnode in dists[sourcenode]:
d = dists[sourcenode][destnode]
elif sourcenode != destnode:
d = QEMU_DEFAULT_DIST_OTHER
else:
d = QEMU_DEFAULT_DIST_SELF
dist_matrix[-1].append(d)
dist_freq = {} # {distance: number-of-appearances}
try:
for sourcenode in range(lastnode + 1):
for destnode in range(lastnode + 1):
if sourcenode != destnode:
d = dist_matrix[sourcenode][destnode]
dist_freq[d] = dist_freq.get(d, 0) + 1
except IndexError:
raise ValueError("invalid dists matrix dimensions, %sx%s expected" % (lastnode + 1, lastnode + 1))
# Read the most common distance from the matrix, ignore distance-to-self.
if len(dist_freq) > 0:
default_dist = max([(v, k) for k, v in dist_freq.items()])[1]
else:
default_dist = QEMU_DEFAULT_DIST_SELF # don't care: there's only one node
# Try filling symmetric distances with the default dist.
# There may be asymmetry or node grouping that making this impossible.
# In those cases sym_dist_errors > 0.
sym_dist_errors = 0
group_node_dist = {} # {group_index: {othernode: dist}}
for sourcenode in range(lastnode + 1):
sourcegroup = node_group[sourcenode]
if not sourcegroup in group_node_dist:
group_node_dist[sourcegroup] = {}
for destnode in range(lastnode + 1):
destgroup = node_group[destnode]
if sourcenode == destnode:
continue
elif dist_matrix[sourcenode][destnode] == default_dist:
continue
elif dist_matrix[sourcenode][destnode] != dist_matrix[destnode][sourcenode]:
# There is asymmetry.
sym_dist_errors += 1
continue
for othernode in [n for n in group_nodes[sourcegroup] if n != sourcenode and n != destnode]:
if (dist_matrix[othernode][destnode] != dist_matrix[sourcenode][destnode] or
dist_matrix[othernode][destnode] != dist_matrix[destnode][sourcenode]):
# Different nodes in the same group have different distances.
sym_dist_errors += 1
group_node_dist[sourcegroup][destnode] = dist_matrix[sourcenode][destnode]
# Clear existing distance definitions from numalist.
for numaspec in numalist:
if "dist" in numaspec:
del numaspec["dist"]
if "dist-all" in numaspec:
del numaspec["dist-all"]
if "node-dist" in numaspec:
del numaspec["node-dist"]
# Now we are ready to add distance information.
if sym_dist_errors == 0 and len(str(group_node_dist)) < len(str(dist_matrix)):
# Add info using "dist" and "node-dist", that is symmetrical distances.
# This time it is more compact representation than a matrix.
for groupindex, numaspec in enumerate(numalist):
if group_node_dist[groupindex] != {}:
# if all nodes mentioned in node-dist are in earlier groups,
# there is no need to inject this definition, because it has been
# covered by distance symmetry.
nodes_with_dists = set(group_node_dist[groupindex].keys())
for earlier_group in range(groupindex):
nodes_with_dists -= group_nodes[earlier_group]
# there are new distance definitions, include all
if len(nodes_with_dists) > 0:
numaspec["node-dist"] = group_node_dist[groupindex]
if default_dist != QEMU_DEFAULT_DIST_OTHER:
numalist[0]["dist"] = default_dist
elif len(numalist) > 1:
# Add distances as a matrix.
numalist[-1]["dist-all"] = dist_matrix
else:
# There is no need for distance information in the numalist,
# as there is only one node.
pass
def numactlH2numajson(input_line_iter):
numalist = []
dist_matrix = []
re_node_cpus = re.compile('^node (?P<node>[0-9]+) cpus:( (?P<cpus>([0-9]+\s?)*))?')
re_node_size = re.compile('^node (?P<node>[0-9]+) size:( (?P<size>[0-9]+) (?P<size_unit>[a-zA-Z]+))?')
re_node_distances = re.compile('^\s*(?P<sourcenode>[0-9]+):(?P<dists>(\s*[0-9]+)*)')
for line in input_line_iter:
m = re_node_cpus.match(line)
if m:
m_dict = m.groupdict()
node = int(m_dict["node"])
if m_dict["cpus"] is None:
cpus = []
else:
cpus = [int(cpu) for cpu in m.groupdict()["cpus"].strip().split()]
continue
m = re_node_size.match(line)
if m:
m_dict = m.groupdict()
if int(m_dict["node"]) != node:
raise Exception("expected node %s size, got %r" % (node, line))
size_unit = m_dict["size_unit"]
mem = round_size(int(m_dict["size"]), size_unit)
if (len(numalist) == 0
or numalist[-1]["cpu"] != len(cpus)
or numalist[-1]["mem"] != mem):
# found a node that is different from the previous
numalist.append({"cpu": len(cpus),
"mem": mem,
"nodes": 1})
else:
# found a node that looks the same as the previous
numalist[-1]["nodes"] += 1
nodecount = node + 1
continue
m = re_node_distances.match(line)
if m:
m_dict = m.groupdict()
dist_matrix.append([int(d) for d in m_dict['dists'].strip().split()])
# filter out unnecessary "nodes": 1 from the list:
for d in numalist:
if d["nodes"] == 1:
del d["nodes"]
# parse distances
add_dists_to_numalist(numalist, dist_matrix)
return numalist
def self_test():
input_output = {
"""available: 5 nodes (0-4)
node 0 cpus: 0
node 0 size: 1007 MB
node 0 free: 784 MB
node 1 cpus: 1
node 1 size: 1007 MB
node 1 free: 262 MB
node 2 cpus: 2 3
node 2 size: 1951 MB
node 2 free: 1081 MB
node 3 cpus: 4 5 6 7
node 3 size: 4030 MB
node 3 free: 693 MB
node 4 cpus:
node 4 size: 8039 MB
node 4 free: 8029 MB
node distances:
node 0 1 2 3 4
0: 10 22 22 22 88
1: 22 10 22 22 88
2: 22 22 10 22 88
3: 22 22 22 10 88
4: 88 88 88 88 10
""": [{'cpu': 1, 'mem': '1G', 'nodes': 2, 'node-dist': {4: 88}, 'dist': 22}, {'cpu': 2, 'mem': '2G', 'node-dist': {4: 88}}, {'cpu': 4, 'mem': '4G', 'node-dist': {4: 88}}, {'cpu': 0, 'mem': '8G'}],
"""available: 2 nodes (0-1)
node 0 cpus: 0 1 2 3
node 0 size: 3966 MB
node 0 free: 1649 MB
node 1 cpus: 4 5 6 7
node 1 size: 4006 MB
node 1 free: 983 MB
node distances:
node 0 1
0: 10 20
1: 20 10
""": [{'cpu': 4, 'mem': '4G', 'nodes': 2}],
"""available: 4 nodes (0-3)
node 0 cpus: 0 1 2 3
node 0 size: 3966 MB
node 0 free: 1649 MB
node 1 cpus: 4 5 6 7
node 1 size: 4006 MB
node 1 free: 983 MB
node 1 cpus: 8 9 10 11
node 1 size: 4006 MB
node 1 free: 983 MB
node 1 cpus: 12 13 14 15
node 1 size: 4006 MB
node 1 free: 983 MB
node distances:
node 0 1 2 3
0: 10 55 55 55
1: 55 10 55 55
2: 55 55 10 55
3: 55 55 55 10
""": [{'cpu': 4, 'mem': '4G', 'nodes': 4, 'dist': 55}],
"""available: 1 nodes (0)
node 0 cpus: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
node 0 size: 128000 MB
node 0 free: 80000 MB
node distances:
node 0
0: 10
""": [{'cpu': 20, 'mem': '128G'}],
"""available: 5 nodes (0-4)
node 0 cpus: 0
node 0 size: 4007 MB
node 0 free: 784 MB
node 1 cpus: 1
node 1 size: 1007 MB
node 1 free: 262 MB
node 2 cpus: 2 3
node 2 size: 1951 MB
node 2 free: 1081 MB
node 3 cpus: 4 5 6 7
node 3 size: 4030 MB
node 3 free: 693 MB
node 4 cpus:
node 4 size: 8039 MB
node 4 free: 8029 MB
node distances:
node 0 1 2 3 4
0: 10 22 33 44 55
1: 22 10 22 22 22
2: 33 22 10 22 22
3: 44 22 22 10 22
4: 55 22 22 22 10
""": [{'cpu': 1, 'mem': '4G', 'node-dist': {2: 33, 3: 44, 4: 55}, 'dist': 22}, {'cpu': 1, 'mem': '1G'}, {'cpu': 2, 'mem': '2G'}, {'cpu': 4, 'mem': '4G'}, {'cpu': 0, 'mem': '8G'}]
}
for input_string in input_output.keys():
observed = numactlH2numajson(input_string.splitlines())
expected = input_output[input_string]
if observed != expected:
raise Exception("self-test: observed/expected mismatch on numanodes\n%s\n\nobserved: %r\nexpected: %r" % (input_string, observed, expected))
add_dists_to_numalist([], [])
return 0
if __name__ == "__main__":
if len(sys.argv) > 1 and sys.argv[1] == "test":
sys.exit(self_test())
try:
numalist = numactlH2numajson(sys.stdin)
except Exception as e:
raise
error(str(e))
print(json.dumps(numalist))
================================================
FILE: demo/lib/topology.py
================================================
#!/usr/bin/env python3
"""topology.py - topology utility
Usage: topology.py [options] command
Options:
-t TOPOLOGY_DUMP load topology_dump from TOPOLOGY_DUMP file instead of
the "topology_dump" environment variable or local host.
-r RES_ALLOWED load res_allowed from RES_ALLOWED file instead of
the "res_allowed" environment variable or local host.
-o OUTPUT_FORMAT "json" or "text". The default is "text".
Commands:
help print help
cpus view CPU topology from topology_dump.
cpus_allowed [PROCESS...]
view how matching PROCESSes are allowed to use CPUs.
(Uses RES_ALLOWED like res_allowed below.)
res view CPU and memory topology from topology_dump.
res_allowed [PROCESS...]
view how matching PROCESSes are allowed to use CPUs
and memory in CPU/mem topology tree.
If the RES_ALLOWED file or the res_allowed
environment variable are not defined, "pgrep -f PROCESS"
is used to match processes.
bash_topology_dump print a Bash command that creates topology_dump.
bash_res_allowed PROCESS [PROCESS...]
print a Bash command that creates res_allowed
dump that contains Cpus_allowed and Mems_allowed
masks of processes matching "pgrep -f PROCESS".
Examples:
Print local host CPU topology
$ topology.py cpus
Print how processes with pod0..2 in their names are allowed to use CPUs
$ topology.py res_allowed pod0 pod1 pod2
Print remote host CPU topology
$ topology_dump="$(ssh remotehost "$(topology.py bash_topology_dump)")" topology.py cpus
Watch how pod0..2 are allowed to CPUS on remote host, read topology only once
$ export topology_dump="$(ssh remotehost "$(topology.py bash_topology_dump)")"
$ watch 'res_allowed=$(ssh remotehost "$(topology.py bash_res_allowed pod0 pod1 pod2)") topology.py res_allowed'
"""
import getopt
import json
import os
import re
import subprocess
import sys
_bash_topology_dump = """for cpu in /sys/devices/system/cpu/cpu[0-9]*; do cpu_id=${cpu#/sys/devices/system/cpu/cpu}; echo "cpu p:$(< ${cpu}/topology/physical_package_id) d:$(< ${cpu}/topology/die_id) n:$(basename ${cpu}/node* | sed 's:node::g') c:$(< ${cpu}/topology/core_id) t:$(< ${cpu}/topology/thread_siblings) cpu:${cpu_id}" ; done; for node in /sys/devices/system/node/node[0-9]*; do node_id=${node#/sys/devices/system/node/node}; echo "dist n:$node_id d:$(< $node/distance)"; echo "mem n:$node_id s:$(awk '/MemTotal/{print $4/1024}' < $node/meminfo)"; done"""
_bash_res_allowed = r"""for process in '%s'; do for pid in $(pgrep -f "$process"); do proc_pid_cmdline=$(< /proc/$pid/cmdline) || continue; proc_pid_status=$(< /proc/$pid/status) || continue; name=$(echo "$proc_pid_cmdline" | tr '\0 ' '\n' | grep -E "^$process" | head -n 1); [ -n "$name" ] && [ "$pid" != "$$" ] && [ "$pid" != "$PPID" ] && echo "${name}/${pid} $(awk '/Cpus_allowed:/{c=$2}/Mems_allowed:/{m=$2}END{print "c:"c" m:"m}' <<< "$proc_pid_status")"; done 2>/dev/null; done"""
def error(msg, exit_status=1):
"""Print error message and exit."""
if not msg is None:
sys.stderr.write('topology.py: %s\n' % (msg,))
if not exit_status is None:
sys.exit(exit_status)
def warning(msg):
"""Print warning."""
sys.stderr.write('topology.py warning: %s\n' % (msg,))
def output_tree(tree):
"""Print tree to output in OUTPUT_FORMAT"""
if opt_output_format == "json":
sys.stdout.write(json.dumps(tree))
else:
sys.stdout.write(str_tree(tree) + "\n")
sys.stdout.flush()
def add_tree(root, branch, value_dict):
"""Add key-value pairs in value_dict to given branch in the tree starting from root.
If the branch does not exist in the tree, it will be created.
Example:
add_tree(tree, ("package0", "die1", "node3", "core7", "thread0", "cpu15"), {"GHz", 4.2})
"""
node = root
for b in branch:
if b in node:
node = node[b]
else:
node[b] = {}
node = node[b]
node.update(value_dict)
def _str_node(root, lines, branch):
"""Format node names in tree to lines ([[line1col1, line1col2], ...])."""
for key in sorted(root.keys()):
branch.append(key)
if root[key]:
_str_node(root[key], lines, branch)
else:
# Add those column texts to the new line which does not have the same value
# as previous non-empty text in the same column.
new_line = []
new_col_txt_added = False
for col, txt in enumerate(branch):
if new_col_txt_added:
prev_col_txt = ""
else:
for prev_line in lines[::-1]:
if len(prev_line) > col and prev_line[col] != "":
prev_col_txt = prev_line[col]
break
else:
prev_col_txt = ""
if txt != prev_col_txt:
new_line.append(txt)
new_col_txt_added = True
else:
new_line.append("")
lines.append(new_line)
branch.pop()
def str_tree(root):
"""Format tree to string."""
lines = []
_str_node(root, lines, [])
col_max_len = {} # {column-index: max-string-length}
max_col = -1
for line in lines:
for col, txt in enumerate(line):
if col > max_col:
max_col = col
if len(txt) > col_max_len.get(col, -1):
col_max_len[col] = len(txt)
str_lines = []
for line in lines:
line_cols = len(line)
new_str_fmt = ""
for col, txt in enumerate(line):
new_str_fmt += "%-" + str(col_max_len[col] + 1) + "s"
str_lines.append(new_str_fmt % tuple(line))
return "\n".join(str_lines)
def bash_output(cmd):
"""Return standard output of executing cmd in Bash."""
p = subprocess.Popen(["bash", "-c", cmd], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
out, err = p.communicate()
return out.decode("utf-8")
def get_local_topology_dump():
"""Return topology_dump from local system."""
return bash_output(_bash_topology_dump)
def get_local_res_allowed_dump(processes):
"""Return res_allowed from local system."""
return bash_output(_bash_res_allowed % ("' '".join(processes),))
def dump_to_topology(dump, show_mem=True):
"""Parse topology_dump, return topology data structures."""
# Output data structures:
tree = {} # {"package0": {"die1": {"node1": ...}}}
cpu_branch = {} # {cpu_id: (package_name, die_name, node_name, core_name, thread_name, cpu_name)}
node_branch = {} # {node_id: (package_name, die_name, node_name)}
mem_branch = {} # {node_id: (package_name, ...)}
# Example input line to be parsed:
# cpu line:
# "cpu p:0 d:1 n:3 c:2 t:00003000 cpu:13"
# mem line:
# "mem n:4: s:8063.83"
re_cpu_line = re.compile('cpu p:(?P<package>[0-9]+) d:(?P<die>[0-9]*) n:(?P<node>[0-9]+) c:(?P<core>[0-9]+) t:(?P<thread_siblings>[0-9a-f,]+) cpu:(?P<cpu_id>[0-9]+)')
re_mem_line = re.compile('mem n:(?P<node>[0-9]+) s:(?P<size>[0-9.]+)')
re_dist_line = re.compile('dist n:(?P<node>[0-9]+) d:(?P<dist>([0-9 ]+))')
numeric_cpu_lines = []
numeric_mem_lines = []
numeric_dist_lines = []
for line in dump.splitlines():
m = re_cpu_line.match(line)
if m:
mdict = m.groupdict()
package = int(mdict["package"])
try:
die = int(mdict["die"])
except ValueError:
die = 0 # handle kernels that do not provide topology/die_id
node = int(mdict["node"])
core = int(mdict["core"])
thread_siblings = eval("0x" + mdict["thread_siblings"].replace(",", ""))
cpu_id = int(mdict["cpu_id"])
# Calculate thread id.
# Let the lowest CPU bit owner in thread_siblings be thread 0, next thread 1 and so on.
thread = -1
bit = 1 << cpu_id
while bit:
if thread_siblings & bit:
thread += 1
bit >>= 1
numeric_cpu_lines.append((package, die, node, core, thread, cpu_id))
continue
m = re_mem_line.match(line)
if m:
mdict = m.groupdict()
numeric_mem_lines.append((int(mdict["node"]), float(mdict["size"])))
continue
m = re_dist_line.match(line)
if m:
mdict = m.groupdict()
numeric_dist_lines.append((int(mdict["node"]),
tuple([int(n) for n in mdict["dist"].strip().split()])))
numeric_mem_lines.sort() # make sure memory sizes are from node 0, 1, ...
numeric_dist_lines.sort()
# Build tree on CPUs
max_package_len = max(len(str(nl[0])) for nl in numeric_cpu_lines)
max_die_len = max(len(str(nl[1])) for nl in numeric_cpu_lines)
max_node_len = max(len(str(nl[2])) for nl in numeric_cpu_lines)
max_core_len = max(len(str(nl[3])) for nl in numeric_cpu_lines)
max_thread_len = max(len(str(nl[4])) for nl in numeric_cpu_lines)
max_cpu_id_len = max(len(str(nl[5])) for nl in numeric_cpu_lines)
for (package, die, node, core, thread, cpu_id) in numeric_cpu_lines:
branch = ("package" + str(package).zfill(max_package_len),
"die" + str(die).zfill(max_die_len),
"node" + str(node).zfill(max_node_len),
"core" + str(core).zfill(max_core_len),
"thread" + str(thread).zfill(max_thread_len),
"cpu" + str(cpu_id).zfill(max_cpu_id_len))
add_tree(tree, branch, {})
cpu_branch[cpu_id] = branch
node_branch[node] = branch[:3]
if show_mem:
# Add node memory information to the tree
for node, distvec in numeric_dist_lines:
mem_node_name = "node" + str(node).zfill(max_node_len)
node_mem_size = str(int(round((numeric_mem_lines[node][1]/1024)))) + "G"
dists = sorted(distvec)
if node in node_branch:
# This node has CPU(s) as it has been added to the tree already in CPU lines.
# Add memory branch to the tree under the existing node branch.
branch = node_branch[node] + (
"mem", mem_node_name, node_mem_size)
elif (dists[0] == 10 # sane distance-to-self
and (len(dists) < 3 or dists[1] < dists[2]) # there is a node closer than others
and distvec.index(dists[1]) in node_branch): # that node is already in the tree
# This means that the node has the same memory controller as this node.
# Add memory branch from this node under the existing node.
node_same_ctrl = distvec.index(dists[1])
branch = node_branch[node_same_ctrl] + (
"mem", mem_node_name, node_mem_size)
node_branch[node] = branch[:3]
else:
# Suitable memory controller not found, create completely separate branch.
branch = ("packagex", "mem", "node" + str(node).zfill(max_node_len),
"mem", mem_node_name, node_mem_size)
node_branch[node] = branch[:3]
add_tree(tree, branch, {})
mem_branch[node] = branch
return {"tree": tree,
"cpu_branch": cpu_branch,
"node_branch": node_branch,
"mem_branch": mem_branch}
def dump_to_res_allowed(res_allowed_dump):
"""Parse res_allowed data, return allowed cpu and mem bitmasks in a data structure."""
# Output data structure:
owner_mask = {} # {owner_string: {"cpu": bitmask_int, "mem": bitmask_int}}
# Example input line to be parsed:
# "pod2 c:040c0000,00000000 m:00000000,00000300"
re_owner_mask = re.compile(r'(?P<owner>[^ ]+)\s+c:(?P<cpumask>[0-9a-f,]+)\s+m:(?P<memmask>[0-9a-f,]+)')
for line in res_allowed_dump.splitlines():
if not line:
continue
try:
mdict = re_owner_mask.match(line).groupdict()
except:
warning("cannot parse res_allowed line %r" % (line,))
continue
owner_mask[mdict["owner"]] = {
"cpu": eval("0x" + mdict["cpumask"].replace(",", "")),
"mem": eval("0x" + mdict["memmask"].replace(",", ""))
}
return owner_mask
def get_topology(show_mem=True):
"""Return topology data structure."""
# Priority: use file, environment variable or read from local system
if opt_topology_dump:
topology_dump = opt_topology_dump
else:
topology_dump = os.getenv("topology_dump", None)
if topology_dump is None:
topology_dump = get_local_topology_dump()
return dump_to_topology(topology_dump, show_mem=show_mem)
def get_res_allowed(processes):
"""Return res_allowed data structure."""
# Priority: use file, environment variable or read from local system
if opt_res_allowed_dump:
res_allowed_dump = opt_res_allowed_dump
else:
res_allowed_dump = os.getenv("res_allowed", None)
if res_allowed_dump is None:
res_allowed_dump = get_local_res_allowed_dump(processes)
return dump_to_res_allowed(res_allowed_dump)
def report_res(show_mem=True):
"""Print topology tree."""
topology = get_topology(show_mem=show_mem)
output_tree(topology["tree"])
def report_res_allowed(processes, show_mem=True):
"""Print topology tree with allowed processes as leaf nodes."""
topology = get_topology(show_mem=show_mem)
tree = topology["tree"]
cpu_branch = topology["cpu_branch"]
mem_branch = topology["mem_branch"]
node_branch = topology["node_branch"]
max_cpu = max(cpu_branch.keys())
max_node = max(node_branch.keys())
res_allowed = get_res_allowed(processes)
# add found owners to tree as children of cpus
for owner, masks in sorted(res_allowed.items()):
cpumask = masks["cpu"]
memmask = masks["mem"]
for cpu in range(max_cpu + 1):
if cpumask & (1 << cpu):
add_tree(tree, cpu_branch[cpu], {owner: {}})
if show_mem:
for node in range(max_node + 1):
if memmask & (1 << node):
add_tree(tree, mem_branch[node], {owner: {}})
output_tree(tree)
if __name__ == "__main__":
opt_topology_dump = None
opt_res_allowed_dump = None
opt_output_format = "text"
try:
options, commands = getopt.gnu_getopt(
sys.argv[1:], 'ht:r:o:',
['help', '--topology-dump-file=', '--res-allowed-file='])
except getopt.GetoptError as e:
error(str(e))
for opt, arg in options:
if opt in ["-h", "--help"]:
print(__doc__)
error(None, exit_status=0)
elif opt in ["-t", "--topology-file"]:
try:
opt_topology_dump = open(arg).read()
except IOError as e:
error("cannot read topology dump from file %r: %s" % (arg, e))
elif opt in ["-r", "--res-allowed-file"]:
try:
opt_res_allowed_dump = open(arg).read()
except IOError as e:
error("cannot read res_allowed dump from file %r: %s" % (arg, e))
elif opt in ["-o"]:
if arg in ["json", "text"]:
opt_output_format = arg
else:
error("invalid output format %r")
if not commands:
error("missing command, see --help")
elif commands[0] == "help":
print(__doc__)
error(None, exit_status=0)
elif commands[0] == "cpus":
report_res(show_mem=False)
elif commands[0] == "cpus_allowed":
report_res_allowed(commands[1:], show_mem=False)
elif commands[0] == "res":
report_res(show_mem=True)
elif commands[0] == "res_allowed":
report_res_allowed(commands[1:])
elif commands[0] == "bash_topology_dump":
print(_bash_topology_dump)
elif commands[0] == "bash_res_allowed":
print(_bash_res_allowed % ("' '".join(commands[1:]),))
else:
error('invalid command %r' % (commands[0],))
================================================
FILE: demo/lib/topology2qemuopts.py
================================================
#!/usr/bin/env python3
"""topology2qemuopts - convert NUMA node list from JSON to Qemu options
NUMA node group definitions:
"mem" mem (RAM) size on each NUMA node in this group.
The default is "0G".
"nvmem" nvmem (non-volatile RAM) size on each NUMA node
in this group. The default is "0G".
"dimm" "": the default, memory is there without pc-dimm defined.
"plugged": start with cold plugged pc-dimm.
"unplugged": start with free slot for hot plug.
Add the dimm in Qemu monitor at runtime:
device_add pc-dimm,id=dimmX,memdev=memX,node=X
or
device_add nvdimm,id=nvdimmX,memdev=nvmemX,node=X
"cores" number of CPU cores on each NUMA node in this group.
The default is 0.
"threads" number of threads on each CPU core.
The default is 2.
"nodes" number of NUMA nodes on each die.
The default is 1.
"dies" number of dies on each package.
The default is 1.
"packages" number of packages.
The default is 1.
NUMA node distances are defined with following keys:
"dist-all": [[from0to0, from0to1, ...], [from1to0, from1to1, ...], ...]
distances from every node to all nodes.
The order is the same as in to numactl -H
"node distances:" output.
"node-dist": {"node": dist, ...}
symmetrical distances from nodes in this group to other
nodes.
Distances that apply to all NUMA groups if defined in any:
"dist-same-die": N the default distance between NUMA nodes on the same die.
"dist-same-package": N the default distance between NUMA nodes on the same package.
"dist-other-package": N the default distance between NUMA nodes in other packages.
Note that the distance from a node to itself is always 10. The default
distance to a node on the same die is 11, and to other nodes on the
same and different packages is 21.
Example: Each of the first two NUMA groups in the list contains two
NUMA nodes. Each node in the first group includes two CPU cores and 2G
RAM, while nodes in the second group two CPU cores and 1G RAM. The
only NUMA node defined in the third group has 8G of NVRAM, and no CPU.
Every NUMA group with CPU cores adds a package (a socket) to the
configuration, or many identical packages if "packages" > 1. This
example creates a two-socket system, four CPU cores per package. Note
that CPU cores are divided symmetrically to packages, meaning that
every NUMA group with CPU cores should contain the same number of
cores.
$ ( cat << EOF
[
{
"mem": "2G",
"cores": 2,
"nodes": 2
},
{
"mem": "1G",
"cores": 2,
"nodes": 2
},
{
"nvmem": "8G",
"node-dist": {"0": 88, "1": 88, "2": 88, "3": 88,
"4": 66, "5": 66, "7": 66, "8": 66}
}
]
EOF
) | python3 topology2qemuopts.py
"""
import sys
import json
DEFAULT_DIST = 21
DEFAULT_DIST_SAME_PACKAGE = 21
DEFAULT_DIST_SAME_DIE = 11
DEFAULT_DIST_SAME_NODE = 10
def error(msg, exitstatus=1):
sys.stderr.write("topology2qemuopts: %s\n" % (msg,))
if exitstatus is not None:
sys.exit(exitstatus)
def siadd(s1, s2):
if s1.lower().endswith("g") and s2.lower().endswith("g"):
return str(int(s1[:-1]) + int(s2[:-1])) + "G"
raise ValueError('supports only sizes in gigabytes, example: 2G')
def sisub(s1, s2):
if s1.lower().endswith("g") and s2.lower().endswith("g"):
return str(int(s1[:-1]) - int(s2[:-1])) + "G"
raise ValueError('supports only sizes in gigabytes, example: 2G')
def validate(numalist):
if not isinstance(numalist, list):
raise ValueError('expected list containing dicts, got %s' % (type(numalist,).__name__))
valid_keys = set(("mem", "nvmem", "dimm",
"cores", "threads", "nodes", "dies", "packages",
"node-dist", "dist-all",
"dist-other-package", "dist-same-package", "dist-same-die"))
int_range_keys = {'cores': ('>= 0', lambda v: v >= 0),
'threads': ('> 0', lambda v: v > 0),
'nodes': ('> 0', lambda v: v > 0),
'dies': ('> 0', lambda v: v > 0),
'packages': ('> 0', lambda v: v > 0)}
for numalistindex, numaspec in enumerate(numalist):
for key in numaspec:
if not key in valid_keys:
raise ValueError('invalid name %r in node %r' % (key, numaspec))
if key in ["mem", "nvmem"]:
val = numaspec.get(key)
if val == "0":
continue
errmsg = 'invalid %s in node %r, expected string like "2G"' % (key, numaspec)
if not isinstance(val, str):
raise ValueError(errmsg)
try:
siadd(val, "0G")
except ValueError:
raise ValueError(errmsg)
if key in int_range_keys:
try:
val = int(numaspec[key])
if not int_range_keys[key][1](val):
raise Exception()
except:
raise ValueError('invalid %s in node %r, expected integer %s' % (key, numaspec, int_range_keys[key][0]))
if 'threads' in numaspec and int(numaspec.get('cores', 0)) == 0:
raise ValueError('threads set to %s but "cores" is 0 in node %r' % (numaspec["threads"], numaspec))
def dists(numalist):
dist_dict = {} # Return value: {sourcenode: {destnode: dist}}, fully defined for all nodes
sourcenode = -1
lastsocket = -1
dist_same_die = DEFAULT_DIST_SAME_DIE
dist_same_package = DEFAULT_DIST_SAME_PACKAGE
dist_other_package = DEFAULT_DIST # numalist "dist", if defined
node_package_die = {} # topology {node: (package, die)}
dist_matrix = None # numalist "dist_matrix", if defined
node_node_dist = {} # numalist {sourcenode: {destnode: dist}}, if defined for sourcenode
lastnode_in_group = -1
for groupindex, numaspec in enumerate(numalist):
nodecount = int(numaspec.get("nodes", 1))
corecount = int(numaspec.get("cores", 0))
diecount = int(numaspec.get("dies", 1))
packagecount = int(numaspec.get("packages", 1))
first_node_in_group = sourcenode + 1
for package in range(packagecount):
if nodecount > 0:
lastsocket += 1
for die in range(diecount):
for node in range(nodecount):
sourcenode += 1
dist_dict[sourcenode] = {}
node_package_die[sourcenode] = (lastsocket, die)
lastnode_in_group = sourcenode + 1
if "dist" in numaspec:
dist = numaspec["dist"]
if "dist-same-die" in numaspec:
dist_same_die = numaspec["dist-same-die"]
if "dist-same-package" in numaspec:
dist_same_package = numaspec["dist-same-package"]
if "dist-all" in numaspec:
dist_matrix = numaspec["dist-all"]
if "node-dist" in numaspec:
for n in range(first_node_in_group, lastnode_in_group):
node_node_dist[n] = {int(nodename): value for nodename, value in numaspec["node-dist"].items()}
if lastnode_in_group < 0:
raise ValueError('no NUMA nodes found')
lastnode = lastnode_in_group - 1
if dist_matrix is not None:
# Fill the dist_dict directly from dist_matrix.
# It must cover all distances.
if len(dist_matrix) != lastnode + 1:
raise ValueError("wrong dimensions in dist-all %s rows seen, %s expected" % (len(dist_matrix), lastnode))
for sourcenode, row in enumerate(dist_matrix):
if len(row) != lastnode + 1:
raise ValueError("wrong dimensions in dist-all on row %s: %s distances seen, %s expected" % (sourcenode + 1, len(row), lastnode + 1))
for destnode, source_dest_dist in enumerate(row):
dist_dict[sourcenode][destnode] = source_dest_dist
else:
for sourcenode in range(lastnode + 1):
for destnode in range(lastnode + 1):
if sourcenode == destnode:
dist_dict[sourcenode][destnode] = DEFAULT_DIST_SAME_NODE
elif sourcenode in node_node_dist and destnode in node_node_dist[sourcenode]:
# User specified explicit node-to-node distance
dist_dict[sourcenode][destnode] = node_node_dist[sourcenode][destnode]
dist_dict[destnode][sourcenode] = node_node_dist[sourcenode][destnode]
elif not destnode in dist_dict[sourcenode]:
# Set distance based on topology
if node_package_die[sourcenode] == node_package_die[destnode]:
dist_dict[sourcenode][destnode] = dist_same_die
elif node_package_die[sourcenode][0] == node_package_die[destnode][0]:
dist_dict[sourcenode][destnode] = dist_same_package
else:
dist_dict[sourcenode][destnode] = dist_other_package
return dist_dict
def qemuopts(numalist):
machineparam = "-machine pc"
numaparams = []
objectparams = []
deviceparams = []
lastnode = -1
lastcpu = -1
lastdie = -1
lastsocket = -1
lastmem = -1
lastnvmem = -1
totalmem = "0G"
totalnvmem = "0G"
unpluggedmem = "0G"
pluggedmem = "0G"
memslots = 0
groupnodes = {} # groupnodes[NUMALISTINDEX] = (NODEID, ...)
validate(numalist)
# Read cpu counts, and "mem" and "nvmem" sizes for all nodes.
threadcount = -1
for numalistindex, numaspec in enumerate(numalist):
nodecount = int(numaspec.get("nodes", 1))
groupnodes[numalistindex] = tuple(range(lastnode + 1, lastnode + 1 + nodecount))
corecount = int(numaspec.get("cores", 0))
if corecount > 0:
if threadcount < 0:
# threads per cpu, set only once based on the first cpu-ful numa node
threadcount = int(numaspec.get("threads", 2))
threads_set_node = numaspec
else:
# threadcount already set, only check that there is no mismatch
if (numaspec.get("threads", None) is not None and
threadcount != int(numaspec.get("threads"))):
raise ValueError('all CPUs must have the same number of threads, '
'but %r had %s threads (the default) which contradicts %r' %
(threads_set_node, threadcount, numaspec))
cpucount = int(numaspec.get("cores", 0)) * threadcount # logical cpus per numa node (cores * threads)
diecount = int(numaspec.get("dies", 1))
packagecount = int(numaspec.get("packages", 1))
memsize = numaspec.get("mem", "0")
memdimm = numaspec.get("dimm", "")
if memsize != "0":
memcount = 1
else:
memcount = 0
nvmemsize = numaspec.get("nvmem", "0")
if nvmemsize != "0":
nvmemcount = 1
else:
nvmemcount = 0
for package in range(packagecount):
if nodecount > 0 and cpucount > 0:
lastsocket += 1
for die in range(diecount):
if nodecount > 0 and cpucount > 0:
lastdie += 1
for node in range(nodecount):
lastnode += 1
currentnumaparams = []
for mem in range(memcount):
lastmem += 1
if memdimm == "":
objectparams.append("-object memory-backend-ram,size=%s,id=membuiltin_%s_node_%s" % (memsize, lastmem, lastnode))
currentnumaparams.append("-numa node,nodeid=%s,memdev=membuiltin_%s_node_%s" % (lastnode, lastmem, lastnode))
elif memdimm == "plugged":
objectparams.append("-object memory-backend-ram,size=%s,id=memdimm_%s_node_%s" % (memsize, lastmem, lastnode))
currentnumaparams.append("-numa node,nodeid=%s" % (lastnode,))
deviceparams.append("-device pc-dimm,node=%s,id=dimm%s,memdev=memdimm_%s_node_%s" % (lastnode, lastmem, lastmem, lastnode))
pluggedmem = siadd(pluggedmem, memsize)
memslots += 1
elif memdimm == "unplugged":
objectparams.append("-object memory-backend-ram,size=%s,id=memdimm_%s_node_%s" % (memsize, lastmem, lastnode))
currentnumaparams.append("-numa node,nodeid=%s" % (lastnode,))
unpluggedmem = siadd(unpluggedmem, memsize)
memslots += 1
else:
raise ValueError("unsupported dimm %r, expected 'plugged' or 'unplugged'" % (memdimm,))
totalmem = siadd(totalmem, memsize)
for nvmem in range(nvmemcount):
lastnvmem += 1
lastmem += 1
if lastnvmem == 0:
machineparam += ",nvdimm=on"
# Don't use file-backed nvdimms because the file would
# need to be accessible from the govm VM
# container. Everything is ram-backed on host for now.
if memdimm == "":
objectparams.append("-object memory-backend-ram,size=%s,id=memnvbuiltin_%s_node_%s" % (nvmemsize, lastmem, lastnode))
currentnumaparams.append("-numa node,nodeid=%s,memdev=memnvbuiltin_%s_node_%s" % (lastnode, lastmem, lastnode))
elif memdimm == "plugged":
objectparams.append("-object memory-backend-ram,size=%s,id=memnvdimm_%s_node_%s" % (nvmemsize, lastmem, lastnode))
currentnumaparams.append("-numa node,nodeid=%s" % (lastnode,))
deviceparams.append("-device nvdimm,node=%s,id=nvdimm%s,memdev=memnvdimm_%s_node_%s" % (lastnode, lastmem, lastmem, lastnode))
pluggedmem = siadd(pluggedmem, nvmemsize)
memslots += 1
elif memdimm == "unplugged":
objectparams.append("-object memory-backend-ram,size=%s,id=memnvdimm_%s_node_%s" % (nvmemsize, lastmem, lastnode))
currentnumaparams.append("-numa node,nodeid=%s" % (lastnode,))
unpluggedmem = siadd(unpluggedmem, nvmemsize)
memslots += 1
else:
raise ValueError("unsupported dimm %r, expected 'plugged' or 'unplugged'" % (memdimm,))
totalnvmem = siadd(totalnvmem, nvmemsize)
if cpucount > 0:
if not currentnumaparams:
currentnumaparams.append("-numa node,nodeid=%s" % (lastnode,))
currentnumaparams[-1] = currentnumaparams[-1] + (",cpus=%s-%s" % (lastcpu + 1, lastcpu + cpucount))
lastcpu += cpucount
numaparams.extend(currentnumaparams)
node_node_dist = dists(numalist)
for sourcenode in sorted(node_node_dist.keys()):
for destnode in sorted(node_node_dist[sourcenode].keys()):
if sourcenode == destnode:
continue
numaparams.append("-numa dist,src=%s,dst=%s,val=%s" % (
sourcenode, destnode, node_node_dist[sourcenode][destnode]))
if lastcpu == -1:
raise ValueError('no CPUs found, make sure at least one NUMA node has "cores" > 0')
if (lastdie + 1) // (lastsocket + 1) > 1:
diesparam = ",dies=%s" % ((lastdie + 1) // (lastsocket + 1),)
else:
# Don't give dies parameter unless it is absolutely necessary
# because it requires Qemu >= 5.0.
diesparam = ""
cpuparam = "-smp cpus=%s,threads=%s%s,sockets=%s" % (lastcpu + 1, threadcount, diesparam, lastsocket + 1)
maxmem = siadd(totalmem, totalnvmem)
startmem = sisub(sisub(maxmem, unpluggedmem), pluggedmem)
memparam = "-m size=%s,slots=%s,maxmem=%s" % (startmem, memslots, maxmem)
if startmem.startswith("0"):
if pluggedmem.startswith("0"):
raise ValueError('no memory in any NUMA node')
raise ValueError("no initial memory in any NUMA node - cannot boot with hotpluggable memory")
return (machineparam + " " +
cpuparam + " " +
memparam + " " +
" ".join(numaparams) +
" " +
" ".join(deviceparams) +
" " +
" ".join(objectparams)
)
def main(input_file):
try:
numalist = json.loads(input_file.read())
except Exception as e:
error("error reading JSON: %s" % (e,))
try:
print(qemuopts(numalist))
except Exception as e:
error("error converting JSON to Qemu opts: %s" % (e,))
if __name__ == "__main__":
if len(sys.argv) > 1:
if sys.argv[1] in ["-h", "--help"]:
print(__doc__)
sys.exit(0)
else:
input_file = open(sys.argv[1])
else:
input_file = sys.stdin
main(input_file)
================================================
FILE: demo/lib/vm.bash
================================================
# shellcheck disable=SC1091
# shellcheck source=command.bash
source "$(dirname "${BASH_SOURCE[0]}")/command.bash"
# shellcheck disable=SC1091
# shellcheck source=distro.bash
source "$(dirname "${BASH_SOURCE[0]}")/distro.bash"
VM_PROMPT=${VM_PROMPT-"\e[38;5;11
gitextract_8uskpwqi/
├── .githooks/
│ ├── pre-commit.d/
│ │ ├── 00-gofmt
│ │ ├── 10-shellcheck
│ │ └── 20-go-version
│ └── run-hooks
├── .github/
│ ├── ISSUE_TEMPLATE/
│ │ ├── bug_report.md
│ │ ├── feature_request.md
│ │ └── new-release.md
│ └── workflows/
│ ├── common-build-docs.yaml
│ ├── common-build-images.yaml
│ ├── common-codeql.yaml
│ ├── common-trivy.yaml
│ ├── common-verify-code.yaml
│ ├── publish-devel-images.yaml
│ ├── publish-docs.yml
│ ├── release.yaml
│ ├── trivy-csv.tpl
│ ├── verify-periodic.yaml
│ ├── verify-pr-code.yaml
│ └── verify-pr-docs.yaml
├── .gitignore
├── CODEOWNERS
├── Jenkinsfile
├── LICENSE
├── Makefile
├── README.md
├── SECURITY.md
├── cmd/
│ ├── cri-resmgr/
│ │ ├── cri-resource-manager.service.in
│ │ ├── cri-resource-manager.sysconf
│ │ ├── fallback.cfg.sample
│ │ └── main.go
│ ├── cri-resmgr-agent/
│ │ ├── Dockerfile
│ │ ├── agent-deployment.yaml
│ │ └── main.go
│ ├── cri-resmgr-agent-probe/
│ │ └── main.go
│ └── cri-resmgr-webhook/
│ ├── Dockerfile
│ ├── handlers.go
│ ├── main.go
│ ├── mutating-webhook-config.yaml
│ ├── webhook-deployment.yaml
│ └── webhook.go
├── demo/
│ ├── blockio/
│ │ ├── bb-scanner.yaml
│ │ ├── cri-resmgr-config.default.yaml
│ │ └── run.sh
│ └── lib/
│ ├── command.bash
│ ├── distro.bash
│ ├── host.bash
│ ├── numactlH2numajson.py
│ ├── topology.py
│ ├── topology2qemuopts.py
│ └── vm.bash
├── dockerfiles/
│ └── cross-build/
│ ├── Dockerfile.debian-11
│ ├── Dockerfile.debian-12
│ ├── Dockerfile.debian-sid
│ ├── Dockerfile.fedora
│ ├── Dockerfile.opensuse-leap-15.6
│ ├── Dockerfile.ubuntu-18.04
│ ├── Dockerfile.ubuntu-20.04
│ ├── Dockerfile.ubuntu-22.04
│ └── Dockerfile.ubuntu-24.04
├── docs/
│ ├── Dockerfile
│ ├── _templates/
│ │ └── layout.html
│ ├── conf.py
│ ├── contributing.md
│ ├── demos/
│ │ ├── blockio.md
│ │ └── index.rst
│ ├── developers-guide/
│ │ ├── architecture.md
│ │ ├── cri-test.md
│ │ ├── e2e-test.md
│ │ ├── index.rst
│ │ ├── policy-writers-guide.md
│ │ ├── testing.rst
│ │ └── unit-test.md
│ ├── index.html
│ ├── index.rst
│ ├── installation.md
│ ├── introduction.md
│ ├── migration-to-NRI.md
│ ├── node-agent.md
│ ├── policy/
│ │ ├── balloons.md
│ │ ├── blockio.md
│ │ ├── container-affinity.md
│ │ ├── cpu-allocator.md
│ │ ├── dynamic-pools.md
│ │ ├── index.rst
│ │ ├── podpools.md
│ │ ├── rdt.md
│ │ ├── static-pools.md
│ │ └── topology-aware.md
│ ├── quick-start.md
│ ├── reference/
│ │ ├── agent-command-line-reference.md
│ │ ├── configuration-reference.md
│ │ ├── index.rst
│ │ └── resmgr-command-line-reference.md
│ ├── releases/
│ │ ├── conf.py
│ │ └── index.md
│ ├── requirements.txt
│ ├── security.md
│ ├── setup.md
│ └── webhook.md
├── elf/
│ └── avx512.c
├── go.mod
├── go.sum
├── packaging/
│ ├── deb.in/
│ │ ├── changelog
│ │ ├── compat
│ │ ├── control
│ │ └── rules
│ └── rpm/
│ └── cri-resource-manager.spec.in
├── pkg/
│ ├── agent/
│ │ ├── agent.go
│ │ ├── api/
│ │ │ └── v1/
│ │ │ ├── api.go
│ │ │ ├── api.pb.go
│ │ │ ├── api.proto
│ │ │ ├── api_grpc.pb.go
│ │ │ └── constants.go
│ │ ├── config-updater.go
│ │ ├── flags.go
│ │ ├── kubernetes.go
│ │ ├── server.go
│ │ └── watcher.go
│ ├── apis/
│ │ └── resmgr/
│ │ ├── expression.go
│ │ ├── expression_test.go
│ │ ├── generated/
│ │ │ ├── clientset/
│ │ │ │ └── versioned/
│ │ │ │ ├── clientset.go
│ │ │ │ ├── doc.go
│ │ │ │ ├── fake/
│ │ │ │ │ ├── clientset_generated.go
│ │ │ │ │ ├── doc.go
│ │ │ │ │ └── register.go
│ │ │ │ ├── scheme/
│ │ │ │ │ ├── doc.go
│ │ │ │ │ └── register.go
│ │ │ │ └── typed/
│ │ │ │ └── resmgr/
│ │ │ │ └── v1alpha1/
│ │ │ │ ├── adjustment.go
│ │ │ │ ├── doc.go
│ │ │ │ ├── fake/
│ │ │ │ │ ├── doc.go
│ │ │ │ │ ├── fake_adjustment.go
│ │ │ │ │ └── fake_resmgr_client.go
│ │ │ │ ├── generated_expansion.go
│ │ │ │ └── resmgr_client.go
│ │ │ ├── informers/
│ │ │ │ └── externalversions/
│ │ │ │ ├── factory.go
│ │ │ │ ├── generic.go
│ │ │ │ ├── internalinterfaces/
│ │ │ │ │ └── factory_interfaces.go
│ │ │ │ └── resmgr/
│ │ │ │ ├── interface.go
│ │ │ │ └── v1alpha1/
│ │ │ │ ├── adjustment.go
│ │ │ │ └── interface.go
│ │ │ └── listers/
│ │ │ └── resmgr/
│ │ │ └── v1alpha1/
│ │ │ ├── adjustment.go
│ │ │ └── expansion_generated.go
│ │ └── v1alpha1/
│ │ ├── adjustment-schema.yaml
│ │ ├── adjustment.go
│ │ ├── doc.go
│ │ ├── register.go
│ │ ├── types.go
│ │ └── zz_generated.deepcopy.go
│ ├── avx/
│ │ ├── collector.go
│ │ ├── elfdump.go
│ │ └── register.go
│ ├── blockio/
│ │ ├── blockio.go
│ │ ├── blockio_test.go
│ │ └── config.go
│ ├── cgroups/
│ │ ├── cgroupblkio.go
│ │ ├── cgroupblkio_test.go
│ │ ├── cgroupcontrol.go
│ │ ├── cgroupid.go
│ │ ├── cgrouppath.go
│ │ └── cgroupstats.go
│ ├── cgroupstats/
│ │ └── collector.go
│ ├── config/
│ │ ├── config.go
│ │ ├── data.go
│ │ ├── duration.go
│ │ ├── error.go
│ │ ├── help.go
│ │ ├── log.go
│ │ └── options.go
│ ├── cpuallocator/
│ │ ├── allocator.go
│ │ └── cpuallocator_test.go
│ ├── cri/
│ │ ├── client/
│ │ │ ├── client.go
│ │ │ └── v1/
│ │ │ └── client.go
│ │ ├── relay/
│ │ │ ├── image-service.go
│ │ │ ├── relay.go
│ │ │ └── runtime-service.go
│ │ ├── resource-manager/
│ │ │ ├── agent/
│ │ │ │ └── agent.go
│ │ │ ├── builtin-policies.go
│ │ │ ├── cache/
│ │ │ │ ├── affinity.go
│ │ │ │ ├── affinity_test.go
│ │ │ │ ├── cache.go
│ │ │ │ ├── cache_test.go
│ │ │ │ ├── container.go
│ │ │ │ ├── container_test.go
│ │ │ │ ├── error.go
│ │ │ │ ├── pod.go
│ │ │ │ └── utils.go
│ │ │ ├── config/
│ │ │ │ ├── api/
│ │ │ │ │ └── v1/
│ │ │ │ │ ├── api.pb.go
│ │ │ │ │ ├── api.proto
│ │ │ │ │ └── api_grpc.pb.go
│ │ │ │ ├── config.go
│ │ │ │ └── server.go
│ │ │ ├── control/
│ │ │ │ ├── blockio/
│ │ │ │ │ └── blockio.go
│ │ │ │ ├── control.go
│ │ │ │ ├── cpu/
│ │ │ │ │ ├── api.go
│ │ │ │ │ ├── cache.go
│ │ │ │ │ └── cpu.go
│ │ │ │ ├── cri/
│ │ │ │ │ └── cri.go
│ │ │ │ ├── flags.go
│ │ │ │ ├── memory/
│ │ │ │ │ └── memory.go
│ │ │ │ ├── page-migrate/
│ │ │ │ │ ├── demoter.go
│ │ │ │ │ ├── demoter_test.go
│ │ │ │ │ ├── flags.go
│ │ │ │ │ ├── page-migrate.go
│ │ │ │ │ └── page-mover.go
│ │ │ │ └── rdt/
│ │ │ │ └── rdt.go
│ │ │ ├── controllers.go
│ │ │ ├── error.go
│ │ │ ├── events/
│ │ │ │ └── events.go
│ │ │ ├── events.go
│ │ │ ├── flags.go
│ │ │ ├── introspect/
│ │ │ │ └── introspect.go
│ │ │ ├── kubernetes/
│ │ │ │ ├── kubernetes.go
│ │ │ │ └── resources.go
│ │ │ ├── metrics/
│ │ │ │ ├── avx.go
│ │ │ │ ├── metrics.go
│ │ │ │ └── prometheus.go
│ │ │ ├── no-test-api.go
│ │ │ ├── policy/
│ │ │ │ ├── builtin/
│ │ │ │ │ ├── balloons/
│ │ │ │ │ │ ├── balloons-policy.go
│ │ │ │ │ │ ├── balloons-policy_test.go
│ │ │ │ │ │ ├── cputree.go
│ │ │ │ │ │ ├── cputree_test.go
│ │ │ │ │ │ ├── fillmethod.go
│ │ │ │ │ │ ├── flags.go
│ │ │ │ │ │ └── metrics.go
│ │ │ │ │ ├── dynamic-pools/
│ │ │ │ │ │ ├── cpu.go
│ │ │ │ │ │ ├── dyp.go
│ │ │ │ │ │ ├── dyp_test.go
│ │ │ │ │ │ ├── flags.go
│ │ │ │ │ │ └── metrics.go
│ │ │ │ │ ├── none/
│ │ │ │ │ │ └── none-policy.go
│ │ │ │ │ ├── podpools/
│ │ │ │ │ │ ├── flags.go
│ │ │ │ │ │ ├── metrics.go
│ │ │ │ │ │ ├── podpools-policy.go
│ │ │ │ │ │ └── podpools-policy_test.go
│ │ │ │ │ ├── static/
│ │ │ │ │ │ ├── flags.go
│ │ │ │ │ │ └── static-policy.go
│ │ │ │ │ ├── static-plus/
│ │ │ │ │ │ └── static-plus-policy.go
│ │ │ │ │ ├── static-pools/
│ │ │ │ │ │ ├── config.go
│ │ │ │ │ │ ├── node.go
│ │ │ │ │ │ ├── stp-policy.go
│ │ │ │ │ │ └── stp-policy_test.go
│ │ │ │ │ └── topology-aware/
│ │ │ │ │ ├── affinity.go
│ │ │ │ │ ├── cache.go
│ │ │ │ │ ├── cache_test.go
│ │ │ │ │ ├── coldstart.go
│ │ │ │ │ ├── coldstart_test.go
│ │ │ │ │ ├── error.go
│ │ │ │ │ ├── flags.go
│ │ │ │ │ ├── hint.go
│ │ │ │ │ ├── hint_test.go
│ │ │ │ │ ├── logging.go
│ │ │ │ │ ├── mocks_test.go
│ │ │ │ │ ├── node.go
│ │ │ │ │ ├── pod-preferences.go
│ │ │ │ │ ├── pod-preferences_test.go
│ │ │ │ │ ├── pools.go
│ │ │ │ │ ├── pools_test.go
│ │ │ │ │ ├── resources.go
│ │ │ │ │ └── topology-aware-policy.go
│ │ │ │ ├── error.go
│ │ │ │ ├── flags.go
│ │ │ │ └── policy.go
│ │ │ ├── requests.go
│ │ │ ├── resource-manager.go
│ │ │ ├── sockets/
│ │ │ │ └── sockets.go
│ │ │ ├── test-api.go
│ │ │ └── visualizer/
│ │ │ ├── bubbles/
│ │ │ │ ├── assets/
│ │ │ │ │ ├── css/
│ │ │ │ │ │ └── style.css
│ │ │ │ │ ├── index.html
│ │ │ │ │ └── js/
│ │ │ │ │ ├── ui-json-adapter.js
│ │ │ │ │ └── ui.js
│ │ │ │ ├── assets.go
│ │ │ │ ├── assets_generate.go
│ │ │ │ └── doc.go
│ │ │ ├── builtins.go
│ │ │ ├── flags.go
│ │ │ └── visualizer.go
│ │ └── server/
│ │ ├── server.go
│ │ └── services.go
│ ├── dump/
│ │ ├── doc.go
│ │ ├── dump.go
│ │ ├── dump_test.go
│ │ └── flags.go
│ ├── instrumentation/
│ │ ├── flags.go
│ │ ├── grpc.go
│ │ ├── http/
│ │ │ ├── http.go
│ │ │ └── http_test.go
│ │ ├── instrumentation.go
│ │ ├── instrumentation_test.go
│ │ ├── jaeger.go
│ │ ├── prometheus.go
│ │ └── service.go
│ ├── log/
│ │ ├── default.go
│ │ ├── flags.go
│ │ ├── grpc-logger.go
│ │ ├── klogcontrol/
│ │ │ └── klogcontrol.go
│ │ ├── log.go
│ │ ├── ratelimit.go
│ │ ├── ratelimit_test.go
│ │ ├── signal.go
│ │ └── stdlog-logger.go
│ ├── metrics/
│ │ ├── metrics.go
│ │ └── register/
│ │ ├── register_metrics.go
│ │ └── register_metrics_avx.go
│ ├── pidfile/
│ │ ├── pidfile.go
│ │ └── pidfile_test.go
│ ├── policycollector/
│ │ └── collector.go
│ ├── procstats/
│ │ └── procstats.go
│ ├── sysfs/
│ │ ├── error.go
│ │ ├── parsers.go
│ │ ├── system.go
│ │ └── utils.go
│ ├── testutils/
│ │ └── verify.go
│ ├── topology/
│ │ ├── go.mod
│ │ ├── test-cleanup.sh
│ │ ├── test-setup.sh
│ │ ├── topology.go
│ │ └── topology_test.go
│ ├── utils/
│ │ ├── cpuset/
│ │ │ ├── cpuset.go
│ │ │ └── cpuset_test.go
│ │ ├── json.go
│ │ ├── net.go
│ │ ├── parse.go
│ │ ├── sort.go
│ │ └── tar.go
│ └── version/
│ └── version.go
├── runtime-deps.csv
├── sample-configs/
│ ├── balloons-policy.cfg
│ ├── blockio.cfg
│ ├── cri-full-message-dump.cfg
│ ├── cri-resmgr-configmap.example.yaml
│ ├── external-adjustment.yaml
│ ├── podpools-policy.cfg
│ ├── static-policy.cfg
│ ├── static-pools-policy.conf.example
│ └── topology-aware-policy.cfg
├── scripts/
│ ├── build/
│ │ ├── docker-build-image
│ │ ├── get-buildid
│ │ └── update-gh-pages.sh
│ ├── code-generator/
│ │ ├── boilerplate.go.txt
│ │ └── generate-groups.sh
│ ├── hack/
│ │ ├── create-webhook-secrets.sh
│ │ ├── go-mod-replace-helper.sh
│ │ ├── go-mod-tree
│ │ └── install-protobuf
│ └── testing/
│ ├── crictl
│ ├── jaeger
│ ├── kube-cgroups
│ ├── pairwise
│ ├── prometheus
│ ├── prometheus.yaml
│ └── set-path
└── test/
├── critest/
│ ├── run.sh
│ ├── topology-aware-policy.cfg
│ └── tsl
├── e2e/
│ ├── benchmarks.test-suite/
│ │ └── memtier_benchmark/
│ │ ├── cri-resmgr.cfg
│ │ ├── memtier-benchmark-02.yaml.in
│ │ ├── memtier-benchmark.yaml.in
│ │ ├── n4c16/
│ │ │ ├── test01-memtier-stress-ng/
│ │ │ │ ├── code.var.sh
│ │ │ │ └── post-process.sh
│ │ │ ├── test02-multi-memtier/
│ │ │ │ └── code.var.sh
│ │ │ └── topology.var.json
│ │ ├── redis-secret.yaml.in
│ │ ├── redis-service.yaml.in
│ │ ├── redis.yaml.in
│ │ ├── stress-ng-benchmark.yaml.in
│ │ └── stress-ng.yaml.in
│ ├── besteffort.yaml.in
│ ├── blockio.test-suite/
│ │ ├── blockio/
│ │ │ └── n4c16/
│ │ │ ├── test00-slowreader/
│ │ │ │ └── code.var.sh
│ │ │ ├── topology.var.json
│ │ │ └── vm-files/
│ │ │ └── etc/
│ │ │ ├── containers/
│ │ │ │ └── blockio.yaml
│ │ │ └── crio/
│ │ │ └── crio.conf.d/
│ │ │ └── 55-blockio
│ │ ├── containerd_src.var.in.sh
│ │ ├── crio_src.var.in.sh
│ │ ├── k8scri.var.in.sh
│ │ └── omit_cri_resmgr.var.sh
│ ├── burstable.yaml.in
│ ├── cri-resmgr-topology-aware.cfg
│ ├── guaranteed.yaml.in
│ ├── packages.test-suite/
│ │ ├── debian-11/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── debian-12/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── debian-sid/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── fedora/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── opensuse-15.6/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── ubuntu-18.04/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── ubuntu-20.04/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ ├── ubuntu-22.04/
│ │ │ ├── binsrc.var
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── distro.var
│ │ │ ├── pkgtest/
│ │ │ │ ├── test01-systemd/
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ └── reinstall_cri_resmgr.var
│ │ └── ubuntu-24.04/
│ │ ├── binsrc.var
│ │ ├── cri-resmgr.cfg
│ │ ├── distro.var
│ │ ├── pkgtest/
│ │ │ ├── test01-systemd/
│ │ │ │ └── code.var.sh
│ │ │ └── topology.var.json
│ │ └── reinstall_cri_resmgr.var
│ ├── policies.test-suite/
│ │ ├── balloons/
│ │ │ ├── balloons-busybox.yaml.in
│ │ │ ├── balloons-configmap.yaml.in
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── n4c16/
│ │ │ │ ├── test01-basic-placement/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test02-prometheus-metrics/
│ │ │ │ │ ├── balloons-metrics.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test03-reserved/
│ │ │ │ │ ├── balloons-reserved.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test05-namespace/
│ │ │ │ │ ├── balloons-namespace.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test06-update-configmap/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test07-maxballoons/
│ │ │ │ │ ├── balloons-maxballoons-impossible.cfg
│ │ │ │ │ ├── balloons-maxballoons.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test08-numa/
│ │ │ │ │ ├── balloons-numa.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test09-isolated/
│ │ │ │ │ ├── balloons-isolated.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test10-allocator-opts/
│ │ │ │ │ ├── balloons-allocator-opts.cfg
│ │ │ │ │ └── code.var.sh
│ │ │ │ └── topology.var.json
│ │ │ ├── n4c32/
│ │ │ │ ├── test01-dynamic-baloons/
│ │ │ │ │ ├── balloons-dynamic.cfg
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── multicontainerpod.yaml.in
│ │ │ │ └── topology.var.json
│ │ │ └── verify.source.sh
│ │ ├── check-correct-policy.source.sh
│ │ ├── dynamic-pools/
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── dyp-busybox.yaml.in
│ │ │ ├── dyp-configmap.yaml.in
│ │ │ ├── n4c16/
│ │ │ │ ├── test01-basic-placement/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test02-prometheus-metrics/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── dyp-metrics.cfg
│ │ │ │ ├── test03-rebalancing/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test04-reserved/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── dyp-reserved.cfg
│ │ │ │ ├── test05-namespace/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── dyp-namespace.cfg
│ │ │ │ ├── test06-update-configmap/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test07-numa/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── dyp-numa.cfg
│ │ │ │ └── topology.var.json
│ │ │ └── verify.source.sh
│ │ ├── podpools/
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── n4c16/
│ │ │ │ ├── podpools-configmap.yaml.in
│ │ │ │ ├── py_consts.var.py
│ │ │ │ ├── test01-basic-placement/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test02-fill-order/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test03-qos/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test04-overbook-cpus/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test05-agent-updates-config/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test06-prometheus-metrics/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── podpools-metrics.cfg
│ │ │ │ ├── test07-custom-default-pool/
│ │ │ │ │ ├── code.var.sh
│ │ │ │ │ └── podpools-custom-default.cfg
│ │ │ │ └── topology.var.json
│ │ │ └── podpools-busybox.yaml.in
│ │ ├── static-pools/
│ │ │ ├── README.txt
│ │ │ ├── cmk-exclusive.yaml.in
│ │ │ ├── cmk-isolate.yaml.in
│ │ │ ├── cmk-tolerating-guaranteed.yaml.in
│ │ │ ├── cri-resmgr.cfg
│ │ │ ├── n4c16/
│ │ │ │ ├── cri-resmgr-static-pools.cfg
│ │ │ │ ├── py_consts.var.py
│ │ │ │ ├── test00-node-status/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test01-exclusive-pods/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test02-pods-without-cmk/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test03-cmk-isolate/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test04-cmk-isolate-noaffinity/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test05-negative-tests/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── test99-cleanup/
│ │ │ │ │ └── code.var.sh
│ │ │ │ ├── topology.var.json
│ │ │ │ └── vm-files/
│ │ │ │ └── etc/
│ │ │ │ └── cmk/
│ │ │ │ └── pools.conf
│ │ │ └── static-pools-lib.source.sh
│ │ └── topology-aware/
│ │ ├── c4pmem4/
│ │ │ ├── test01-pmem-node-assigning/
│ │ │ │ └── code.var.sh
│ │ │ ├── test02-annotation-memory-type/
│ │ │ │ ├── code.var.sh
│ │ │ │ └── memtype-guaranteed.yaml.in
│ │ │ ├── test02-annotation-memory-type-deprecated-syntax/
│ │ │ │ ├── code.var.sh
│ │ │ │ └── memtype-guaranteed.yaml.in
│ │ │ ├── test03-coldstart/
│ │ │ │ ├── bb-coldstart.yaml.in
│ │ │ │ └── code.var.sh
│ │ │ ├── test03-coldstart-deprecated-syntax/
│ │ │ │ ├── bb-coldstart.yaml.in
│ │ │ │ └── code.var.sh
│ │ │ ├── test04-dynamic-page-demotion/
│ │ │ │ ├── bb-memload.yaml.in
│ │ │ │ ├── code.var.sh
│ │ │ │ └── cri-resmgr-dynamic-page-demotion.cfg
│ │ │ ├── test04-dynamic-page-demotion-deprecated-syntax/
│ │ │ │ ├── bb-memload.yaml.in
│ │ │ │ ├── code.var.sh
│ │ │ │ └── cri-resmgr-dynamic-page-demotion.cfg
│ │ │ ├── test05-guarantee-memory/
│ │ │ │ └── code.var.sh
│ │ │ └── topology.var.json
│ │ ├── cri-resmgr.cfg
│ │ └── n4c16/
│ │ ├── test00-basic-placement/
│ │ │ ├── code.var.sh
│ │ │ └── cri-resmgr.cfg.in
│ │ ├── test01-always-fits/
│ │ │ └── code.var.sh
│ │ ├── test02-shrink-and-grow-shared/
│ │ │ └── code.var.sh
│ │ ├── test03-simple-affinity/
│ │ │ ├── code.var.sh
│ │ │ └── guaranteed+affinity.yaml.in
│ │ ├── test04-available-resources/
│ │ │ ├── code.var.sh
│ │ │ └── cri-resmgr-available-resources.cfg.in
│ │ ├── test05-reserved-resources/
│ │ │ ├── code.var.sh
│ │ │ └── cri-resmgr-reserved.cfg.in
│ │ ├── test06-fuzz/
│ │ │ ├── code.var.sh
│ │ │ ├── codelib.sh
│ │ │ ├── fuzz.aal
│ │ │ ├── fuzz.fmbt.conf
│ │ │ └── generate.sh
│ │ ├── test07-mixed-allocations/
│ │ │ ├── code.var.sh
│ │ │ └── guaranteed-annotated.yaml.in
│ │ ├── test08-isolcpus/
│ │ │ ├── code.var.sh
│ │ │ └── guaranteed-annotated.yaml.in
│ │ ├── test09-container-exit/
│ │ │ └── code.var.sh
│ │ ├── test10-additional-reserved-namespaces/
│ │ │ ├── code.var.sh
│ │ │ └── cri-resmgr-reserved-namespaces.cfg.in
│ │ ├── test11-reserved-cpu-annotations/
│ │ │ ├── code.var.sh
│ │ │ ├── cri-resmgr-reserved-annotations.cfg.in
│ │ │ └── reserved-annotated.yaml.in
│ │ └── topology.var.json
│ ├── run.sh
│ ├── run_all_configurations.sh
│ └── run_tests.sh
└── functional/
├── e2e_test.go
└── fake_cri_server_test.go
Showing preview only (284K chars total). Download the full file or copy to clipboard to get everything.
SYMBOL INDEX (3268 symbols across 212 files)
FILE: cmd/cri-resmgr-agent-probe/main.go
function main (line 34) | func main() {
FILE: cmd/cri-resmgr-agent/main.go
function main (line 27) | func main() {
FILE: cmd/cri-resmgr-webhook/handlers.go
type jsonPatch (line 36) | type jsonPatch struct
type podResourceRequirements (line 42) | type podResourceRequirements struct
function init (line 51) | func init() {
function errResponse (line 57) | func errResponse(err error) *admissionv1.AdmissionResponse {
function stringify (line 66) | func stringify(r interface{}) string {
function handle (line 75) | func handle(w http.ResponseWriter, r *http.Request) {
function mutatePodObject (line 131) | func mutatePodObject(rawObj *runtime.RawExtension) *admissionv1.Admissio...
function patchResourceAnnotation (line 166) | func patchResourceAnnotation(pod *corev1.Pod) (jsonPatch, error) {
FILE: cmd/cri-resmgr-webhook/main.go
function parseArgs (line 25) | func parseArgs() args {
function main (line 37) | func main() {
FILE: cmd/cri-resmgr-webhook/webhook.go
type args (line 26) | type args struct
function loadTLS (line 33) | func loadTLS(certFile, keyFile string) *tls.Config {
function Run (line 44) | func Run(args args) error {
FILE: cmd/cri-resmgr/main.go
function main (line 38) | func main() {
FILE: demo/lib/numactlH2numajson.py
function error (line 17) | def error(msg, exit_status=1):
function round_size (line 22) | def round_size(size, size_unit, non_zero_numbers=3):
function add_dists_to_numalist (line 42) | def add_dists_to_numalist(numalist, dists):
function numactlH2numajson (line 145) | def numactlH2numajson(input_line_iter):
function self_test (line 193) | def self_test():
FILE: demo/lib/topology.py
function error (line 59) | def error(msg, exit_status=1):
function warning (line 66) | def warning(msg):
function output_tree (line 70) | def output_tree(tree):
function add_tree (line 78) | def add_tree(root, branch, value_dict):
function _str_node (line 95) | def _str_node(root, lines, branch):
function str_tree (line 124) | def str_tree(root):
function bash_output (line 145) | def bash_output(cmd):
function get_local_topology_dump (line 151) | def get_local_topology_dump():
function get_local_res_allowed_dump (line 155) | def get_local_res_allowed_dump(processes):
function dump_to_topology (line 159) | def dump_to_topology(dump, show_mem=True):
function dump_to_res_allowed (line 262) | def dump_to_res_allowed(res_allowed_dump):
function get_topology (line 283) | def get_topology(show_mem=True):
function get_res_allowed (line 294) | def get_res_allowed(processes):
function report_res (line 305) | def report_res(show_mem=True):
function report_res_allowed (line 310) | def report_res_allowed(processes, show_mem=True):
FILE: demo/lib/topology2qemuopts.py
function error (line 88) | def error(msg, exitstatus=1):
function siadd (line 93) | def siadd(s1, s2):
function sisub (line 98) | def sisub(s1, s2):
function validate (line 103) | def validate(numalist):
function dists (line 140) | def dists(numalist):
function qemuopts (line 209) | def qemuopts(numalist):
function main (line 352) | def main(input_file):
FILE: docs/conf.py
function module_version (line 102) | def module_version(module, version):
function gomod_versions (line 108) | def gomod_versions(modules):
function setup (line 151) | def setup(app):
function isHTTPLink (line 168) | def isHTTPLink(uri):
function isMDFileLink (line 171) | def isMDFileLink(uri):
function isRSTFileLink (line 174) | def isRSTFileLink(uri):
function fixRSTLinkInMD (line 178) | def fixRSTLinkInMD(app, env, node, contnode):
function normalizePath (line 208) | def normalizePath(docPath,uriPath):
function fixLocalMDAnchors (line 224) | def fixLocalMDAnchors(app, doctree, docname):
FILE: docs/releases/conf.py
function setup (line 72) | def setup(app):
function ignoreMissingRefs (line 75) | def ignoreMissingRefs(app, env, node, contnode):
FILE: elf/avx512.c
type bpf_map_def (line 13) | typedef struct bpf_map_def {
type bpf_map_def (line 38) | struct bpf_map_def
type bpf_map_def (line 46) | struct bpf_map_def
type bpf_map_def (line 54) | struct bpf_map_def
type bpf_map_def (line 62) | struct bpf_map_def
function tracepoint__sched_switch (line 71) | int tracepoint__sched_switch(void *args)
type x86_fpu_args (line 94) | struct x86_fpu_args {
function tracepoint__x86_fpu_regs_deactivated (line 103) | int tracepoint__x86_fpu_regs_deactivated(struct x86_fpu_args *args)
FILE: pkg/agent/agent.go
type configInterface (line 30) | type configInterface interface
type resmgrConfig (line 36) | type resmgrConfig
type resmgrAdjustment (line 39) | type resmgrAdjustment
type resmgrStatus (line 42) | type resmgrStatus struct
type ResourceManagerAgent (line 48) | type ResourceManagerAgent interface
type agent (line 53) | type agent struct
method Run (line 90) | func (a *agent) Run() error {
method getConfig (line 126) | func (a *agent) getConfig() resmgrConfig {
method getError (line 133) | func (a *agent) getError() error {
function NewResourceManagerAgent (line 63) | func NewResourceManagerAgent() (ResourceManagerAgent, error) {
function agentError (line 140) | func agentError(format string, args ...interface{}) error {
FILE: pkg/agent/api/v1/api.go
method MarshalJSON (line 26) | func (j *JsonPatch) MarshalJSON() ([]byte, error) {
FILE: pkg/agent/api/v1/api.pb.go
constant _ (line 33) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 35) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type GetNodeRequest (line 38) | type GetNodeRequest struct
method Reset (line 44) | func (x *GetNodeRequest) Reset() {
method String (line 53) | func (x *GetNodeRequest) String() string {
method ProtoMessage (line 57) | func (*GetNodeRequest) ProtoMessage() {}
method ProtoReflect (line 59) | func (x *GetNodeRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 72) | func (*GetNodeRequest) Descriptor() ([]byte, []int) {
type GetNodeReply (line 76) | type GetNodeReply struct
method Reset (line 84) | func (x *GetNodeReply) Reset() {
method String (line 93) | func (x *GetNodeReply) String() string {
method ProtoMessage (line 97) | func (*GetNodeReply) ProtoMessage() {}
method ProtoReflect (line 99) | func (x *GetNodeReply) ProtoReflect() protoreflect.Message {
method Descriptor (line 112) | func (*GetNodeReply) Descriptor() ([]byte, []int) {
method GetNode (line 116) | func (x *GetNodeReply) GetNode() string {
type JsonPatch (line 124) | type JsonPatch struct
method Reset (line 134) | func (x *JsonPatch) Reset() {
method String (line 143) | func (x *JsonPatch) String() string {
method ProtoMessage (line 147) | func (*JsonPatch) ProtoMessage() {}
method ProtoReflect (line 149) | func (x *JsonPatch) ProtoReflect() protoreflect.Message {
method Descriptor (line 162) | func (*JsonPatch) Descriptor() ([]byte, []int) {
method GetOp (line 166) | func (x *JsonPatch) GetOp() string {
method GetPath (line 173) | func (x *JsonPatch) GetPath() string {
method GetValue (line 180) | func (x *JsonPatch) GetValue() string {
type PatchNodeRequest (line 187) | type PatchNodeRequest struct
method Reset (line 196) | func (x *PatchNodeRequest) Reset() {
method String (line 205) | func (x *PatchNodeRequest) String() string {
method ProtoMessage (line 209) | func (*PatchNodeRequest) ProtoMessage() {}
method ProtoReflect (line 211) | func (x *PatchNodeRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 224) | func (*PatchNodeRequest) Descriptor() ([]byte, []int) {
method GetPatches (line 228) | func (x *PatchNodeRequest) GetPatches() []*JsonPatch {
type PatchNodeReply (line 235) | type PatchNodeReply struct
method Reset (line 241) | func (x *PatchNodeReply) Reset() {
method String (line 250) | func (x *PatchNodeReply) String() string {
method ProtoMessage (line 254) | func (*PatchNodeReply) ProtoMessage() {}
method ProtoReflect (line 256) | func (x *PatchNodeReply) ProtoReflect() protoreflect.Message {
method Descriptor (line 269) | func (*PatchNodeReply) Descriptor() ([]byte, []int) {
type UpdateNodeCapacityRequest (line 273) | type UpdateNodeCapacityRequest struct
method Reset (line 282) | func (x *UpdateNodeCapacityRequest) Reset() {
method String (line 291) | func (x *UpdateNodeCapacityRequest) String() string {
method ProtoMessage (line 295) | func (*UpdateNodeCapacityRequest) ProtoMessage() {}
method ProtoReflect (line 297) | func (x *UpdateNodeCapacityRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 310) | func (*UpdateNodeCapacityRequest) Descriptor() ([]byte, []int) {
method GetCapacities (line 314) | func (x *UpdateNodeCapacityRequest) GetCapacities() map[string]string {
type UpdateNodeCapacityReply (line 321) | type UpdateNodeCapacityReply struct
method Reset (line 327) | func (x *UpdateNodeCapacityReply) Reset() {
method String (line 336) | func (x *UpdateNodeCapacityReply) String() string {
method ProtoMessage (line 340) | func (*UpdateNodeCapacityReply) ProtoMessage() {}
method ProtoReflect (line 342) | func (x *UpdateNodeCapacityReply) ProtoReflect() protoreflect.Message {
method Descriptor (line 355) | func (*UpdateNodeCapacityReply) Descriptor() ([]byte, []int) {
type HealthCheckRequest (line 359) | type HealthCheckRequest struct
method Reset (line 367) | func (x *HealthCheckRequest) Reset() {
method String (line 376) | func (x *HealthCheckRequest) String() string {
method ProtoMessage (line 380) | func (*HealthCheckRequest) ProtoMessage() {}
method ProtoReflect (line 382) | func (x *HealthCheckRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 395) | func (*HealthCheckRequest) Descriptor() ([]byte, []int) {
method GetQuery (line 399) | func (x *HealthCheckRequest) GetQuery() string {
type HealthCheckReply (line 406) | type HealthCheckReply struct
method Reset (line 414) | func (x *HealthCheckReply) Reset() {
method String (line 423) | func (x *HealthCheckReply) String() string {
method ProtoMessage (line 427) | func (*HealthCheckReply) ProtoMessage() {}
method ProtoReflect (line 429) | func (x *HealthCheckReply) ProtoReflect() protoreflect.Message {
method Descriptor (line 442) | func (*HealthCheckReply) Descriptor() ([]byte, []int) {
method GetError (line 446) | func (x *HealthCheckReply) GetError() string {
function file_pkg_agent_api_v1_api_proto_rawDescGZIP (line 514) | func file_pkg_agent_api_v1_api_proto_rawDescGZIP() []byte {
function init (line 552) | func init() { file_pkg_agent_api_v1_api_proto_init() }
function file_pkg_agent_api_v1_api_proto_init (line 553) | func file_pkg_agent_api_v1_api_proto_init() {
FILE: pkg/agent/api/v1/api_grpc.pb.go
constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
type AgentClient (line 24) | type AgentClient interface
type agentClient (line 31) | type agentClient struct
method GetNode (line 39) | func (c *agentClient) GetNode(ctx context.Context, in *GetNodeRequest,...
method PatchNode (line 48) | func (c *agentClient) PatchNode(ctx context.Context, in *PatchNodeRequ...
method UpdateNodeCapacity (line 57) | func (c *agentClient) UpdateNodeCapacity(ctx context.Context, in *Upda...
method HealthCheck (line 66) | func (c *agentClient) HealthCheck(ctx context.Context, in *HealthCheck...
function NewAgentClient (line 35) | func NewAgentClient(cc grpc.ClientConnInterface) AgentClient {
type AgentServer (line 78) | type AgentServer interface
type UnimplementedAgentServer (line 87) | type UnimplementedAgentServer struct
method GetNode (line 90) | func (UnimplementedAgentServer) GetNode(context.Context, *GetNodeReque...
method PatchNode (line 93) | func (UnimplementedAgentServer) PatchNode(context.Context, *PatchNodeR...
method UpdateNodeCapacity (line 96) | func (UnimplementedAgentServer) UpdateNodeCapacity(context.Context, *U...
method HealthCheck (line 99) | func (UnimplementedAgentServer) HealthCheck(context.Context, *HealthCh...
method mustEmbedUnimplementedAgentServer (line 102) | func (UnimplementedAgentServer) mustEmbedUnimplementedAgentServer() {}
type UnsafeAgentServer (line 107) | type UnsafeAgentServer interface
function RegisterAgentServer (line 111) | func RegisterAgentServer(s grpc.ServiceRegistrar, srv AgentServer) {
function _Agent_GetNode_Handler (line 115) | func _Agent_GetNode_Handler(srv interface{}, ctx context.Context, dec fu...
function _Agent_PatchNode_Handler (line 133) | func _Agent_PatchNode_Handler(srv interface{}, ctx context.Context, dec ...
function _Agent_UpdateNodeCapacity_Handler (line 151) | func _Agent_UpdateNodeCapacity_Handler(srv interface{}, ctx context.Cont...
function _Agent_HealthCheck_Handler (line 169) | func _Agent_HealthCheck_Handler(srv interface{}, ctx context.Context, de...
FILE: pkg/agent/api/v1/constants.go
constant ConfigStatus (line 21) | ConfigStatus = "config-status"
FILE: pkg/agent/config-updater.go
constant rateLimitTimeout (line 37) | rateLimitTimeout = 2 * time.Second
constant setConfigTimeout (line 39) | setConfigTimeout = 5 * time.Second
constant retryTimeout (line 41) | retryTimeout = 5 * time.Second
type configUpdater (line 45) | type configUpdater interface
type updater (line 55) | type updater struct
method Start (line 81) | func (u *updater) Start() error {
method Stop (line 140) | func (u *updater) Stop() {
method UpdateConfig (line 143) | func (u *updater) UpdateConfig(c *resmgrConfig) {
method UpdateAdjustment (line 147) | func (u *updater) UpdateAdjustment(c *resmgrAdjustment) {
method StatusChan (line 151) | func (u *updater) StatusChan() chan *resmgrStatus {
method setError (line 155) | func (u *updater) setError(err error) error {
method GetError (line 162) | func (u *updater) GetError() error {
method setConfig (line 168) | func (u *updater) setConfig(cfg *resmgrConfig) (error, error) {
method setAdjustment (line 187) | func (u *updater) setAdjustment(adjust *resmgrAdjustment) (map[string]...
function newConfigUpdater (line 65) | func newConfigUpdater() (configUpdater, error) {
function newResmgrCli (line 216) | func newResmgrCli(socket string) (resmgr_v1.ConfigClient, error) {
FILE: pkg/agent/flags.go
type options (line 25) | type options struct
function init (line 36) | func init() {
FILE: pkg/agent/kubernetes.go
type namespace (line 40) | type namespace
method getK8sClient (line 46) | func (a *agent) getK8sClient(kubeconfig string) (*k8sclient.Clientset, *...
function getNodeObject (line 74) | func getNodeObject(cli *k8sclient.Clientset) (*core_v1.Node, error) {
function patchNode (line 83) | func patchNode(cli *k8sclient.Clientset, patchList []*agent_v1.JsonPatch...
function patchNodeStatus (line 100) | func patchNodeStatus(cli *k8sclient.Clientset, fields map[string]string)...
function patchAdjustmentStatus (line 114) | func patchAdjustmentStatus(_ *resmgr.CriresmgrV1alpha1Client, _ *resmgrS...
type watch (line 119) | type watch struct
method Name (line 223) | func (w *watch) Name() string {
method Query (line 235) | func (w *watch) Query() (interface{}, error) {
method Start (line 243) | func (w *watch) Start(name string) {
method Stop (line 296) | func (w *watch) Stop() {
method ResultChan (line 304) | func (w *watch) ResultChan() <-chan k8swatch.Event {
type openFn (line 131) | type openFn
type queryFn (line 134) | type queryFn
constant SyntheticMissing (line 138) | SyntheticMissing = k8swatch.EventType("SyntheticMissing")
function newWatch (line 141) | func newWatch(parent *watcher, kind string, ns namespace, open openFn, q...
function newNodeWatch (line 154) | func newNodeWatch(parent *watcher) *watch {
function newConfigMapWatch (line 177) | func newConfigMapWatch(parent *watcher, name string, ns namespace) *watch {
function newAdjustmentCRDWatch (line 200) | func newAdjustmentCRDWatch(parent *watcher, ns namespace) *watch {
function init (line 308) | func init() {
FILE: pkg/agent/server.go
type agentServer (line 38) | type agentServer interface
type server (line 44) | type server struct
method Start (line 63) | func (s *server) Start(socket string) error {
method Stop (line 101) | func (s *server) Stop() {
function newAgentServer (line 52) | func newAgentServer(cli *k8sclient.Clientset, cfg configInterface) (agen...
type grpcServer (line 106) | type grpcServer struct
method GetNode (line 114) | func (g *grpcServer) GetNode(_ context.Context, req *v1.GetNodeRequest...
method PatchNode (line 132) | func (g *grpcServer) PatchNode(_ context.Context, req *v1.PatchNodeReq...
method UpdateNodeCapacity (line 148) | func (g *grpcServer) UpdateNodeCapacity(_ context.Context, req *v1.Upd...
method HealthCheck (line 175) | func (g *grpcServer) HealthCheck(_ context.Context, req *v1.HealthChec...
function isNativeResource (line 189) | func isNativeResource(name string) bool {
FILE: pkg/agent/watcher.go
type cachedConfig (line 36) | type cachedConfig struct
method getConfig (line 383) | func (c *cachedConfig) getConfig() (resmgrConfig, string) {
method getAdjustment (line 413) | func (c *cachedConfig) getAdjustment() (resmgrAdjustment, resmgrAdjust...
method setNode (line 430) | func (c *cachedConfig) setNode(data *map[string]string) bool {
method setGroup (line 439) | func (c *cachedConfig) setGroup(group string, data *map[string]string)...
method setAdjustment (line 449) | func (c *cachedConfig) setAdjustment(adjust *resmgr.Adjustment) bool {
method deleteAdjustment (line 499) | func (c *cachedConfig) deleteAdjustment(o *resmgr.Adjustment) bool {
method getAdjustmentNames (line 514) | func (c *cachedConfig) getAdjustmentNames() ([]string, []string) {
method setStatus (line 530) | func (c *cachedConfig) setStatus(status *resmgrStatus) {
method getStatus (line 537) | func (c *cachedConfig) getStatus() *resmgrStatus {
type k8sWatcher (line 47) | type k8sWatcher interface
type watcher (line 63) | type watcher struct
method Start (line 89) | func (w *watcher) Start() error {
method Stop (line 102) | func (w *watcher) Stop() {
method ConfigChan (line 111) | func (w *watcher) ConfigChan() <-chan resmgrConfig {
method AdjustmentChan (line 116) | func (w *watcher) AdjustmentChan() <-chan resmgrAdjustment {
method GetConfig (line 121) | func (w *watcher) GetConfig() resmgrConfig {
method UpdateStatus (line 128) | func (w *watcher) UpdateStatus(status *resmgrStatus) error {
method PatchAdjustmentStatus (line 134) | func (w *watcher) PatchAdjustmentStatus(status *resmgrStatus) error {
method patchAdjustment (line 169) | func (w *watcher) patchAdjustment(adjust *resmgr.Adjustment, inscope b...
method sendConfig (line 243) | func (w *watcher) sendConfig() {
method sendAdjustment (line 250) | func (w *watcher) sendAdjustment() {
method watch (line 255) | func (w *watcher) watch() error {
function newK8sWatcher (line 74) | func newK8sWatcher(k8sCli *k8sclient.Clientset, resmgrCli *resmgrcli.Cri...
function groupMapName (line 367) | func groupMapName(group string) string {
function newCachedConfig (line 375) | func newCachedConfig() cachedConfig {
FILE: pkg/apis/resmgr/expression.go
type Evaluable (line 27) | type Evaluable interface
type Expression (line 32) | type Expression struct
method Validate (line 81) | func (e *Expression) Validate() error {
method Evaluate (line 111) | func (e *Expression) Evaluate(subject Evaluable) bool {
method KeyValue (line 170) | func (e *Expression) KeyValue(subject Evaluable) (string, bool) {
method String (line 285) | func (e *Expression) String() string {
method DeepCopy (line 290) | func (e *Expression) DeepCopy() *Expression {
method DeepCopyInto (line 297) | func (e *Expression) DeepCopyInto(out *Expression) {
constant KeyPod (line 39) | KeyPod = "pod"
constant KeyID (line 40) | KeyID = "id"
constant KeyUID (line 41) | KeyUID = "uid"
constant KeyName (line 42) | KeyName = "name"
constant KeyNamespace (line 43) | KeyNamespace = "namespace"
constant KeyQOSClass (line 44) | KeyQOSClass = "qosclass"
constant KeyLabels (line 45) | KeyLabels = "labels"
constant KeyTags (line 46) | KeyTags = "tags"
type Operator (line 50) | type Operator
constant Equals (line 54) | Equals Operator = "Equals"
constant NotEqual (line 56) | NotEqual Operator = "NotEqual"
constant In (line 58) | In Operator = "In"
constant NotIn (line 60) | NotIn Operator = "NotIn"
constant Exists (line 62) | Exists Operator = "Exists"
constant NotExist (line 64) | NotExist Operator = "NotExist"
constant AlwaysTrue (line 66) | AlwaysTrue Operator = "AlwaysTrue"
constant Matches (line 68) | Matches Operator = "Matches"
constant MatchesNot (line 70) | MatchesNot Operator = "MatchesNot"
constant MatchesAny (line 72) | MatchesAny Operator = "MatchesAny"
constant MatchesNone (line 74) | MatchesNone Operator = "MatchesNone"
function splitKeys (line 194) | func splitKeys(keys string) ([]string, string) {
function validSeparator (line 217) | func validSeparator(b byte) bool {
function ResolveRef (line 232) | func ResolveRef(subject Evaluable, spec string) (string, bool, error) {
function exprError (line 305) | func exprError(format string, args ...interface{}) error {
FILE: pkg/apis/resmgr/expression_test.go
type evaluable (line 25) | type evaluable struct
method Eval (line 45) | func (e *evaluable) Eval(key string) interface{} {
method String (line 67) | func (e *evaluable) String() string {
function newEvaluable (line 34) | func newEvaluable(name, ns, qos string, labels, tags map[string]string, ...
function TestResolveRefAndKeyValue (line 85) | func TestResolveRefAndKeyValue(t *testing.T) {
function TestSimpleOperators (line 176) | func TestSimpleOperators(t *testing.T) {
function TestMatching (line 286) | func TestMatching(t *testing.T) {
FILE: pkg/apis/resmgr/generated/clientset/versioned/clientset.go
type Interface (line 28) | type Interface interface
type Clientset (line 35) | type Clientset struct
method CriresmgrV1alpha1 (line 41) | func (c *Clientset) CriresmgrV1alpha1() criresmgrv1alpha1.CriresmgrV1a...
method Discovery (line 46) | func (c *Clientset) Discovery() discovery.DiscoveryInterface {
function NewForConfig (line 56) | func NewForConfig(c *rest.Config) (*Clientset, error) {
function NewForConfigOrDie (line 80) | func NewForConfigOrDie(c *rest.Config) *Clientset {
function New (line 89) | func New(c rest.Interface) *Clientset {
FILE: pkg/apis/resmgr/generated/clientset/versioned/fake/clientset_generated.go
function NewSimpleClientset (line 34) | func NewSimpleClientset(objects ...runtime.Object) *Clientset {
type Clientset (line 61) | type Clientset struct
method Discovery (line 67) | func (c *Clientset) Discovery() discovery.DiscoveryInterface {
method Tracker (line 71) | func (c *Clientset) Tracker() testing.ObjectTracker {
method CriresmgrV1alpha1 (line 78) | func (c *Clientset) CriresmgrV1alpha1() criresmgrv1alpha1.CriresmgrV1a...
FILE: pkg/apis/resmgr/generated/clientset/versioned/fake/register.go
function init (line 51) | func init() {
FILE: pkg/apis/resmgr/generated/clientset/versioned/scheme/register.go
function init (line 51) | func init() {
FILE: pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/adjustment.go
type AdjustmentsGetter (line 33) | type AdjustmentsGetter interface
type AdjustmentInterface (line 38) | type AdjustmentInterface interface
type adjustments (line 52) | type adjustments struct
method Get (line 66) | func (c *adjustments) Get(name string, options v1.GetOptions) (result ...
method List (line 79) | func (c *adjustments) List(opts v1.ListOptions) (result *v1alpha1.Adju...
method Watch (line 96) | func (c *adjustments) Watch(opts v1.ListOptions) (watch.Interface, err...
method Create (line 111) | func (c *adjustments) Create(adjustment *v1alpha1.Adjustment) (result ...
method Update (line 123) | func (c *adjustments) Update(adjustment *v1alpha1.Adjustment) (result ...
method UpdateStatus (line 138) | func (c *adjustments) UpdateStatus(adjustment *v1alpha1.Adjustment) (r...
method Delete (line 152) | func (c *adjustments) Delete(name string, options *v1.DeleteOptions) e...
method DeleteCollection (line 163) | func (c *adjustments) DeleteCollection(options *v1.DeleteOptions, list...
method Patch (line 179) | func (c *adjustments) Patch(name string, pt types.PatchType, data []by...
function newAdjustments (line 58) | func newAdjustments(c *CriresmgrV1alpha1Client, namespace string) *adjus...
FILE: pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/fake/fake_adjustment.go
type FakeAdjustments (line 30) | type FakeAdjustments struct
method Get (line 40) | func (c *FakeAdjustments) Get(name string, options v1.GetOptions) (res...
method List (line 51) | func (c *FakeAdjustments) List(opts v1.ListOptions) (result *v1alpha1....
method Watch (line 73) | func (c *FakeAdjustments) Watch(opts v1.ListOptions) (watch.Interface,...
method Create (line 80) | func (c *FakeAdjustments) Create(adjustment *v1alpha1.Adjustment) (res...
method Update (line 91) | func (c *FakeAdjustments) Update(adjustment *v1alpha1.Adjustment) (res...
method UpdateStatus (line 103) | func (c *FakeAdjustments) UpdateStatus(adjustment *v1alpha1.Adjustment...
method Delete (line 114) | func (c *FakeAdjustments) Delete(name string, options *v1.DeleteOption...
method DeleteCollection (line 122) | func (c *FakeAdjustments) DeleteCollection(options *v1.DeleteOptions, ...
method Patch (line 130) | func (c *FakeAdjustments) Patch(name string, pt types.PatchType, data ...
FILE: pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/fake/fake_resmgr_client.go
type FakeCriresmgrV1alpha1 (line 25) | type FakeCriresmgrV1alpha1 struct
method Adjustments (line 29) | func (c *FakeCriresmgrV1alpha1) Adjustments(namespace string) v1alpha1...
method RESTClient (line 35) | func (c *FakeCriresmgrV1alpha1) RESTClient() rest.Interface {
FILE: pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/generated_expansion.go
type AdjustmentExpansion (line 19) | type AdjustmentExpansion interface
FILE: pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/resmgr_client.go
type CriresmgrV1alpha1Interface (line 25) | type CriresmgrV1alpha1Interface interface
type CriresmgrV1alpha1Client (line 31) | type CriresmgrV1alpha1Client struct
method Adjustments (line 35) | func (c *CriresmgrV1alpha1Client) Adjustments(namespace string) Adjust...
method RESTClient (line 82) | func (c *CriresmgrV1alpha1Client) RESTClient() rest.Interface {
function NewForConfig (line 40) | func NewForConfig(c *rest.Config) (*CriresmgrV1alpha1Client, error) {
function NewForConfigOrDie (line 54) | func NewForConfigOrDie(c *rest.Config) *CriresmgrV1alpha1Client {
function New (line 63) | func New(c rest.Interface) *CriresmgrV1alpha1Client {
function setConfigDefaults (line 67) | func setConfigDefaults(config *rest.Config) error {
FILE: pkg/apis/resmgr/generated/informers/externalversions/factory.go
type SharedInformerOption (line 34) | type SharedInformerOption
type sharedInformerFactory (line 36) | type sharedInformerFactory struct
method Start (line 109) | func (f *sharedInformerFactory) Start(stopCh <-chan struct{}) {
method WaitForCacheSync (line 122) | func (f *sharedInformerFactory) WaitForCacheSync(stopCh <-chan struct{...
method InformerFor (line 145) | func (f *sharedInformerFactory) InformerFor(obj runtime.Object, newFun...
method Criresmgr (line 176) | func (f *sharedInformerFactory) Criresmgr() resmgr.Interface {
function WithCustomResyncConfig (line 51) | func WithCustomResyncConfig(resyncConfig map[v1.Object]time.Duration) Sh...
function WithTweakListOptions (line 61) | func WithTweakListOptions(tweakListOptions internalinterfaces.TweakListO...
function WithNamespace (line 69) | func WithNamespace(namespace string) SharedInformerOption {
function NewSharedInformerFactory (line 77) | func NewSharedInformerFactory(client versioned.Interface, defaultResync ...
function NewFilteredSharedInformerFactory (line 85) | func NewFilteredSharedInformerFactory(client versioned.Interface, defaul...
function NewSharedInformerFactoryWithOptions (line 90) | func NewSharedInformerFactoryWithOptions(client versioned.Interface, def...
type SharedInformerFactory (line 168) | type SharedInformerFactory interface
FILE: pkg/apis/resmgr/generated/informers/externalversions/generic.go
type GenericInformer (line 29) | type GenericInformer interface
type genericInformer (line 34) | type genericInformer struct
method Informer (line 40) | func (f *genericInformer) Informer() cache.SharedIndexInformer {
method Lister (line 45) | func (f *genericInformer) Lister() cache.GenericLister {
method ForResource (line 51) | func (f *sharedInformerFactory) ForResource(resource schema.GroupVersion...
FILE: pkg/apis/resmgr/generated/informers/externalversions/internalinterfaces/factory_interfaces.go
type NewInformerFunc (line 29) | type NewInformerFunc
type SharedInformerFactory (line 32) | type SharedInformerFactory interface
type TweakListOptionsFunc (line 38) | type TweakListOptionsFunc
FILE: pkg/apis/resmgr/generated/informers/externalversions/resmgr/interface.go
type Interface (line 25) | type Interface interface
type group (line 30) | type group struct
method V1alpha1 (line 42) | func (g *group) V1alpha1() v1alpha1.Interface {
function New (line 37) | func New(f internalinterfaces.SharedInformerFactory, namespace string, t...
FILE: pkg/apis/resmgr/generated/informers/externalversions/resmgr/v1alpha1/adjustment.go
type AdjustmentInformer (line 34) | type AdjustmentInformer interface
type adjustmentInformer (line 39) | type adjustmentInformer struct
method defaultInformer (line 77) | func (f *adjustmentInformer) defaultInformer(client versioned.Interfac...
method Informer (line 81) | func (f *adjustmentInformer) Informer() cache.SharedIndexInformer {
method Lister (line 85) | func (f *adjustmentInformer) Lister() v1alpha1.AdjustmentLister {
function NewAdjustmentInformer (line 48) | func NewAdjustmentInformer(client versioned.Interface, namespace string,...
function NewFilteredAdjustmentInformer (line 55) | func NewFilteredAdjustmentInformer(client versioned.Interface, namespace...
FILE: pkg/apis/resmgr/generated/informers/externalversions/resmgr/v1alpha1/interface.go
type Interface (line 24) | type Interface interface
type version (line 29) | type version struct
method Adjustments (line 41) | func (v *version) Adjustments() AdjustmentInformer {
function New (line 36) | func New(f internalinterfaces.SharedInformerFactory, namespace string, t...
FILE: pkg/apis/resmgr/generated/listers/resmgr/v1alpha1/adjustment.go
type AdjustmentLister (line 27) | type AdjustmentLister interface
type adjustmentLister (line 36) | type adjustmentLister struct
method List (line 46) | func (s *adjustmentLister) List(selector labels.Selector) (ret []*v1al...
method Adjustments (line 54) | func (s *adjustmentLister) Adjustments(namespace string) AdjustmentNam...
function NewAdjustmentLister (line 41) | func NewAdjustmentLister(indexer cache.Indexer) AdjustmentLister {
type AdjustmentNamespaceLister (line 59) | type AdjustmentNamespaceLister interface
type adjustmentNamespaceLister (line 69) | type adjustmentNamespaceLister struct
method List (line 75) | func (s adjustmentNamespaceLister) List(selector labels.Selector) (ret...
method Get (line 83) | func (s adjustmentNamespaceLister) Get(name string) (*v1alpha1.Adjustm...
FILE: pkg/apis/resmgr/generated/listers/resmgr/v1alpha1/expansion_generated.go
type AdjustmentListerExpansion (line 21) | type AdjustmentListerExpansion interface
type AdjustmentNamespaceListerExpansion (line 25) | type AdjustmentNamespaceListerExpansion interface
FILE: pkg/apis/resmgr/v1alpha1/adjustment.go
method HasSameVersion (line 26) | func (a *Adjustment) HasSameVersion(o *Adjustment) bool {
method NodeScope (line 37) | func (spec *AdjustmentSpec) NodeScope(node string) []AdjustmentScope {
method GetResourceRequirements (line 48) | func (spec *AdjustmentSpec) GetResourceRequirements() (corev1.ResourceRe...
method GetRDTClass (line 56) | func (spec *AdjustmentSpec) GetRDTClass() (string, bool) {
method GetBlockIOClass (line 64) | func (spec *AdjustmentSpec) GetBlockIOClass() (string, bool) {
method IsNodeInScope (line 72) | func (spec *AdjustmentSpec) IsNodeInScope(node string) bool {
method IsContainerInScope (line 85) | func (spec *AdjustmentSpec) IsContainerInScope(container resmgr.Evaluabl...
method Compare (line 98) | func (spec *AdjustmentSpec) Compare(other *AdjustmentSpec) bool {
method Verify (line 117) | func (spec *AdjustmentSpec) Verify() error {
method compareResources (line 129) | func (spec *AdjustmentSpec) compareResources(other *AdjustmentSpec) bool {
method verifyResources (line 171) | func (spec *AdjustmentSpec) verifyResources() error {
method verifyToptierLimit (line 226) | func (spec *AdjustmentSpec) verifyToptierLimit() error {
method IsNodeInScope (line 240) | func (scope *AdjustmentScope) IsNodeInScope(node string) bool {
method IsContainerInScope (line 253) | func (scope *AdjustmentScope) IsContainerInScope(container resmgr.Evalua...
function matches (line 266) | func matches(pattern, name string) bool {
function CompareScopes (line 277) | func CompareScopes(scopes []AdjustmentScope, others []AdjustmentScope) b...
method Compare (line 291) | func (scope *AdjustmentScope) Compare(other *AdjustmentScope) bool {
method Compare (line 309) | func (c *Classes) Compare(o *Classes) bool {
function apiError (line 326) | func apiError(format string, args ...interface{}) error {
FILE: pkg/apis/resmgr/v1alpha1/register.go
function Resource (line 36) | func Resource(resource string) schema.GroupResource {
function addKnownTypes (line 41) | func addKnownTypes(scheme *runtime.Scheme) error {
FILE: pkg/apis/resmgr/v1alpha1/types.go
constant GroupName (line 26) | GroupName string = "criresmgr.intel.com"
constant Version (line 27) | Version string = "v1alpha1"
constant Kind (line 28) | Kind string = "Adjustment"
constant Plural (line 29) | Plural string = "adjustments"
constant Singular (line 30) | Singular string = "adjustment"
constant Name (line 31) | Name string = Plural + "." + GroupName
type Adjustment (line 38) | type Adjustment struct
type AdjustmentSpec (line 47) | type AdjustmentSpec struct
type AdjustmentStatus (line 55) | type AdjustmentStatus struct
type AdjustmentNodeStatus (line 60) | type AdjustmentNodeStatus struct
type AdjustmentScope (line 65) | type AdjustmentScope struct
type Classes (line 71) | type Classes struct
type AdjustmentList (line 79) | type AdjustmentList struct
FILE: pkg/apis/resmgr/v1alpha1/zz_generated.deepcopy.go
method DeepCopyInto (line 29) | func (in *Adjustment) DeepCopyInto(out *Adjustment) {
method DeepCopy (line 39) | func (in *Adjustment) DeepCopy() *Adjustment {
method DeepCopyObject (line 49) | func (in *Adjustment) DeepCopyObject() runtime.Object {
method DeepCopyInto (line 57) | func (in *AdjustmentList) DeepCopyInto(out *AdjustmentList) {
method DeepCopy (line 72) | func (in *AdjustmentList) DeepCopy() *AdjustmentList {
method DeepCopyObject (line 82) | func (in *AdjustmentList) DeepCopyObject() runtime.Object {
method DeepCopyInto (line 90) | func (in *AdjustmentNodeStatus) DeepCopyInto(out *AdjustmentNodeStatus) {
method DeepCopy (line 103) | func (in *AdjustmentNodeStatus) DeepCopy() *AdjustmentNodeStatus {
method DeepCopyInto (line 113) | func (in *AdjustmentScope) DeepCopyInto(out *AdjustmentScope) {
method DeepCopy (line 134) | func (in *AdjustmentScope) DeepCopy() *AdjustmentScope {
method DeepCopyInto (line 144) | func (in *AdjustmentSpec) DeepCopyInto(out *AdjustmentSpec) {
method DeepCopy (line 172) | func (in *AdjustmentSpec) DeepCopy() *AdjustmentSpec {
method DeepCopyInto (line 182) | func (in *AdjustmentStatus) DeepCopyInto(out *AdjustmentStatus) {
method DeepCopy (line 195) | func (in *AdjustmentStatus) DeepCopy() *AdjustmentStatus {
method DeepCopyInto (line 205) | func (in *Classes) DeepCopyInto(out *Classes) {
method DeepCopy (line 221) | func (in *Classes) DeepCopy() *Classes {
FILE: pkg/avx/collector.go
constant LastCPUName (line 44) | LastCPUName = "last_cpu_avx_task_switches"
constant AVXSwitchCountName (line 46) | AVXSwitchCountName = "avx_switch_count_per_cgroup"
constant AllSwitchCountName (line 48) | AllSwitchCountName = "all_switch_count_per_cgroup"
constant LastUpdateNs (line 50) | LastUpdateNs = "last_update_ns"
constant kernelTracepointPath (line 52) | kernelTracepointPath = "/sys/kernel/debug/tracing/events"
constant mapMemLockLimit (line 54) | mapMemLockLimit = 524288
constant lastCPUDesc (line 59) | lastCPUDesc = iota
constant avxSwitchCountDesc (line 60) | avxSwitchCountDesc
constant allSwitchCountDesc (line 61) | allSwitchCountDesc
constant lastUpdateNsDesc (line 62) | lastUpdateNsDesc
constant numDescriptors (line 63) | numDescriptors
type collector (line 105) | type collector struct
method Describe (line 229) | func (c *collector) Describe(ch chan<- *prometheus.Desc) {
method Collect (line 245) | func (c collector) Collect(ch chan<- prometheus.Metric) {
function enablePerfTracepoint (line 111) | func enablePerfTracepoint(prog *bpf.Program, tracepoint string) (int, er...
function getKernelVersion (line 147) | func getKernelVersion() uint32 {
function kernelVersionStr (line 173) | func kernelVersionStr(v uint32) string {
function NewCollector (line 178) | func NewCollector() (prometheus.Collector, error) {
function nowNanoseconds (line 237) | func nowNanoseconds() uint64 {
function init (line 367) | func init() {
FILE: pkg/avx/elfdump.go
constant blocksPerRow (line 31) | blocksPerRow = 12
type Program (line 34) | type Program struct
function main (line 38) | func main() {
FILE: pkg/avx/register.go
function init (line 24) | func init() {
FILE: pkg/blockio/blockio.go
constant ConfigModuleName (line 39) | ConfigModuleName = "blockio"
constant sysfsBlockDeviceIOSchedulerPaths (line 43) | sysfsBlockDeviceIOSchedulerPaths = "/sys/block/*/queue/scheduler"
type Class (line 50) | type Class struct
type BlockDeviceInfo (line 60) | type BlockDeviceInfo struct
function GetClasses (line 84) | func GetClasses() []*Class {
function UpdateOciConfig (line 96) | func UpdateOciConfig(ignoreErrors bool) error {
function SetContainerClass (line 124) | func SetContainerClass(c cache.Container, class string) error {
function getCurrentIOSchedulers (line 146) | func getCurrentIOSchedulers() (map[string]string, error) {
function devicesParametersToOci (line 181) | func devicesParametersToOci(dps []DevicesParameters, currentIOSchedulers...
function parseAndValidateInt64 (line 244) | func parseAndValidateInt64(fieldName string, fieldContent string,
type platformInterface (line 265) | type platformInterface interface
type defaultPlatform (line 270) | type defaultPlatform struct
method configurableBlockDevices (line 276) | func (dpm defaultPlatform) configurableBlockDevices(devWildcards []str...
function blockioError (line 366) | func blockioError(format string, args ...interface{}) error {
FILE: pkg/blockio/blockio_test.go
function TestGetCurrentIOSchedulers (line 38) | func TestGetCurrentIOSchedulers(t *testing.T) {
function TestConfigurableBlockDevices (line 50) | func TestConfigurableBlockDevices(t *testing.T) {
function TestDevicesParametersToOci (line 138) | func TestDevicesParametersToOci(t *testing.T) {
type mockPlatform (line 268) | type mockPlatform struct
method configurableBlockDevices (line 271) | func (mpf mockPlatform) configurableBlockDevices(devWildcards []string...
FILE: pkg/blockio/config.go
type options (line 24) | type options struct
type DevicesParameters (line 30) | type DevicesParameters struct
function defaultOptions (line 43) | func defaultOptions() interface{} {
function init (line 47) | func init() {
FILE: pkg/cgroups/cgroupblkio.go
constant blkioCgroupDir (line 29) | blkioCgroupDir = "/sys/fs/cgroup/blkio/"
type OciBlockIOParameters (line 52) | type OciBlockIOParameters struct
type OciDeviceWeight (line 63) | type OciDeviceWeight struct
type OciDeviceRate (line 74) | type OciDeviceRate struct
type OciDeviceWeights (line 81) | type OciDeviceWeights
method Append (line 93) | func (w *OciDeviceWeights) Append(maj, min, val int64) {
method Update (line 103) | func (w *OciDeviceWeights) Update(maj, min, val int64) {
type OciDeviceRates (line 84) | type OciDeviceRates
method Append (line 98) | func (r *OciDeviceRates) Append(maj, min, val int64) {
method Update (line 114) | func (r *OciDeviceRates) Update(maj, min, val int64) {
type OciDeviceParameters (line 87) | type OciDeviceParameters interface
function NewOciBlockIOParameters (line 125) | func NewOciBlockIOParameters() OciBlockIOParameters {
function NewOciDeviceWeight (line 132) | func NewOciDeviceWeight() OciDeviceWeight {
function NewOciDeviceRate (line 141) | func NewOciDeviceRate() OciDeviceRate {
function GetBlkioDir (line 150) | func GetBlkioDir() string {
type devMajMin (line 154) | type devMajMin struct
function ResetBlkioParameters (line 160) | func ResetBlkioParameters(cgroupsDir string, blockIO OciBlockIOParameter...
function resetDevRates (line 187) | func resetDevRates(old, wanted []OciDeviceRate) []OciDeviceRate {
function GetBlkioParameters (line 203) | func GetBlkioParameters(cgroupsDir string) (OciBlockIOParameters, error) {
function readOciDeviceParameters (line 226) | func readOciDeviceParameters(baseDir string, filenames []string, params ...
function readFromFileInDir (line 261) | func readFromFileInDir(baseDir string, filenames []string) (string, erro...
function SetBlkioParameters (line 280) | func SetBlkioParameters(cgroupsDir string, blockIO OciBlockIOParameters)...
function writeDevValueToFileInDir (line 305) | func writeDevValueToFileInDir(baseDir string, filenames []string, major,...
function writeToFileInDir (line 311) | func writeToFileInDir(baseDir string, filenames []string, content string...
type platformInterface (line 330) | type platformInterface interface
type defaultPlatform (line 336) | type defaultPlatform struct
method readFromFile (line 342) | func (dpm defaultPlatform) readFromFile(filename string) (string, erro...
method writeToFile (line 348) | func (dpm defaultPlatform) writeToFile(filename string, content string...
FILE: pkg/cgroups/cgroupblkio_test.go
function TestUpdateAppend (line 24) | func TestUpdateAppend(t *testing.T) {
function TestResetBlkioParameters (line 74) | func TestResetBlkioParameters(t *testing.T) {
function TestGetBlkioParameters (line 179) | func TestGetBlkioParameters(t *testing.T) {
function TestSetBlkioParameters (line 287) | func TestSetBlkioParameters(t *testing.T) {
type mockPlatform (line 385) | type mockPlatform struct
method readFromFile (line 392) | func (mpf *mockPlatform) readFromFile(filename string) (string, error) {
method writeToFile (line 403) | func (mpf *mockPlatform) writeToFile(filename string, content string) ...
FILE: pkg/cgroups/cgroupcontrol.go
type Controller (line 28) | type Controller
method String (line 98) | func (c Controller) String() string {
method Path (line 106) | func (c Controller) Path() string {
method RelPath (line 115) | func (c Controller) RelPath() string {
method Group (line 124) | func (c Controller) Group(group string) Group {
type Group (line 31) | type Group
method Controller (line 134) | func (g Group) Controller() Controller {
method GetTasks (line 148) | func (g Group) GetTasks() ([]string, error) {
method GetProcesses (line 153) | func (g Group) GetProcesses() ([]string, error) {
method AddTasks (line 158) | func (g Group) AddTasks(pids ...string) error {
method AddProcesses (line 163) | func (g Group) AddProcesses(pids ...string) error {
method Write (line 168) | func (g Group) Write(entry, format string, args ...interface{}) error {
method readPids (line 185) | func (g Group) readPids(entry string) ([]string, error) {
method writePids (line 208) | func (g Group) writePids(entry string, pids ...string) error {
method errorf (line 230) | func (g Group) errorf(format string, args ...interface{}) error {
constant UnknownController (line 36) | UnknownController Controller = iota
constant Blkio (line 38) | Blkio
constant Cpu (line 40) | Cpu
constant Cpuacct (line 42) | Cpuacct
constant Cpuset (line 44) | Cpuset
constant Devices (line 46) | Devices
constant Freezer (line 48) | Freezer
constant Hugetlb (line 50) | Hugetlb
constant Memory (line 52) | Memory
constant NetCls (line 54) | NetCls
constant NetPrio (line 56) | NetPrio
constant PerfEvent (line 58) | PerfEvent
constant Pids (line 60) | Pids
function AsGroup (line 129) | func AsGroup(absDir string) Group {
FILE: pkg/cgroups/cgroupid.go
type CgroupID (line 14) | type CgroupID struct
method Find (line 38) | func (cgid *CgroupID) Find(id uint64) (string, error) {
function NewCgroupID (line 21) | func NewCgroupID(root string) *CgroupID {
function getID (line 28) | func getID(path string) uint64 {
FILE: pkg/cgroups/cgrouppath.go
constant Tasks (line 27) | Tasks = "tasks"
constant Procs (line 29) | Procs = "cgroup.procs"
constant CpuShares (line 31) | CpuShares = "cpu.shares"
constant CpuPeriod (line 33) | CpuPeriod = "cpu.cfs_period_us"
constant CpuQuota (line 35) | CpuQuota = "cpu.cfs_quota_us"
constant CpusetCpus (line 37) | CpusetCpus = "cpuset.cpus"
constant CpusetMems (line 39) | CpusetMems = "cpuset.mems"
constant Controllers (line 41) | Controllers = "cgroup.controllers"
function GetMountDir (line 56) | func GetMountDir() string {
function SetMountDir (line 61) | func SetMountDir(dir string) {
function GetV2Dir (line 70) | func GetV2Dir() string {
function SetV2Dir (line 75) | func SetV2Dir(dir string) {
function init (line 83) | func init() {
function DetectSystemCgroupVersion (line 92) | func DetectSystemCgroupVersion() int {
FILE: pkg/cgroups/cgroupstats.go
type BlkioDeviceBytes (line 29) | type BlkioDeviceBytes struct
type BlkioThrottleBytes (line 36) | type BlkioThrottleBytes struct
type CPUAcctUsage (line 42) | type CPUAcctUsage struct
type HugetlbUsage (line 49) | type HugetlbUsage struct
type MemoryUsage (line 56) | type MemoryUsage struct
type NumaLine (line 62) | type NumaLine struct
type NumaStat (line 68) | type NumaStat struct
type GlobalNumaStats (line 81) | type GlobalNumaStats struct
function readCgroupFileLines (line 90) | func readCgroupFileLines(filePath string) ([]string, error) {
function readCgroupSingleNumber (line 114) | func readCgroupSingleNumber(filePath string) (int64, error) {
function GetBlkioThrottleBytes (line 139) | func GetBlkioThrottleBytes(cgroupPath string) (BlkioThrottleBytes, error) {
function GetCPUAcctStats (line 230) | func GetCPUAcctStats(cgroupPath string) ([]CPUAcctUsage, error) {
function GetCPUSetMemoryMigrate (line 269) | func GetCPUSetMemoryMigrate(cgroupPath string) (bool, error) {
function GetHugetlbUsage (line 291) | func GetHugetlbUsage(cgroupPath string) ([]HugetlbUsage, error) {
function GetMemoryUsage (line 334) | func GetMemoryUsage(cgroupPath string) (MemoryUsage, error) {
function GetNumaStats (line 359) | func GetNumaStats(cgroupPath string) (NumaStat, error) {
function GetGlobalNumaStats (line 447) | func GetGlobalNumaStats() (map[int]GlobalNumaStats, error) {
FILE: pkg/cgroupstats/collector.go
constant numaStatsDesc (line 34) | numaStatsDesc = iota
constant memoryUsageDesc (line 35) | memoryUsageDesc
constant memoryMigrateDesc (line 36) | memoryMigrateDesc
constant cpuAcctUsageDesc (line 37) | cpuAcctUsageDesc
constant hugeTlbUsageDesc (line 38) | hugeTlbUsageDesc
constant blkioDeviceUsageDesc (line 39) | blkioDeviceUsageDesc
constant numDescriptors (line 40) | numDescriptors
constant kubepodsDir (line 110) | kubepodsDir = "kubepods.slice"
type collector (line 113) | type collector struct
method Describe (line 122) | func (c *collector) Describe(ch chan<- *prometheus.Desc) {
method Collect (line 328) | func (c collector) Collect(ch chan<- prometheus.Metric) {
function NewCollector (line 117) | func NewCollector() (prometheus.Collector, error) {
function updateCPUAcctUsageMetric (line 128) | func updateCPUAcctUsageMetric(ch chan<- prometheus.Metric, path string, ...
function updateMemoryMigrateMetric (line 151) | func updateMemoryMigrateMetric(ch chan<- prometheus.Metric, path string,...
function updateMemoryUsageMetric (line 164) | func updateMemoryUsageMetric(ch chan<- prometheus.Metric, path string, m...
function updateNumaStatMetric (line 179) | func updateNumaStatMetric(ch chan<- prometheus.Metric, path string, metr...
function updateHugeTlbUsageMetric (line 248) | func updateHugeTlbUsageMetric(ch chan<- prometheus.Metric, path string, ...
function updateBlkioDeviceUsageMetric (line 266) | func updateBlkioDeviceUsageMetric(ch chan<- prometheus.Metric, path stri...
function walkCgroups (line 280) | func walkCgroups() []string {
function cgroupPath (line 323) | func cgroupPath(controller, path string) string {
function init (line 405) | func init() {
FILE: pkg/config/config.go
constant MainModule (line 25) | MainModule = "main"
type GetConfigFn (line 29) | type GetConfigFn
type NotifyFn (line 32) | type NotifyFn
type Event (line 35) | type Event
constant UpdateEvent (line 39) | UpdateEvent = "update"
constant RevertEvent (line 41) | RevertEvent = "rollback"
type Source (line 45) | type Source
constant ConfigFile (line 49) | ConfigFile Source = "configuration file"
constant ConfigExternal (line 51) | ConfigExternal Source = "external configuration"
constant ConfigBackup (line 53) | ConfigBackup Source = "backed up configuration"
type Module (line 57) | type Module struct
method AddNotify (line 106) | func (m *Module) AddNotify(fn NotifyFn) error {
method getconfig (line 184) | func (m *Module) getconfig() (Data, error) {
method isImplicit (line 211) | func (m *Module) isImplicit() bool {
method hasChild (line 216) | func (m *Module) hasChild(name string) bool {
method configure (line 222) | func (m *Module) configure(data Data, force bool) error {
method apply (line 255) | func (m *Module) apply(cfg Data) error {
method notify (line 289) | func (m *Module) notify(event Event, source Source) error {
method check (line 306) | func (m *Module) check() {
method validate (line 351) | func (m *Module) validate(data Data) error {
function GetConfig (line 78) | func GetConfig() (Data, error) {
function SetConfig (line 83) | func SetConfig(cfg map[string]string) error {
function SetConfigFromFile (line 92) | func SetConfigFromFile(path string) error {
function GetModule (line 101) | func GetModule(path string) *Module {
function Register (line 111) | func Register(path, description string, ptr interface{}, getfn GetConfig...
function setconfig (line 136) | func setconfig(data Data, source Source) error {
function revertconfig (line 167) | func revertconfig(snapshot Data, notify bool) {
function getFields (line 329) | func getFields(typ reflect.Type) map[string]struct{} {
function fieldName (line 409) | func fieldName(f reflect.StructField) string {
function lookup (line 426) | func lookup(path string) *Module {
function Print (line 452) | func Print(printfn func(string, ...interface{})) {
FILE: pkg/config/data.go
type Data (line 25) | type Data
method copy (line 67) | func (d Data) copy() Data {
method split (line 76) | func (d Data) split(hasChild func(string) bool) (Data, Data) {
method pick (line 89) | func (d Data) pick(key string, removePicked bool) (Data, error) {
method String (line 125) | func (d Data) String() string {
method Print (line 134) | func (d Data) Print(fn func(string, ...interface{})) {
function DataFromObject (line 28) | func DataFromObject(obj interface{}) (Data, error) {
function DataFromStringMap (line 41) | func DataFromStringMap(smap map[string]string) (Data, error) {
function DataFromFile (line 54) | func DataFromFile(path string) (Data, error) {
FILE: pkg/config/duration.go
type Duration (line 23) | type Duration
method MarshalJSON (line 26) | func (d Duration) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 31) | func (d *Duration) UnmarshalJSON(data []byte) error {
method String (line 44) | func (d *Duration) String() string {
FILE: pkg/config/error.go
function configError (line 22) | func configError(format string, args ...interface{}) error {
FILE: pkg/config/help.go
function Describe (line 25) | func Describe(names ...string) {
method setDescription (line 39) | func (m *Module) setDescription(description string) {
method showHelp (line 56) | func (m *Module) showHelp() {
method describeData (line 82) | func (m *Module) describeData() {
function findModules (line 93) | func findModules(names []string, m *Module) []*Module {
FILE: pkg/config/log.go
type Logger (line 31) | type Logger struct
function SetLogger (line 45) | func SetLogger(logger Logger) {
function defaultLogger (line 69) | func defaultLogger() Logger {
function debugEnabled (line 81) | func debugEnabled() bool {
function debugmsg (line 85) | func debugmsg(format string, args ...interface{}) {
function infomsg (line 89) | func infomsg(format string, args ...interface{}) {
function warningmsg (line 93) | func warningmsg(format string, args ...interface{}) {
function errormsg (line 97) | func errormsg(format string, args ...interface{}) {
function fatalmsg (line 101) | func fatalmsg(format string, args ...interface{}) {
function panicmsg (line 106) | func panicmsg(format string, args ...interface{}) {
FILE: pkg/config/options.go
function WithNotify (line 18) | func WithNotify(fn NotifyFn) Option {
function WithoutDataValidation (line 32) | func WithoutDataValidation() Option {
type Option (line 46) | type Option interface
type funcOption (line 51) | type funcOption struct
method apply (line 56) | func (fo *funcOption) apply(o interface{}) error {
function newFuncOption (line 61) | func newFuncOption(f func(interface{}) error) *funcOption {
FILE: pkg/cpuallocator/allocator.go
type AllocFlag (line 30) | type AllocFlag
constant AllocIdlePackages (line 34) | AllocIdlePackages AllocFlag = 1 << iota
constant AllocIdleNodes (line 36) | AllocIdleNodes
constant AllocIdleCores (line 38) | AllocIdleCores
constant AllocDefault (line 40) | AllocDefault = AllocIdlePackages | AllocIdleCores
constant logSource (line 42) | logSource = "cpuallocator"
type allocatorHelper (line 46) | type allocatorHelper struct
method takeIdlePackages (line 141) | func (a *allocatorHelper) takeIdlePackages() {
method takeIdleCores (line 182) | func (a *allocatorHelper) takeIdleCores() {
method takeIdleThreads (line 226) | func (a *allocatorHelper) takeIdleThreads() {
method takeAny (line 312) | func (a *allocatorHelper) takeAny() {
method allocate (line 326) | func (a *allocatorHelper) allocate() cpuset.CPUSet {
type CPUAllocator (line 61) | type CPUAllocator interface
type CPUPriority (line 66) | type CPUPriority
method String (line 622) | func (p CPUPriority) String() string {
constant PriorityHigh (line 69) | PriorityHigh CPUPriority = iota
constant PriorityNormal (line 70) | PriorityNormal
constant PriorityLow (line 71) | PriorityLow
constant NumCPUPriorities (line 72) | NumCPUPriorities
constant PriorityNone (line 73) | PriorityNone = NumCPUPriorities
type cpuAllocator (line 76) | type cpuAllocator struct
method allocateCpus (line 347) | func (ca *cpuAllocator) allocateCpus(from *cpuset.CPUSet, cnt int, pre...
method AllocateCpus (line 371) | func (ca *cpuAllocator) AllocateCpus(from *cpuset.CPUSet, cnt int, pre...
method ReleaseCpus (line 377) | func (ca *cpuAllocator) ReleaseCpus(from *cpuset.CPUSet, cnt int, pref...
type topologyCache (line 83) | type topologyCache struct
method discoverCPUPriorities (line 409) | func (c *topologyCache) discoverCPUPriorities(sys sysfs.System) {
method discoverSstCPUPriority (line 433) | func (c *topologyCache) discoverSstCPUPriority(sys sysfs.System, pkgID...
method sstClosPriority (line 500) | func (c *topologyCache) sstClosPriority(sys sysfs.System, pkgID idset....
method discoverCpufreqPriority (line 554) | func (c *topologyCache) discoverCpufreqPriority(sys sysfs.System, pkgI...
type cpuPriorities (line 91) | type cpuPriorities
method cmpCPUSet (line 639) | func (c *cpuPriorities) cmpCPUSet(csetA, csetB cpuset.CPUSet, prefer C...
type IDFilter (line 94) | type IDFilter
type IDSorter (line 97) | type IDSorter
function NewCPUAllocator (line 103) | func NewCPUAllocator(sys sysfs.System) CPUAllocator {
function pickIds (line 114) | func pickIds(idSlice []idset.ID, f IDFilter) []idset.ID {
function newAllocatorHelper (line 129) | func newAllocatorHelper(sys sysfs.System, topo topologyCache) *allocator...
function newTopologyCache (line 387) | func newTopologyCache(sys sysfs.System) topologyCache {
FILE: pkg/cpuallocator/cpuallocator_test.go
function TestAllocatorHelper (line 27) | func TestAllocatorHelper(t *testing.T) {
FILE: pkg/cri/client/client.go
type DialNotifyFn (line 38) | type DialNotifyFn
type Options (line 41) | type Options struct
type ConnectOptions (line 51) | type ConnectOptions struct
type Client (line 59) | type Client interface
type criClient (line 74) | type criClient interface
type client (line 80) | type client struct
method Connect (line 111) | func (c *client) Connect(options ConnectOptions) error {
method Close (line 139) | func (c *client) Close() {
method CheckConnection (line 157) | func (c *client) CheckConnection(options ConnectOptions) error {
method HasRuntimeService (line 176) | func (c *client) HasRuntimeService() bool {
method checkRuntimeService (line 180) | func (c *client) checkRuntimeService() error {
method checkImageService (line 187) | func (c *client) checkImageService() error {
method connect (line 195) | func (c *client) connect(kind, socket string, options ConnectOptions) ...
method dialNotify (line 230) | func (c *client) dialNotify(socket string) {
method Version (line 253) | func (c *client) Version(ctx context.Context, in *criv1.VersionRequest...
method RunPodSandbox (line 261) | func (c *client) RunPodSandbox(ctx context.Context, in *criv1.RunPodSa...
method StopPodSandbox (line 269) | func (c *client) StopPodSandbox(ctx context.Context, in *criv1.StopPod...
method RemovePodSandbox (line 277) | func (c *client) RemovePodSandbox(ctx context.Context, in *criv1.Remov...
method PodSandboxStatus (line 285) | func (c *client) PodSandboxStatus(ctx context.Context, in *criv1.PodSa...
method ListPodSandbox (line 293) | func (c *client) ListPodSandbox(ctx context.Context, in *criv1.ListPod...
method CreateContainer (line 301) | func (c *client) CreateContainer(ctx context.Context, in *criv1.Create...
method StartContainer (line 309) | func (c *client) StartContainer(ctx context.Context, in *criv1.StartCo...
method StopContainer (line 317) | func (c *client) StopContainer(ctx context.Context, in *criv1.StopCont...
method RemoveContainer (line 325) | func (c *client) RemoveContainer(ctx context.Context, in *criv1.Remove...
method ListContainers (line 333) | func (c *client) ListContainers(ctx context.Context, in *criv1.ListCon...
method ContainerStatus (line 341) | func (c *client) ContainerStatus(ctx context.Context, in *criv1.Contai...
method UpdateContainerResources (line 349) | func (c *client) UpdateContainerResources(ctx context.Context, in *cri...
method ReopenContainerLog (line 357) | func (c *client) ReopenContainerLog(ctx context.Context, in *criv1.Reo...
method ExecSync (line 365) | func (c *client) ExecSync(ctx context.Context, in *criv1.ExecSyncReque...
method Exec (line 373) | func (c *client) Exec(ctx context.Context, in *criv1.ExecRequest, _ .....
method Attach (line 381) | func (c *client) Attach(ctx context.Context, in *criv1.AttachRequest, ...
method PortForward (line 389) | func (c *client) PortForward(ctx context.Context, in *criv1.PortForwar...
method ContainerStats (line 397) | func (c *client) ContainerStats(ctx context.Context, in *criv1.Contain...
method ListContainerStats (line 405) | func (c *client) ListContainerStats(ctx context.Context, in *criv1.Lis...
method PodSandboxStats (line 413) | func (c *client) PodSandboxStats(ctx context.Context, in *criv1.PodSan...
method ListPodSandboxStats (line 421) | func (c *client) ListPodSandboxStats(ctx context.Context, in *criv1.Li...
method UpdateRuntimeConfig (line 429) | func (c *client) UpdateRuntimeConfig(ctx context.Context, in *criv1.Up...
method Status (line 437) | func (c *client) Status(ctx context.Context, in *criv1.StatusRequest, ...
method CheckpointContainer (line 445) | func (c *client) CheckpointContainer(ctx context.Context, in *criv1.Ch...
method GetContainerEvents (line 449) | func (c *client) GetContainerEvents(ctx context.Context, in *criv1.Get...
method ListMetricDescriptors (line 453) | func (c *client) ListMetricDescriptors(ctx context.Context, in *criv1....
method ListPodSandboxMetrics (line 457) | func (c *client) ListPodSandboxMetrics(ctx context.Context, in *criv1....
method RuntimeConfig (line 461) | func (c *client) RuntimeConfig(ctx context.Context, in *criv1.RuntimeC...
method ListImages (line 465) | func (c *client) ListImages(ctx context.Context, in *criv1.ListImagesR...
method ImageStatus (line 473) | func (c *client) ImageStatus(ctx context.Context, in *criv1.ImageStatu...
method PullImage (line 481) | func (c *client) PullImage(ctx context.Context, in *criv1.PullImageReq...
method RemoveImage (line 489) | func (c *client) RemoveImage(ctx context.Context, in *criv1.RemoveImag...
method ImageFsInfo (line 497) | func (c *client) ImageFsInfo(ctx context.Context, in *criv1.ImageFsInf...
constant DontConnect (line 93) | DontConnect = "-"
function NewClient (line 97) | func NewClient(options Options) (Client, error) {
function clientError (line 506) | func clientError(format string, args ...interface{}) error {
FILE: pkg/cri/client/v1/client.go
type Client (line 28) | type Client interface
type client (line 33) | type client struct
method checkRuntimeService (line 70) | func (c *client) checkRuntimeService() error {
method checkImageService (line 77) | func (c *client) checkImageService() error {
method Version (line 84) | func (c *client) Version(ctx context.Context, in *criv1.VersionRequest...
method RunPodSandbox (line 92) | func (c *client) RunPodSandbox(ctx context.Context, in *criv1.RunPodSa...
method StopPodSandbox (line 100) | func (c *client) StopPodSandbox(ctx context.Context, in *criv1.StopPod...
method RemovePodSandbox (line 108) | func (c *client) RemovePodSandbox(ctx context.Context, in *criv1.Remov...
method PodSandboxStatus (line 116) | func (c *client) PodSandboxStatus(ctx context.Context, in *criv1.PodSa...
method ListPodSandbox (line 124) | func (c *client) ListPodSandbox(ctx context.Context, in *criv1.ListPod...
method CreateContainer (line 132) | func (c *client) CreateContainer(ctx context.Context, in *criv1.Create...
method StartContainer (line 140) | func (c *client) StartContainer(ctx context.Context, in *criv1.StartCo...
method StopContainer (line 148) | func (c *client) StopContainer(ctx context.Context, in *criv1.StopCont...
method RemoveContainer (line 156) | func (c *client) RemoveContainer(ctx context.Context, in *criv1.Remove...
method ListContainers (line 164) | func (c *client) ListContainers(ctx context.Context, in *criv1.ListCon...
method ContainerStatus (line 172) | func (c *client) ContainerStatus(ctx context.Context, in *criv1.Contai...
method UpdateContainerResources (line 180) | func (c *client) UpdateContainerResources(ctx context.Context, in *cri...
method ReopenContainerLog (line 188) | func (c *client) ReopenContainerLog(ctx context.Context, in *criv1.Reo...
method ExecSync (line 196) | func (c *client) ExecSync(ctx context.Context, in *criv1.ExecSyncReque...
method Exec (line 204) | func (c *client) Exec(ctx context.Context, in *criv1.ExecRequest, _ .....
method Attach (line 212) | func (c *client) Attach(ctx context.Context, in *criv1.AttachRequest, ...
method PortForward (line 220) | func (c *client) PortForward(ctx context.Context, in *criv1.PortForwar...
method ContainerStats (line 228) | func (c *client) ContainerStats(ctx context.Context, in *criv1.Contain...
method ListContainerStats (line 236) | func (c *client) ListContainerStats(ctx context.Context, in *criv1.Lis...
method PodSandboxStats (line 244) | func (c *client) PodSandboxStats(ctx context.Context, in *criv1.PodSan...
method ListPodSandboxStats (line 252) | func (c *client) ListPodSandboxStats(ctx context.Context, in *criv1.Li...
method UpdateRuntimeConfig (line 260) | func (c *client) UpdateRuntimeConfig(ctx context.Context, in *criv1.Up...
method Status (line 268) | func (c *client) Status(ctx context.Context, in *criv1.StatusRequest, ...
method CheckpointContainer (line 276) | func (c *client) CheckpointContainer(ctx context.Context, in *criv1.Ch...
method GetContainerEvents (line 284) | func (c *client) GetContainerEvents(ctx context.Context, in *criv1.Get...
method ListMetricDescriptors (line 297) | func (c *client) ListMetricDescriptors(ctx context.Context, in *criv1....
method ListPodSandboxMetrics (line 305) | func (c *client) ListPodSandboxMetrics(ctx context.Context, in *criv1....
method RuntimeConfig (line 313) | func (c *client) RuntimeConfig(ctx context.Context, in *criv1.RuntimeC...
method ListImages (line 321) | func (c *client) ListImages(ctx context.Context, in *criv1.ListImagesR...
method ImageStatus (line 329) | func (c *client) ImageStatus(ctx context.Context, in *criv1.ImageStatu...
method PullImage (line 337) | func (c *client) PullImage(ctx context.Context, in *criv1.PullImageReq...
method RemoveImage (line 345) | func (c *client) RemoveImage(ctx context.Context, in *criv1.RemoveImag...
method ImageFsInfo (line 353) | func (c *client) ImageFsInfo(ctx context.Context, in *criv1.ImageFsInf...
function Connect (line 42) | func Connect(runtime, image *grpc.ClientConn) (Client, error) {
function clientError (line 362) | func clientError(format string, args ...interface{}) error {
FILE: pkg/cri/relay/image-service.go
method ListImages (line 23) | func (r *relay) ListImages(ctx context.Context,
method ImageStatus (line 28) | func (r *relay) ImageStatus(ctx context.Context,
method PullImage (line 33) | func (r *relay) PullImage(ctx context.Context,
method RemoveImage (line 38) | func (r *relay) RemoveImage(ctx context.Context,
method ImageFsInfo (line 43) | func (r *relay) ImageFsInfo(ctx context.Context,
FILE: pkg/cri/relay/relay.go
constant DisableService (line 31) | DisableService = client.DontConnect
constant DefaultImageSocket (line 33) | DefaultImageSocket = "default"
type Options (line 37) | type Options struct
type Relay (line 49) | type Relay interface
type relay (line 63) | type relay struct
method Setup (line 113) | func (r *relay) Setup() error {
method Start (line 134) | func (r *relay) Start() error {
method Stop (line 143) | func (r *relay) Stop() {
method Client (line 149) | func (r *relay) Client() client.Client {
method Server (line 154) | func (r *relay) Server() server.Server {
method dialNotify (line 158) | func (r *relay) dialNotify(socket string, uid int, gid int, mode os.Fi...
function NewRelay (line 75) | func NewRelay(options Options) (Relay, error) {
function relayError (line 189) | func relayError(format string, args ...interface{}) error {
FILE: pkg/cri/relay/runtime-service.go
method dump (line 27) | func (r *relay) dump(method string, req interface{}) {
method qualifier (line 35) | func (r *relay) qualifier(msg interface{}) string {
method Version (line 42) | func (r *relay) Version(ctx context.Context,
method RunPodSandbox (line 48) | func (r *relay) RunPodSandbox(ctx context.Context,
method StopPodSandbox (line 54) | func (r *relay) StopPodSandbox(ctx context.Context,
method RemovePodSandbox (line 60) | func (r *relay) RemovePodSandbox(ctx context.Context,
method PodSandboxStatus (line 66) | func (r *relay) PodSandboxStatus(ctx context.Context,
method ListPodSandbox (line 72) | func (r *relay) ListPodSandbox(ctx context.Context,
method CreateContainer (line 78) | func (r *relay) CreateContainer(ctx context.Context,
method StartContainer (line 84) | func (r *relay) StartContainer(ctx context.Context,
method StopContainer (line 90) | func (r *relay) StopContainer(ctx context.Context,
method RemoveContainer (line 96) | func (r *relay) RemoveContainer(ctx context.Context,
method ListContainers (line 102) | func (r *relay) ListContainers(ctx context.Context,
method ContainerStatus (line 108) | func (r *relay) ContainerStatus(ctx context.Context,
method UpdateContainerResources (line 114) | func (r *relay) UpdateContainerResources(ctx context.Context,
method ReopenContainerLog (line 120) | func (r *relay) ReopenContainerLog(ctx context.Context,
method ExecSync (line 126) | func (r *relay) ExecSync(ctx context.Context,
method Exec (line 132) | func (r *relay) Exec(ctx context.Context,
method Attach (line 138) | func (r *relay) Attach(ctx context.Context,
method PortForward (line 144) | func (r *relay) PortForward(ctx context.Context,
method ContainerStats (line 150) | func (r *relay) ContainerStats(ctx context.Context,
method ListContainerStats (line 156) | func (r *relay) ListContainerStats(ctx context.Context,
method PodSandboxStats (line 162) | func (r *relay) PodSandboxStats(ctx context.Context,
method ListPodSandboxStats (line 168) | func (r *relay) ListPodSandboxStats(ctx context.Context,
method UpdateRuntimeConfig (line 174) | func (r *relay) UpdateRuntimeConfig(ctx context.Context,
method Status (line 180) | func (r *relay) Status(ctx context.Context,
method CheckpointContainer (line 186) | func (r *relay) CheckpointContainer(ctx context.Context, req *criv1.Chec...
method GetContainerEvents (line 191) | func (r *relay) GetContainerEvents(req *criv1.GetEventsRequest, srv criv...
method ListMetricDescriptors (line 210) | func (r *relay) ListMetricDescriptors(ctx context.Context, req *criv1.Li...
method ListPodSandboxMetrics (line 215) | func (r *relay) ListPodSandboxMetrics(ctx context.Context, req *criv1.Li...
method RuntimeConfig (line 220) | func (r *relay) RuntimeConfig(ctx context.Context, req *criv1.RuntimeCon...
constant eventRelayTimeout (line 226) | eventRelayTimeout = 1 * time.Second
method addEventServer (line 229) | func (r *relay) addEventServer(req *criv1.GetEventsRequest) chan *criv1....
method delEventServer (line 239) | func (r *relay) delEventServer(req *criv1.GetEventsRequest) chan *criv1....
method startEventRelay (line 249) | func (r *relay) startEventRelay(req *criv1.GetEventsRequest) error {
method relayEvents (line 268) | func (r *relay) relayEvents() {
FILE: pkg/cri/resource-manager/agent/agent.go
constant SocketDisabled (line 34) | SocketDisabled = "disabled"
type Interface (line 38) | type Interface interface
type agentInterface (line 61) | type agentInterface struct
method IsDisabled (line 96) | func (a *agentInterface) IsDisabled() bool {
method GetNode (line 100) | func (a *agentInterface) GetNode(timeout time.Duration) (core_v1.Node,...
method PatchNode (line 123) | func (a *agentInterface) PatchNode(patches []*agent_v1.JsonPatch, time...
method UpdateNodeCapacity (line 142) | func (a *agentInterface) UpdateNodeCapacity(caps map[string]string, ti...
method GetLabels (line 185) | func (a *agentInterface) GetLabels(timeout time.Duration) (map[string]...
method SetLabels (line 198) | func (a *agentInterface) SetLabels(labels map[string]string, timeout t...
method RemoveLabels (line 231) | func (a *agentInterface) RemoveLabels(keys []string, timeout time.Dura...
method GetAnnotations (line 263) | func (a *agentInterface) GetAnnotations(timeout time.Duration) (map[st...
method SetAnnotations (line 275) | func (a *agentInterface) SetAnnotations(annotations map[string]string,...
method RemoveAnnotations (line 306) | func (a *agentInterface) RemoveAnnotations(keys []string, timeout time...
method GetTaints (line 339) | func (a *agentInterface) GetTaints(timeout time.Duration) ([]core_v1.T...
method SetTaints (line 351) | func (a *agentInterface) SetTaints(taints []core_v1.Taint, timeout tim...
method RemoveTaints (line 393) | func (a *agentInterface) RemoveTaints(taints []core_v1.Taint, timeout ...
method FindTaintIndex (line 437) | func (a *agentInterface) FindTaintIndex(taints []core_v1.Taint, taint ...
function NewAgentInterface (line 68) | func NewAgentInterface(socket string) (Interface, error) {
constant PatchAdd (line 162) | PatchAdd string = "add"
constant PatchRemove (line 164) | PatchRemove string = "remove"
constant PatchReplace (line 166) | PatchReplace string = "replace"
function patchPath (line 169) | func patchPath(class, key string) string {
function labelPatchPath (line 173) | func labelPatchPath(key string) string {
function annotationPatchPath (line 177) | func annotationPatchPath(key string) string {
function taintPatchPath (line 181) | func taintPatchPath(idx int) string {
function findTaintIndex (line 428) | func findTaintIndex(taints []core_v1.Taint, taint *core_v1.Taint) (int, ...
function agentError (line 441) | func agentError(format string, args ...interface{}) error {
function prepareCall (line 445) | func prepareCall(timeout time.Duration) (context.Context, context.Cancel...
FILE: pkg/cri/resource-manager/cache/affinity.go
constant keyAffinity (line 28) | keyAffinity = "affinity"
constant keyAntiAffinity (line 30) | keyAntiAffinity = "anti-affinity"
type Expression (line 34) | type Expression struct
type simpleAffinity (line 39) | type simpleAffinity
type podContainerAffinity (line 42) | type podContainerAffinity
method parseSimple (line 119) | func (pca *podContainerAffinity) parseSimple(pod *pod, value string, w...
method parseFull (line 184) | func (pca *podContainerAffinity) parseFull(pod *pod, value string, wei...
type Affinity (line 45) | type Affinity struct
method Validate (line 62) | func (a *Affinity) Validate() error {
method String (line 109) | func (a *Affinity) String() string {
constant UserWeightCutoff (line 53) | UserWeightCutoff = 1000
constant DefaultWeight (line 55) | DefaultWeight int32 = 1
type ImplicitAffinity (line 59) | type ImplicitAffinity
method EvaluateAffinity (line 82) | func (cch *cache) EvaluateAffinity(a *Affinity) map[string]int32 {
method FilterScope (line 94) | func (cch *cache) FilterScope(scope *resmgr.Expression) []Container {
function GlobalAffinity (line 222) | func GlobalAffinity(key string, weight int32) *Affinity {
function GlobalAntiAffinity (line 236) | func GlobalAntiAffinity(key string, weight int32) *Affinity {
method AddImplicitAffinities (line 241) | func (cch *cache) AddImplicitAffinities(implicit map[string]ImplicitAffi...
method DeleteImplicitAffinities (line 254) | func (cch *cache) DeleteImplicitAffinities(names []string) {
FILE: pkg/cri/resource-manager/cache/affinity_test.go
function TestSimpleParsingSymmetry (line 21) | func TestSimpleParsingSymmetry(t *testing.T) {
function TestStrictParsing (line 119) | func TestStrictParsing(t *testing.T) {
FILE: pkg/cri/resource-manager/cache/cache.go
constant CPU (line 41) | CPU = "cpu"
constant CRI (line 43) | CRI = "cri"
constant RDT (line 45) | RDT = "rdt"
constant BlockIO (line 47) | BlockIO = "blockio"
constant Memory (line 49) | Memory = "memory"
constant PageMigration (line 51) | PageMigration = "page-migration"
constant TagAVX512 (line 54) | TagAVX512 = "AVX512"
constant RDTClassKey (line 57) | RDTClassKey = "rdtclass" + "." + kubernetes.ResmgrKeyNamespace
constant BlockIOClassKey (line 59) | BlockIOClassKey = "blockioclass" + "." + kubernetes.ResmgrKeyNamespace
constant ToptierLimitKey (line 61) | ToptierLimitKey = "toptierlimit" + "." + kubernetes.ResmgrKeyNamespace
constant RDTClassPodQoS (line 64) | RDTClassPodQoS = "/PodQos"
constant ToptierLimitUnset (line 67) | ToptierLimitUnset int64 = -1
constant TopologyHintsKey (line 70) | TopologyHintsKey = "topologyhints" + "." + kubernetes.ResmgrKeyNamespace
type PodState (line 77) | type PodState
constant PodStateReady (line 81) | PodStateReady = PodState(int32(criv1.PodSandboxState_SANDBOX_READY))
constant PodStateNotReady (line 83) | PodStateNotReady = PodState(int32(criv1.PodSandboxState_SANDBOX_NOTREADY))
constant PodStateStale (line 85) | PodStateStale = PodState(int32(PodStateNotReady) + 1)
type PodResourceRequirements (line 89) | type PodResourceRequirements struct
type PodStatus (line 97) | type PodStatus struct
type Pod (line 102) | type Pod interface
type pod (line 178) | type pod struct
type ContainerState (line 196) | type ContainerState
constant ContainerStateCreated (line 200) | ContainerStateCreated = ContainerState(int32(criv1.ContainerState_CONTAI...
constant ContainerStateRunning (line 202) | ContainerStateRunning = ContainerState(int32(criv1.ContainerState_CONTAI...
constant ContainerStateExited (line 204) | ContainerStateExited = ContainerState(int32(criv1.ContainerState_CONTAIN...
constant ContainerStateUnknown (line 206) | ContainerStateUnknown = ContainerState(int32(criv1.ContainerState_CONTAI...
constant ContainerStateCreating (line 208) | ContainerStateCreating = ContainerState(int32(ContainerStateUnknown) + 1)
constant ContainerStateStale (line 210) | ContainerStateStale = ContainerState(int32(ContainerStateUnknown) + 2)
type Container (line 214) | type Container interface
type container (line 412) | type container struct
type MountType (line 448) | type MountType
constant MountPrivate (line 452) | MountPrivate MountType = MountType(criv1.MountPropagation_PROPAGATION_PR...
constant MountHostToContainer (line 454) | MountHostToContainer MountType = MountType(criv1.MountPropagation_PROPAG...
constant MountBidirectional (line 456) | MountBidirectional MountType = MountType(criv1.MountPropagation_PROPAGAT...
type Mount (line 460) | type Mount struct
type Device (line 474) | type Device struct
type PageMigrate (line 484) | type PageMigrate struct
method Clone (line 490) | func (pm *PageMigrate) Clone() *PageMigrate {
type Cachable (line 505) | type Cachable interface
type Cache (line 518) | type Cache interface
constant CacheVersion (line 597) | CacheVersion = "1"
type permissions (line 601) | type permissions struct
type cache (line 615) | type cache struct
method GetActivePolicy (line 676) | func (cch *cache) GetActivePolicy() string {
method SetActivePolicy (line 681) | func (cch *cache) SetActivePolicy(policy string) error {
method ResetActivePolicy (line 687) | func (cch *cache) ResetActivePolicy() error {
method SetConfig (line 699) | func (cch *cache) SetConfig(cfg *config.RawConfig) error {
method GetConfig (line 712) | func (cch *cache) GetConfig() *config.RawConfig {
method ResetConfig (line 717) | func (cch *cache) ResetConfig() error {
method SetAdjustment (line 730) | func (cch *cache) SetAdjustment(external *config.Adjustment) (bool, ma...
method getApplicableAdjustments (line 803) | func (cch *cache) getApplicableAdjustments(ext *config.Adjustment, c *...
method setEffectiveAdjustment (line 817) | func (cch *cache) setEffectiveAdjustment(effective map[*container]stri...
method createCacheID (line 839) | func (cch *cache) createCacheID(c *container) string {
method InsertPod (line 855) | func (cch *cache) InsertPod(id string, msg interface{}, status *PodSta...
method DeletePod (line 882) | func (cch *cache) DeletePod(id string) Pod {
method LookupPod (line 897) | func (cch *cache) LookupPod(id string) (Pod, bool) {
method InsertContainer (line 903) | func (cch *cache) InsertContainer(msg interface{}) (Container, error) {
method UpdateContainerID (line 947) | func (cch *cache) UpdateContainerID(cacheID string, msg interface{}) (...
method DeleteContainer (line 969) | func (cch *cache) DeleteContainer(id string) Container {
method LookupContainer (line 986) | func (cch *cache) LookupContainer(id string) (Container, bool) {
method LookupContainerByCgroup (line 992) | func (cch *cache) LookupContainerByCgroup(path string) (Container, boo...
method RefreshPods (line 1021) | func (cch *cache) RefreshPods(msg *criv1.ListPodSandboxResponse, statu...
method RefreshContainers (line 1065) | func (cch *cache) RefreshContainers(msg *criv1.ListContainersResponse)...
method markPending (line 1104) | func (cch *cache) markPending(c *container) {
method GetPendingContainers (line 1112) | func (cch *cache) GetPendingContainers() []Container {
method clearPending (line 1124) | func (cch *cache) clearPending(c *container) {
method GetContainerCacheIds (line 1129) | func (cch *cache) GetContainerCacheIds() []string {
method GetContainerIds (line 1145) | func (cch *cache) GetContainerIds() []string {
method GetPods (line 1161) | func (cch *cache) GetPods() []Pod {
method GetContainers (line 1170) | func (cch *cache) GetContainers() []Container {
method SetPolicyEntry (line 1182) | func (cch *cache) SetPolicyEntry(key string, obj interface{}) {
method GetPolicyEntry (line 1195) | func (cch *cache) GetPolicyEntry(key string, ptr interface{}) bool {
method cacheEntry (line 1289) | func (cch *cache) cacheEntry(key string, ptr interface{}) error {
method setEntry (line 1330) | func (cch *cache) setEntry(ptr, obj interface{}) error {
method checkPerm (line 1371) | func (cch *cache) checkPerm(what, path string, isDir bool, p *permissi...
method mkdirAll (line 1418) | func (cch *cache) mkdirAll(what, path string, p *permissions) error {
method Snapshot (line 1446) | func (cch *cache) Snapshot() ([]byte, error) {
method Restore (line 1485) | func (cch *cache) Restore(data []byte) error {
method Save (line 1525) | func (cch *cache) Save() error {
method Load (line 1546) | func (cch *cache) Load() error {
method ContainerDirectory (line 1565) | func (cch *cache) ContainerDirectory(id string) string {
method createContainerDirectory (line 1573) | func (cch *cache) createContainerDirectory(id string) error {
method removeContainerDirectory (line 1581) | func (cch *cache) removeContainerDirectory(id string) error {
method OpenFile (line 1589) | func (cch *cache) OpenFile(id string, name string, perm os.FileMode) (...
method WriteFile (line 1611) | func (cch *cache) WriteFile(id string, name string, perm os.FileMode, ...
type Options (line 640) | type Options struct
function NewCache (line 646) | func NewCache(options Options) (Cache, error) {
function marshalEntry (line 1237) | func marshalEntry(obj interface{}) ([]byte, error) {
function unmarshalEntry (line 1254) | func unmarshalEntry(data []byte, ptr interface{}) error {
type snapshot (line 1435) | type snapshot struct
FILE: pkg/cri/resource-manager/cache/cache_test.go
type fakePod (line 32) | type fakePod struct
type fakeContainer (line 42) | type fakeContainer struct
function createTmpCache (line 51) | func createTmpCache() (Cache, string, error) {
function removeTmpCache (line 63) | func removeTmpCache(dir string) {
function createFakePod (line 69) | func createFakePod(cch Cache, fp *fakePod) (Pod, error) {
function createFakeContainer (line 116) | func createFakeContainer(cch Cache, fc *fakeContainer) (Container, error) {
function TestLookupContainerByCgroup (line 151) | func TestLookupContainerByCgroup(t *testing.T) {
function TestDefaultRDTAndBlockIOClasses (line 225) | func TestDefaultRDTAndBlockIOClasses(t *testing.T) {
constant minNonZeroRequest (line 360) | minNonZeroRequest = 2
constant maxCPU (line 362) | maxCPU = (kubernetes.MaxShares / kubernetes.SharesPerCPU) * kubernetes.M...
constant expectedAccuracy (line 364) | expectedAccuracy = 1
function TestCPURequestCalculationAccuracy (line 367) | func TestCPURequestCalculationAccuracy(t *testing.T) {
function TestCPULimitCalculationAccuracy (line 393) | func TestCPULimitCalculationAccuracy(t *testing.T) {
FILE: pkg/cri/resource-manager/cache/container.go
method fromCreateRequest (line 37) | func (c *container) fromCreateRequest(req *criv1.CreateContainerRequest)...
method fromListResponse (line 145) | func (c *container) fromListResponse(lrc *criv1.Container) error {
method setDefaults (line 186) | func (c *container) setDefaults() error {
method PrettyName (line 214) | func (c *container) PrettyName() string {
method GetPod (line 226) | func (c *container) GetPod() (Pod, bool) {
method GetID (line 231) | func (c *container) GetID() string {
method GetPodID (line 235) | func (c *container) GetPodID() string {
method GetCacheID (line 239) | func (c *container) GetCacheID() string {
method GetName (line 243) | func (c *container) GetName() string {
method GetNamespace (line 247) | func (c *container) GetNamespace() string {
method UpdateState (line 251) | func (c *container) UpdateState(state ContainerState) {
method GetState (line 255) | func (c *container) GetState() ContainerState {
method GetQOSClass (line 259) | func (c *container) GetQOSClass() v1.PodQOSClass {
method GetImage (line 269) | func (c *container) GetImage() string {
method GetCommand (line 273) | func (c *container) GetCommand() []string {
method GetArgs (line 279) | func (c *container) GetArgs() []string {
function keysInNamespace (line 285) | func keysInNamespace(m map[string]string, namespace string) []string {
method GetLabelKeys (line 300) | func (c *container) GetLabelKeys() []string {
method GetLabel (line 312) | func (c *container) GetLabel(key string) (string, bool) {
method GetResmgrLabelKeys (line 317) | func (c *container) GetResmgrLabelKeys() []string {
method GetResmgrLabel (line 321) | func (c *container) GetResmgrLabel(key string) (string, bool) {
method GetLabels (line 326) | func (c *container) GetLabels() map[string]string {
method GetAnnotationKeys (line 337) | func (c *container) GetAnnotationKeys() []string {
method GetAnnotation (line 349) | func (c *container) GetAnnotation(key string, objPtr interface{}) (strin...
method GetResmgrAnnotationKeys (line 366) | func (c *container) GetResmgrAnnotationKeys() []string {
method GetResmgrAnnotation (line 370) | func (c *container) GetResmgrAnnotation(key string, objPtr interface{}) ...
method GetEffectiveAnnotation (line 374) | func (c *container) GetEffectiveAnnotation(key string) (string, bool) {
method GetAnnotations (line 382) | func (c *container) GetAnnotations() map[string]string {
method GetEnvKeys (line 393) | func (c *container) GetEnvKeys() []string {
method GetEnv (line 405) | func (c *container) GetEnv(key string) (string, bool) {
method GetMounts (line 410) | func (c *container) GetMounts() []Mount {
method GetMountByHost (line 422) | func (c *container) GetMountByHost(path string) *Mount {
method GetMountByContainer (line 432) | func (c *container) GetMountByContainer(path string) *Mount {
method GetDevices (line 441) | func (c *container) GetDevices() []Device {
method GetDeviceByHost (line 453) | func (c *container) GetDeviceByHost(path string) *Device {
method GetDeviceByContainer (line 463) | func (c *container) GetDeviceByContainer(path string) *Device {
method GetResourceRequirements (line 472) | func (c *container) GetResourceRequirements() v1.ResourceRequirements {
method GetLinuxResources (line 481) | func (c *container) GetLinuxResources() *criv1.LinuxContainerResources {
method setEffectiveAdjustment (line 489) | func (c *container) setEffectiveAdjustment(name string) string {
method getEffectiveAdjustment (line 495) | func (c *container) getEffectiveAdjustment() (*extapi.AdjustmentSpec, st...
method SetCommand (line 505) | func (c *container) SetCommand(value []string) {
method SetArgs (line 510) | func (c *container) SetArgs(value []string) {
method SetLabel (line 515) | func (c *container) SetLabel(key, value string) {
method DeleteLabel (line 523) | func (c *container) DeleteLabel(key string) {
method SetAnnotation (line 530) | func (c *container) SetAnnotation(key, value string) {
method DeleteAnnotation (line 538) | func (c *container) DeleteAnnotation(key string) {
method SetEnv (line 545) | func (c *container) SetEnv(key, value string) {
method UnsetEnv (line 553) | func (c *container) UnsetEnv(key string) {
method InsertMount (line 560) | func (c *container) InsertMount(m *Mount) {
method DeleteMount (line 568) | func (c *container) DeleteMount(path string) {
method InsertDevice (line 575) | func (c *container) InsertDevice(d *Device) {
method DeleteDevice (line 583) | func (c *container) DeleteDevice(path string) {
method GetTopologyHints (line 590) | func (c *container) GetTopologyHints() topology.Hints {
method GetCPUPeriod (line 594) | func (c *container) GetCPUPeriod() int64 {
method GetCPUQuota (line 601) | func (c *container) GetCPUQuota() int64 {
method GetCPUShares (line 608) | func (c *container) GetCPUShares() int64 {
method GetMemoryLimit (line 615) | func (c *container) GetMemoryLimit() int64 {
method GetOomScoreAdj (line 622) | func (c *container) GetOomScoreAdj() int64 {
method GetCpusetCpus (line 629) | func (c *container) GetCpusetCpus() string {
method GetCpusetMems (line 636) | func (c *container) GetCpusetMems() string {
method SetLinuxResources (line 643) | func (c *container) SetLinuxResources(req *criv1.LinuxContainerResources) {
method SetCPUPeriod (line 648) | func (c *container) SetCPUPeriod(value int64) {
method SetCPUQuota (line 656) | func (c *container) SetCPUQuota(value int64) {
method SetCPUShares (line 664) | func (c *container) SetCPUShares(value int64) {
method SetMemoryLimit (line 672) | func (c *container) SetMemoryLimit(value int64) {
method SetOomScoreAdj (line 680) | func (c *container) SetOomScoreAdj(value int64) {
method SetCpusetCpus (line 688) | func (c *container) SetCpusetCpus(value string) {
method SetCpusetMems (line 696) | func (c *container) SetCpusetMems(value string) {
function getTopologyHints (line 704) | func getTopologyHints(hostPath, containerPath string, readOnly bool) top...
function getKubeletHint (line 743) | func getKubeletHint(cpus, mems string) (ret topology.Hints) {
method GetAffinity (line 754) | func (c *container) GetAffinity() ([]*Affinity, error) {
method GetCgroupDir (line 772) | func (c *container) GetCgroupDir() string {
method SetRDTClass (line 784) | func (c *container) SetRDTClass(class string) {
method GetRDTClass (line 789) | func (c *container) GetRDTClass() string {
method SetBlockIOClass (line 798) | func (c *container) SetBlockIOClass(class string) {
method GetBlockIOClass (line 803) | func (c *container) GetBlockIOClass() string {
method SetToptierLimit (line 812) | func (c *container) SetToptierLimit(limit int64) {
method GetToptierLimit (line 817) | func (c *container) GetToptierLimit() int64 {
method SetPageMigration (line 826) | func (c *container) SetPageMigration(p *PageMigrate) {
method GetPageMigration (line 831) | func (c *container) GetPageMigration() *PageMigrate {
method GetProcesses (line 835) | func (c *container) GetProcesses() ([]string, error) {
method GetTasks (line 843) | func (c *container) GetTasks() ([]string, error) {
method SetCRIRequest (line 851) | func (c *container) SetCRIRequest(req interface{}) error {
method GetCRIRequest (line 859) | func (c *container) GetCRIRequest() (interface{}, bool) {
method ClearCRIRequest (line 867) | func (c *container) ClearCRIRequest() (interface{}, bool) {
method GetCRIEnvs (line 873) | func (c *container) GetCRIEnvs() []*criv1.KeyValue {
method GetCRIMounts (line 886) | func (c *container) GetCRIMounts() []*criv1.Mount {
method GetCRIDevices (line 905) | func (c *container) GetCRIDevices() []*criv1.Device {
method markPending (line 922) | func (c *container) markPending(controllers ...string) {
method ClearPending (line 932) | func (c *container) ClearPending(controller string) {
method GetPending (line 939) | func (c *container) GetPending() []string {
method HasPending (line 951) | func (c *container) HasPending(controller string) bool {
method GetTag (line 959) | func (c *container) GetTag(key string) (string, bool) {
method SetTag (line 964) | func (c *container) SetTag(key string, value string) (string, bool) {
method DeleteTag (line 970) | func (c *container) DeleteTag(key string) (string, bool) {
method implicitAffinities (line 976) | func (c *container) implicitAffinities(hasExplicit bool) []*Affinity {
method String (line 992) | func (c *container) String() string {
method Eval (line 996) | func (c *container) Eval(key string) interface{} {
type CompareContainersFn (line 1025) | type CompareContainersFn
function SortContainers (line 1031) | func SortContainers(containers []Container, compareFns ...CompareContain...
function CompareQOS (line 1062) | func CompareQOS(ci, cj Container) int {
function CompareMemory (line 1078) | func CompareMemory(ci, cj Container) int {
function CompareCPU (line 1112) | func CompareCPU(ci, cj Container) int {
FILE: pkg/cri/resource-manager/cache/container_test.go
function TestGetKubeletHint (line 25) | func TestGetKubeletHint(t *testing.T) {
function TestGetTopologyHints (line 70) | func TestGetTopologyHints(t *testing.T) {
function TestKeysInNamespace (line 123) | func TestKeysInNamespace(t *testing.T) {
FILE: pkg/cri/resource-manager/cache/error.go
function cacheError (line 21) | func cacheError(format string, args ...interface{}) error {
FILE: pkg/cri/resource-manager/cache/pod.go
constant KeyResourceAnnotation (line 32) | KeyResourceAnnotation = "intel.com/resources"
method fromRunRequest (line 36) | func (p *pod) fromRunRequest(req *criv1.RunPodSandboxRequest) error {
method fromListResponse (line 65) | func (p *pod) fromListResponse(pod *criv1.PodSandbox, status *PodStatus)...
method GetInitContainers (line 95) | func (p *pod) GetInitContainers() []Container {
method GetContainers (line 115) | func (p *pod) GetContainers() []Container {
method getContainer (line 134) | func (p *pod) getContainer(name string) *container {
method GetContainer (line 153) | func (p *pod) GetContainer(name string) (Container, bool) {
method GetID (line 160) | func (p *pod) GetID() string {
method GetUID (line 165) | func (p *pod) GetUID() string {
method GetName (line 170) | func (p *pod) GetName() string {
method GetNamespace (line 175) | func (p *pod) GetNamespace() string {
method GetState (line 180) | func (p *pod) GetState() PodState {
method GetLabelKeys (line 185) | func (p *pod) GetLabelKeys() []string {
method GetLabel (line 198) | func (p *pod) GetLabel(key string) (string, bool) {
method GetResmgrLabelKeys (line 204) | func (p *pod) GetResmgrLabelKeys() []string {
method GetResmgrLabel (line 209) | func (p *pod) GetResmgrLabel(key string) (string, bool) {
method GetAnnotationKeys (line 215) | func (p *pod) GetAnnotationKeys() []string {
method GetAnnotation (line 228) | func (p *pod) GetAnnotation(key string) (string, bool) {
method GetAnnotationObject (line 234) | func (p *pod) GetAnnotationObject(key string, objPtr interface{},
method GetResmgrAnnotationKeys (line 279) | func (p *pod) GetResmgrAnnotationKeys() []string {
method GetResmgrAnnotation (line 284) | func (p *pod) GetResmgrAnnotation(key string) (string, bool) {
method GetResmgrAnnotationObject (line 289) | func (p *pod) GetResmgrAnnotationObject(key string, objPtr interface{},
method GetEffectiveAnnotation (line 295) | func (p *pod) GetEffectiveAnnotation(key, container string) (string, boo...
method GetCgroupParentDir (line 307) | func (p *pod) GetCgroupParentDir() string {
method discoverQOSClass (line 312) | func (p *pod) discoverQOSClass() error {
method GetPodResourceRequirements (line 361) | func (p *pod) GetPodResourceRequirements() PodResourceRequirements {
method parseResourceAnnotations (line 370) | func (p *pod) parseResourceAnnotations() {
method GetQOSClass (line 376) | func (p *pod) GetQOSClass() v1.PodQOSClass {
method GetContainerAffinity (line 381) | func (p *pod) GetContainerAffinity(name string) ([]*Affinity, error) {
method ScopeExpression (line 425) | func (p *pod) ScopeExpression() *resmgr.Expression {
method String (line 435) | func (p *pod) String() string {
method Eval (line 440) | func (p *pod) Eval(key string) interface{} {
method GetProcesses (line 460) | func (p *pod) GetProcesses(recursive bool) ([]string, error) {
method GetTasks (line 465) | func (p *pod) GetTasks(recursive bool) ([]string, error) {
method getTasks (line 470) | func (p *pod) getTasks(recursive, processes bool) ([]string, error) {
function ParsePodStatus (line 513) | func ParsePodStatus(response *criv1.PodSandboxStatusResponse) (*PodStatu...
FILE: pkg/cri/resource-manager/cache/utils.go
function IsPodQOSClassName (line 41) | func IsPodQOSClassName(class string) bool {
function estimateComputeResources (line 50) | func estimateComputeResources(lnx *criv1.LinuxContainerResources, cgroup...
function getMemoryCapacity (line 93) | func getMemoryCapacity() int64 {
function cgroupParentToQOS (line 129) | func cgroupParentToQOS(dir string) corev1.PodQOSClass {
function resourcesToQOS (line 150) | func resourcesToQOS(podResources *PodResourceRequirements) corev1.PodQOS...
function findContainerDir (line 219) | func findContainerDir(podCgroupDir, ID string) string {
function isSupportedQoSComputeResource (line 251) | func isSupportedQoSComputeResource(name corev1.ResourceName) bool {
function init (line 255) | func init() {
FILE: pkg/cri/resource-manager/config/api/v1/api.pb.go
constant _ (line 33) | _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
constant _ (line 35) | _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
type SetConfigRequest (line 38) | type SetConfigRequest struct
method Reset (line 49) | func (x *SetConfigRequest) Reset() {
method String (line 58) | func (x *SetConfigRequest) String() string {
method ProtoMessage (line 62) | func (*SetConfigRequest) ProtoMessage() {}
method ProtoReflect (line 64) | func (x *SetConfigRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 77) | func (*SetConfigRequest) Descriptor() ([]byte, []int) {
method GetNodeName (line 81) | func (x *SetConfigRequest) GetNodeName() string {
method GetConfig (line 88) | func (x *SetConfigRequest) GetConfig() map[string]string {
type SetConfigReply (line 95) | type SetConfigReply struct
method Reset (line 104) | func (x *SetConfigReply) Reset() {
method String (line 113) | func (x *SetConfigReply) String() string {
method ProtoMessage (line 117) | func (*SetConfigReply) ProtoMessage() {}
method ProtoReflect (line 119) | func (x *SetConfigReply) ProtoReflect() protoreflect.Message {
method Descriptor (line 132) | func (*SetConfigReply) Descriptor() ([]byte, []int) {
method GetError (line 136) | func (x *SetConfigReply) GetError() string {
type SetAdjustmentRequest (line 143) | type SetAdjustmentRequest struct
method Reset (line 154) | func (x *SetAdjustmentRequest) Reset() {
method String (line 163) | func (x *SetAdjustmentRequest) String() string {
method ProtoMessage (line 167) | func (*SetAdjustmentRequest) ProtoMessage() {}
method ProtoReflect (line 169) | func (x *SetAdjustmentRequest) ProtoReflect() protoreflect.Message {
method Descriptor (line 182) | func (*SetAdjustmentRequest) Descriptor() ([]byte, []int) {
method GetNodeName (line 186) | func (x *SetAdjustmentRequest) GetNodeName() string {
method GetAdjustment (line 193) | func (x *SetAdjustmentRequest) GetAdjustment() string {
type SetAdjustmentReply (line 200) | type SetAdjustmentReply struct
method Reset (line 209) | func (x *SetAdjustmentReply) Reset() {
method String (line 218) | func (x *SetAdjustmentReply) String() string {
method ProtoMessage (line 222) | func (*SetAdjustmentReply) ProtoMessage() {}
method ProtoReflect (line 224) | func (x *SetAdjustmentReply) ProtoReflect() protoreflect.Message {
method Descriptor (line 237) | func (*SetAdjustmentReply) Descriptor() ([]byte, []int) {
method GetErrors (line 241) | func (x *SetAdjustmentReply) GetErrors() map[string]string {
function file_pkg_cri_resource_manager_config_api_v1_api_proto_rawDescGZIP (line 299) | func file_pkg_cri_resource_manager_config_api_v1_api_proto_rawDescGZIP()...
function init (line 329) | func init() { file_pkg_cri_resource_manager_config_api_v1_api_proto_init...
function file_pkg_cri_resource_manager_config_api_v1_api_proto_init (line 330) | func file_pkg_cri_resource_manager_config_api_v1_api_proto_init() {
FILE: pkg/cri/resource-manager/config/api/v1/api_grpc.pb.go
constant _ (line 19) | _ = grpc.SupportPackageIsVersion7
type ConfigClient (line 24) | type ConfigClient interface
type configClient (line 29) | type configClient struct
method SetConfig (line 37) | func (c *configClient) SetConfig(ctx context.Context, in *SetConfigReq...
method SetAdjustment (line 46) | func (c *configClient) SetAdjustment(ctx context.Context, in *SetAdjus...
function NewConfigClient (line 33) | func NewConfigClient(cc grpc.ClientConnInterface) ConfigClient {
type ConfigServer (line 58) | type ConfigServer interface
type UnimplementedConfigServer (line 65) | type UnimplementedConfigServer struct
method SetConfig (line 68) | func (UnimplementedConfigServer) SetConfig(context.Context, *SetConfig...
method SetAdjustment (line 71) | func (UnimplementedConfigServer) SetAdjustment(context.Context, *SetAd...
method mustEmbedUnimplementedConfigServer (line 74) | func (UnimplementedConfigServer) mustEmbedUnimplementedConfigServer() {}
type UnsafeConfigServer (line 79) | type UnsafeConfigServer interface
function RegisterConfigServer (line 83) | func RegisterConfigServer(s grpc.ServiceRegistrar, srv ConfigServer) {
function _Config_SetConfig_Handler (line 87) | func _Config_SetConfig_Handler(srv interface{}, ctx context.Context, dec...
function _Config_SetAdjustment_Handler (line 105) | func _Config_SetAdjustment_Handler(srv interface{}, ctx context.Context,...
FILE: pkg/cri/resource-manager/config/config.go
type RawConfig (line 25) | type RawConfig struct
method HasIdenticalData (line 39) | func (c *RawConfig) HasIdenticalData(data map[string]string) bool {
type Adjustment (line 33) | type Adjustment struct
FILE: pkg/cri/resource-manager/config/server.go
constant SocketDisabled (line 38) | SocketDisabled = "disabled"
type SetConfigCb (line 42) | type SetConfigCb
type SetAdjustmentCb (line 45) | type SetAdjustmentCb
type Server (line 48) | type Server interface
type server (line 54) | type server struct
method Start (line 75) | func (s *server) Start(socket string) error {
method Stop (line 115) | func (s *server) Stop() {
method SetConfig (line 123) | func (s *server) SetConfig(_ context.Context, req *v1.SetConfigRequest...
method SetAdjustment (line 139) | func (s *server) SetAdjustment(_ context.Context, req *v1.SetAdjustmen...
function NewConfigServer (line 65) | func NewConfigServer(configCb SetConfigCb, adjustmentCb SetAdjustmentCb)...
function serverError (line 169) | func serverError(format string, args ...interface{}) error {
FILE: pkg/cri/resource-manager/control/blockio/blockio.go
constant BlockIOController (line 31) | BlockIOController = cache.BlockIO
type blockioctl (line 35) | type blockioctl struct
method Start (line 55) | func (ctl *blockioctl) Start(cache cache.Cache, _ client.Client) error {
method Stop (line 62) | func (ctl *blockioctl) Stop() {
method PreCreateHook (line 66) | func (ctl *blockioctl) PreCreateHook(_ cache.Container) error {
method PreStartHook (line 71) | func (ctl *blockioctl) PreStartHook(_ cache.Container) error {
method PostStartHook (line 76) | func (ctl *blockioctl) PostStartHook(c cache.Container) error {
method PostUpdateHook (line 91) | func (ctl *blockioctl) PostUpdateHook(c cache.Container) error {
method PostStopHook (line 106) | func (ctl *blockioctl) PostStopHook(_ cache.Container) error {
method isImplicitlyDisabled (line 111) | func (ctl *blockioctl) isImplicitlyDisabled() bool {
method assign (line 126) | func (ctl *blockioctl) assign(c cache.Container) error {
method configNotify (line 146) | func (ctl *blockioctl) configNotify(event config.Event, _ config.Sourc...
method reconfigureRunningContainers (line 163) | func (ctl *blockioctl) reconfigureRunningContainers() error {
function getBlockIOController (line 47) | func getBlockIOController() *blockioctl {
function blockioError (line 180) | func blockioError(format string, args ...interface{}) error {
function init (line 185) | func init() {
FILE: pkg/cri/resource-manager/control/control.go
type Control (line 28) | type Control interface
type Controller (line 44) | type Controller interface
type control (line 62) | type control struct
method StartStopControllers (line 108) | func (c *control) StartStopControllers(cache cache.Cache, client clien...
method RunPreCreateHooks (line 159) | func (c *control) RunPreCreateHooks(container cache.Container) error {
method RunPreStartHooks (line 169) | func (c *control) RunPreStartHooks(container cache.Container) error {
method RunPostStartHooks (line 179) | func (c *control) RunPostStartHooks(container cache.Container) error {
method RunPostUpdateHooks (line 189) | func (c *control) RunPostUpdateHooks(container cache.Container) error {
method RunPostStopHooks (line 199) | func (c *control) RunPostStopHooks(container cache.Container) error {
method runhook (line 209) | func (c *control) runhook(controller *controller, hook string, contain...
type controller (line 69) | type controller struct
constant precreate (line 79) | precreate = "pre-create"
constant prestart (line 80) | prestart = "pre-start"
constant poststart (line 81) | poststart = "post-start"
constant postupdate (line 82) | postupdate = "post-update"
constant poststop (line 83) | poststop = "post-stop"
function NewControl (line 93) | func NewControl() (Control, error) {
function Register (line 242) | func Register(name, description string, c Controller) error {
function controlError (line 259) | func controlError(format string, args ...interface{}) error {
FILE: pkg/cri/resource-manager/control/cpu/api.go
function GetClasses (line 23) | func GetClasses() map[string]Class {
function Assign (line 31) | func Assign(c cache.Cache, class string, cpus ...int) error {
FILE: pkg/cri/resource-manager/control/cpu/cache.go
constant cacheKeyCPUAssignments (line 23) | cacheKeyCPUAssignments = "CPUClassAssignments"
type cpuClassAssignments (line 28) | type cpuClassAssignments
method Set (line 47) | func (c *cpuClassAssignments) Set(value interface{}) {
method Get (line 58) | func (c *cpuClassAssignments) Get() interface{} {
function getClassAssignments (line 31) | func getClassAssignments(c cache.Cache) *cpuClassAssignments {
function setClassAssignments (line 42) | func setClassAssignments(c cache.Cache, a *cpuClassAssignments) {
FILE: pkg/cri/resource-manager/control/cpu/cpu.go
constant ConfigModuleName (line 32) | ConfigModuleName = "cpu"
constant CPUController (line 35) | CPUController = cache.CPU
type cpuctl (line 39) | type cpuctl struct
method Start (line 76) | func (ctl *cpuctl) Start(cache cache.Cache, _ client.Client) error {
method Stop (line 102) | func (ctl *cpuctl) Stop() {
method PreCreateHook (line 106) | func (ctl *cpuctl) PreCreateHook(_ cache.Container) error {
method PreStartHook (line 111) | func (ctl *cpuctl) PreStartHook(_ cache.Container) error {
method PostStartHook (line 116) | func (ctl *cpuctl) PostStartHook(_ cache.Container) error {
method PostUpdateHook (line 121) | func (ctl *cpuctl) PostUpdateHook(_ cache.Container) error {
method PostStopHook (line 126) | func (ctl *cpuctl) PostStopHook(_ cache.Container) error {
method enforceCpufreq (line 131) | func (ctl *cpuctl) enforceCpufreq(class string, cpus ...int) error {
method enforceUncore (line 152) | func (ctl *cpuctl) enforceUncore(assignments cpuClassAssignments, affe...
method configure (line 234) | func (ctl *cpuctl) configure() error {
method configNotify (line 278) | func (ctl *cpuctl) configNotify(_ pkgcfg.Event, _ pkgcfg.Source) error {
method defaultOptions (line 289) | func (ctl *cpuctl) defaultOptions() interface{} {
type config (line 46) | type config struct
method getClasses (line 293) | func (c *config) getClasses() map[string]Class {
type Class (line 53) | type Class struct
function getCPUController (line 67) | func getCPUController() *cpuctl {
function effectiveUncoreFreqs (line 198) | func effectiveUncoreFreqs(cpus utils.IDSet, classes map[string]Class, as...
function idSetIntersects (line 216) | func idSetIntersects(a, b utils.IDSet) bool {
function init (line 302) | func init() {
FILE: pkg/cri/resource-manager/control/cri/cri.go
constant CRIController (line 30) | CRIController = cache.CRI
type crictl (line 34) | type crictl struct
method Start (line 54) | func (ctl *crictl) Start(cache cache.Cache, client client.Client) error {
method Stop (line 62) | func (ctl *crictl) Stop() {
method PreCreateHook (line 66) | func (ctl *crictl) PreCreateHook(c cache.Container) error {
method PreStartHook (line 101) | func (ctl *crictl) PreStartHook(_ cache.Container) error {
method PostStartHook (line 106) | func (ctl *crictl) PostStartHook(_ cache.Container) error {
method PostUpdateHook (line 111) | func (ctl *crictl) PostUpdateHook(c cache.Container) error {
method PostStopHook (line 144) | func (ctl *crictl) PostStopHook(_ cache.Container) error {
function getCRIController (line 46) | func getCRIController() control.Controller {
function criError (line 149) | func criError(format string, args ...interface{}) error {
function init (line 154) | func init() {
FILE: pkg/cri/resource-manager/control/flags.go
type options (line 26) | type options struct
method ControllerMode (line 50) | func (o *options) ControllerMode(name string) mode {
method configNotify (line 59) | func (o *options) configNotify(_ config.Event, _ config.Source) error {
type mode (line 34) | type mode
method String (line 68) | func (m mode) String() string {
method MarshalJSON (line 84) | func (m mode) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 89) | func (m *mode) UnmarshalJSON(raw []byte) error {
constant Disabled (line 38) | Disabled mode = iota
constant Required (line 40) | Required
constant Optional (line 42) | Optional
constant Relaxed (line 44) | Relaxed
constant Default (line 46) | Default = Relaxed
function defaultOptions (line 112) | func defaultOptions() interface{} {
function init (line 117) | func init() {
FILE: pkg/cri/resource-manager/control/memory/memory.go
constant MemoryController (line 31) | MemoryController = cache.Memory
constant memoryCgroupPath (line 34) | memoryCgroupPath = "/sys/fs/cgroup/memory"
constant toptierSoftLimitControl (line 36) | toptierSoftLimitControl = "memory.toptier_soft_limit_in_bytes"
type memctl (line 40) | type memctl struct
method Start (line 60) | func (ctl *memctl) Start(cache cache.Cache, _ client.Client) error {
method Stop (line 70) | func (ctl *memctl) Stop() {
method PreCreateHook (line 74) | func (ctl *memctl) PreCreateHook(_ cache.Container) error {
method PreStartHook (line 79) | func (ctl *memctl) PreStartHook(_ cache.Container) error {
method PostStartHook (line 84) | func (ctl *memctl) PostStartHook(c cache.Container) error {
method PostUpdateHook (line 99) | func (ctl *memctl) PostUpdateHook(c cache.Container) error {
method PostStopHook (line 114) | func (ctl *memctl) PostStopHook(_ cache.Container) error {
method checkToptierLimitSupport (line 119) | func (ctl *memctl) checkToptierLimitSupport() bool {
method setToptierLimit (line 129) | func (ctl *memctl) setToptierLimit(c cache.Container) error {
function getMemoryController (line 52) | func getMemoryController() *memctl {
function memctlError (line 150) | func memctlError(format string, args ...interface{}) error {
function init (line 155) | func init() {
FILE: pkg/cri/resource-manager/control/page-migrate/demoter.go
type page (line 53) | type page struct
type addrRange (line 58) | type addrRange struct
type demoter (line 63) | type demoter struct
method start (line 108) | func (d *demoter) start() {
method Stop (line 119) | func (d *demoter) Stop() {
method Reconfigure (line 127) | func (d *demoter) Reconfigure() {
method updateDemoter (line 139) | func (d *demoter) updateDemoter(cid string, p pagePool, targetNodes id...
method stopDemoter (line 188) | func (d *demoter) stopDemoter(cid string) {
method stopUnusedDemoters (line 196) | func (d *demoter) stopUnusedDemoters(cs map[string]*container) {
method stopDemoters (line 204) | func (d *demoter) stopDemoters() {
method stopDirtyBitResetTimer (line 211) | func (d *demoter) stopDirtyBitResetTimer() {
method startDirtyBitResetTimer (line 218) | func (d *demoter) startDirtyBitResetTimer() {
method resetDirtyBit (line 250) | func (d *demoter) resetDirtyBit(c *container) error {
method scanPages (line 270) | func (d *demoter) scanPages() {
method getPagesForContainer (line 308) | func (d *demoter) getPagesForContainer(c *container, sourceNodes idset...
method movePagesForPid (line 473) | func (d *demoter) movePagesForPid(p []page, count uint, pid int, targe...
method movePages (line 523) | func (d *demoter) movePages(p pagePool, count uint, targetNodes idset....
type pagePool (line 78) | type pagePool struct
type demotion (line 83) | type demotion struct
function copyPagePool (line 88) | func copyPagePool(p pagePool) pagePool {
function newDemoter (line 100) | func newDemoter(m *migration) *demoter {
function resetDirtyBit (line 242) | func resetDirtyBit(pid string) error {
function pickClosestPMEMNode (line 465) | func pickClosestPMEMNode(targetNodes idset.IDSet) idset.ID {
FILE: pkg/cri/resource-manager/control/page-migrate/demoter_test.go
type mockPageMover (line 23) | type mockPageMover struct
method MovePagesSyscall (line 30) | func (m *mockPageMover) MovePagesSyscall(pid int, count uint, pages []...
function TestMovePages (line 56) | func TestMovePages(t *testing.T) {
FILE: pkg/cri/resource-manager/control/page-migrate/flags.go
type options (line 22) | type options struct
function defaultOptions (line 35) | func defaultOptions() interface{} {
function init (line 40) | func init() {
FILE: pkg/cri/resource-manager/control/page-migrate/page-migrate.go
constant PageMigrationController (line 29) | PageMigrationController = cache.PageMigration
constant PageMigrationConfigPath (line 31) | PageMigrationConfigPath = "resource-manager.control." + PageMigrationCon...
constant PageMigrationDescription (line 33) | PageMigrationDescription = "page migration controller"
type migration (line 37) | type migration struct
method Start (line 99) | func (m *migration) Start(cache cache.Cache, _ client.Client) error {
method Stop (line 107) | func (m *migration) Stop() {
method PreCreateHook (line 112) | func (m *migration) PreCreateHook(cache.Container) error {
method PreStartHook (line 117) | func (m *migration) PreStartHook(cache.Container) error {
method PostStartHook (line 122) | func (m *migration) PostStartHook(cc cache.Container) error {
method PostUpdateHook (line 131) | func (m *migration) PostUpdateHook(cc cache.Container) error {
method PostStopHook (line 140) | func (m *migration) PostStopHook(cc cache.Container) error {
method syncWithCache (line 148) | func (m *migration) syncWithCache() {
method insertContainer (line 158) | func (m *migration) insertContainer(cc cache.Container) error {
method updateContainer (line 182) | func (m *migration) updateContainer(cc cache.Container) error {
method deleteContainer (line 199) | func (m *migration) deleteContainer(cc cache.Container) error {
type container (line 73) | type container struct
method GetCacheID (line 205) | func (c *container) GetCacheID() string {
method GetID (line 210) | func (c *container) GetID() string {
method GetCgroupDir (line 215) | func (c *container) GetCgroupDir() string {
method GetPageMigration (line 220) | func (c *container) GetPageMigration() *cache.PageMigrate {
method PrettyName (line 225) | func (c *container) PrettyName() string {
function getMigrationController (line 88) | func getMigrationController() *migration {
function init (line 230) | func init() {
function migrationError (line 235) | func migrationError(format string, args ...interface{}) error {
FILE: pkg/cri/resource-manager/control/page-migrate/page-mover.go
type linuxPageMover (line 26) | type linuxPageMover struct
method MovePagesSyscall (line 33) | func (m *linuxPageMover) MovePagesSyscall(pid int, count uint, pages [...
type PageMover (line 29) | type PageMover interface
FILE: pkg/cri/resource-manager/control/rdt/rdt.go
constant ConfigModuleName (line 33) | ConfigModuleName = "rdt"
constant RDTController (line 36) | RDTController = cache.RDT
constant resctrlGroupPrefix (line 38) | resctrlGroupPrefix = "cri-resmgr."
type rdtctl (line 42) | type rdtctl struct
method Start (line 84) | func (ctl *rdtctl) Start(cache cache.Cache, _ client.Client) error {
method Stop (line 108) | func (ctl *rdtctl) Stop() {
method PreCreateHook (line 112) | func (ctl *rdtctl) PreCreateHook(_ cache.Container) error {
method PreStartHook (line 117) | func (ctl *rdtctl) PreStartHook(_ cache.Container) error {
method PostStartHook (line 122) | func (ctl *rdtctl) PostStartHook(c cache.Container) error {
method PostUpdateHook (line 137) | func (ctl *rdtctl) PostUpdateHook(c cache.Container) error {
method PostStopHook (line 152) | func (ctl *rdtctl) PostStopHook(c cache.Container) error {
method assign (line 160) | func (ctl *rdtctl) assign(c cache.Container) error {
method assignClass (line 186) | func (ctl *rdtctl) assignClass(c cache.Container, class string) error {
method monitor (line 223) | func (ctl *rdtctl) monitor(cls rdt.CtrlGroup, pod, name, id, pretty st...
method stopMonitor (line 242) | func (ctl *rdtctl) stopMonitor(c cache.Container) error {
method stopMonitorAll (line 257) | func (ctl *rdtctl) stopMonitorAll() error {
method assignAll (line 266) | func (ctl *rdtctl) assignAll(forceClass string) {
method monitoringDisabled (line 282) | func (ctl *rdtctl) monitoringDisabled() bool {
method configure (line 286) | func (ctl *rdtctl) configure() error {
method configNotify (line 353) | func (ctl *rdtctl) configNotify(_ pkgcfg.Event, _ pkgcfg.Source) error {
method defaultOptions (line 358) | func (ctl *rdtctl) defaultOptions() interface{} {
type config (line 49) | type config struct
type OperatingMode (line 60) | type OperatingMode
constant OperatingModeDisabled (line 63) | OperatingModeDisabled OperatingMode = "Disabled"
constant OperatingModeDiscovery (line 64) | OperatingModeDiscovery OperatingMode = "Discovery"
constant OperatingModeFull (line 65) | OperatingModeFull OperatingMode = "Full"
function getRDTController (line 75) | func getRDTController() *rdtctl {
function GetClasses (line 365) | func GetClasses() []rdt.CtrlGroup {
function rdtError (line 370) | func rdtError(format string, args ...interface{}) error {
function init (line 375) | func init() {
FILE: pkg/cri/resource-manager/error.go
function resmgrError (line 22) | func resmgrError(format string, args ...interface{}) error {
FILE: pkg/cri/resource-manager/events.go
method setupEventProcessing (line 30) | func (m *resmgr) setupEventProcessing() error {
method startEventProcessing (line 47) | func (m *resmgr) startEventProcessing() error {
method stopEventProcessing (line 85) | func (m *resmgr) stopEventProcessing() {
method SendEvent (line 94) | func (m *resmgr) SendEvent(event interface{}) error {
method processEvent (line 107) | func (m *resmgr) processEvent(e interface{}) {
method processAvx (line 123) | func (m *resmgr) processAvx(e *events.Avx) bool {
method resolveCgroupPath (line 153) | func (m *resmgr) resolveCgroupPath(path string) (cache.Container, bool) {
FILE: pkg/cri/resource-manager/events/events.go
type Metrics (line 18) | type Metrics struct
type Avx (line 24) | type Avx struct
type Policy (line 30) | type Policy struct
constant ContainerStarted (line 41) | ContainerStarted = "container-started"
FILE: pkg/cri/resource-manager/flags.go
type options (line 27) | type options struct
constant allowUntestedRuntimesFlag (line 53) | allowUntestedRuntimesFlag = "allow-untested-runtimes"
function init (line 57) | func init() {
FILE: pkg/cri/resource-manager/introspect/introspect.go
type Pod (line 29) | type Pod struct
type Container (line 37) | type Container struct
type TopologyHints (line 50) | type TopologyHints
type Assignment (line 53) | type Assignment struct
type Pool (line 63) | type Pool struct
type Socket (line 72) | type Socket struct
type Node (line 78) | type Node struct
type System (line 84) | type System struct
type State (line 95) | type State struct
type Server (line 107) | type Server struct
method Set (line 126) | func (s *Server) Set(state *State) error {
method Start (line 133) | func (s *Server) Start() {
method Stop (line 139) | func (s *Server) Stop() {
method set (line 145) | func (s *Server) set(state *State) error {
method serve (line 160) | func (s *Server) serve(w http.ResponseWriter, _ *http.Request) {
function Setup (line 116) | func Setup(mux *xhttp.ServeMux, state *State) (*Server, error) {
function introspectError (line 171) | func introspectError(format string, args ...interface{}) error {
FILE: pkg/cri/resource-manager/kubernetes/kubernetes.go
constant ResmgrKeyNamespace (line 21) | ResmgrKeyNamespace = "cri-resource-manager.intel.com"
constant NamespaceSystem (line 24) | NamespaceSystem = "kube-system"
constant PodNameLabel (line 26) | PodNameLabel = "io.kubernetes.pod.name"
constant PodUIDLabel (line 28) | PodUIDLabel = "io.kubernetes.pod.uid"
constant ContainerNameLabel (line 30) | ContainerNameLabel = "io.kubernetes.container.name"
function ResmgrKey (line 34) | func ResmgrKey(name string) string {
FILE: pkg/cri/resource-manager/kubernetes/resources.go
constant MinShares (line 22) | MinShares = 2
constant MaxShares (line 24) | MaxShares = 262144
constant SharesPerCPU (line 26) | SharesPerCPU = 1024
constant MilliCPUToCPU (line 28) | MilliCPUToCPU = 1000
constant QuotaPeriod (line 30) | QuotaPeriod = 100000
constant MinQuotaPeriod (line 32) | MinQuotaPeriod = 1000
function MilliCPUToQuota (line 37) | func MilliCPUToQuota(milliCPU int64) (quota, period int64) {
function MilliCPUToShares (line 56) | func MilliCPUToShares(milliCPU int64) uint64 {
function SharesToMilliCPU (line 71) | func SharesToMilliCPU(shares int64) int64 {
function QuotaToMilliCPU (line 79) | func QuotaToMilliCPU(quota, period int64) int64 {
FILE: pkg/cri/resource-manager/metrics/avx.go
method collectAvxEvents (line 25) | func (m *Metrics) collectAvxEvents(raw map[string]*model.MetricFamily) *...
FILE: pkg/cri/resource-manager/metrics/metrics.go
constant DefaultAvxThreshold (line 39) | DefaultAvxThreshold = float64(0.1)
type Options (line 43) | type Options struct
type Metrics (line 53) | type Metrics struct
method Start (line 92) | func (m *Metrics) Start() error {
method Stop (line 134) | func (m *Metrics) Stop() {
method poll (line 142) | func (m *Metrics) poll() error {
method process (line 156) | func (m *Metrics) process() error {
method sendEvent (line 171) | func (m *Metrics) sendEvent(e *events.Metrics) error {
function NewMetrics (line 66) | func NewMetrics(opts Options) (*Metrics, error) {
function dump (line 181) | func dump(prefix string, f *model.MetricFamily) {
function metricsError (line 193) | func metricsError(format string, args ...interface{}) error {
FILE: pkg/cri/resource-manager/metrics/prometheus.go
method Gather (line 22) | func (m *Metrics) Gather() ([]*model.MetricFamily, error) {
FILE: pkg/cri/resource-manager/no-test-api.go
type ResourceManagerTestAPI (line 21) | type ResourceManagerTestAPI interface
FILE: pkg/cri/resource-manager/policy/builtin/balloons/balloons-policy.go
constant PolicyName (line 42) | PolicyName = "balloons"
constant PolicyDescription (line 44) | PolicyDescription = "Flexible pools with per-pool CPU parameters"
constant PolicyPath (line 46) | PolicyPath = "policy." + PolicyName
constant balloonKey (line 48) | balloonKey = "balloon." + PolicyName + "." + kubernetes.ResmgrKeyNamespace
constant reservedBalloonDefName (line 50) | reservedBalloonDefName = "reserved"
constant defaultBalloonDefName (line 52) | defaultBalloonDefName = "default"
constant NoLimit (line 54) | NoLimit = 0
type balloons (line 58) | type balloons struct
method Name (line 193) | func (p *balloons) Name() string {
method Description (line 198) | func (p *balloons) Description() string {
method Start (line 203) | func (p *balloons) Start(add []cache.Container, del []cache.Container)...
method Sync (line 210) | func (p *balloons) Sync(add []cache.Container, del []cache.Container) ...
method AllocateResources (line 222) | func (p *balloons) AllocateResources(c cache.Container) error {
method ReleaseResources (line 254) | func (p *balloons) ReleaseResources(c cache.Container) error {
method UpdateResources (line 279) | func (p *balloons) UpdateResources(c cache.Container) error {
method Rebalance (line 285) | func (p *balloons) Rebalance() (bool, error) {
method HandleEvent (line 291) | func (p *balloons) HandleEvent(*events.Policy) (bool, error) {
method ExportResourceData (line 297) | func (p *balloons) ExportResourceData(c cache.Container) map[string]st...
method Introspect (line 302) | func (p *balloons) Introspect(*introspect.State) {
method balloonByContainer (line 307) | func (p *balloons) balloonByContainer(c cache.Container) *Balloon {
method balloonsByNamespace (line 322) | func (p *balloons) balloonsByNamespace(namespace string) []*Balloon {
method balloonsByPod (line 343) | func (p *balloons) balloonsByPod(pod cache.Pod) []*Balloon {
method balloonsByDef (line 356) | func (p *balloons) balloonsByDef(blnDef *BalloonDef) []*Balloon {
method balloonDefByName (line 367) | func (p *balloons) balloonDefByName(defName string) *BalloonDef {
method chooseBalloonDef (line 382) | func (p *balloons) chooseBalloonDef(c cache.Container) (*BalloonDef, e...
method containerRequestedMilliCpus (line 410) | func (p *balloons) containerRequestedMilliCpus(contID string) int {
method containerLimitedMilliCpus (line 422) | func (p *balloons) containerLimitedMilliCpus(contID string) int {
method requestedMilliCpus (line 436) | func (p *balloons) requestedMilliCpus(bln *Balloon) int {
method freeMilliCpus (line 446) | func (p *balloons) freeMilliCpus(bln *Balloon) int {
method maxFreeMilliCpus (line 452) | func (p *balloons) maxFreeMilliCpus(bln *Balloon) int {
method resetCpuClass (line 474) | func (p *balloons) resetCpuClass() error {
method useCpuClass (line 494) | func (p *balloons) useCpuClass(bln *Balloon) error {
method forgetCpuClass (line 519) | func (p *balloons) forgetCpuClass(bln *Balloon) {
method newBalloon (line 526) | func (p *balloons) newBalloon(blnDef *BalloonDef, confCpus bool) (*Bal...
method deleteBalloon (line 602) | func (p *balloons) deleteBalloon(bln *Balloon) {
method freeBalloon (line 617) | func (p *balloons) freeBalloon(bln *Balloon) {
method chooseBalloonInstance (line 625) | func (p *balloons) chooseBalloonInstance(blnDef *BalloonDef, fm FillMe...
method allocateBalloon (line 768) | func (p *balloons) allocateBalloon(c cache.Container) (*Balloon, error) {
method allocateBalloonOfDef (line 789) | func (p *balloons) allocateBalloonOfDef(blnDef *BalloonDef, c cache.Co...
method dumpBalloon (line 826) | func (p *balloons) dumpBalloon(bln *Balloon) string {
method getPodMilliCPU (line 856) | func (p *balloons) getPodMilliCPU(podID string) int64 {
method configNotify (line 919) | func (p *balloons) configNotify(event pkgcfg.Event, source pkgcfg.Sour...
method applyBalloonDef (line 955) | func (p *balloons) applyBalloonDef(balloons *[]*Balloon, blnDef *Ballo...
method validateConfig (line 1029) | func (p *balloons) validateConfig(bpoptions *BalloonsOptions) error {
method setConfig (line 1044) | func (p *balloons) setConfig(bpoptions *BalloonsOptions) error {
method closestMems (line 1123) | func (p *balloons) closestMems(cpus cpuset.CPUSet) idset.IDSet {
method availableMilliCpus (line 1145) | func (p *balloons) availableMilliCpus(balloon *Balloon) int64 {
method resizeBalloon (line 1155) | func (p *balloons) resizeBalloon(bln *Balloon, newMilliCpus int) error {
method updatePinning (line 1212) | func (p *balloons) updatePinning(blns ...*Balloon) {
method shareIdleCpus (line 1227) | func (p *balloons) shareIdleCpus(addCpus, removeCpus cpuset.CPUSet) []...
method assignContainer (line 1279) | func (p *balloons) assignContainer(c cache.Container, bln *Balloon) {
method dismissContainer (line 1289) | func (p *balloons) dismissContainer(c cache.Container, bln *Balloon) {
method pinCpuMem (line 1298) | func (p *balloons) pinCpuMem(c cache.Container, cpus cpuset.CPUSet, me...
type Balloon (line 76) | type Balloon struct
method String (line 102) | func (bln Balloon) String() string {
method PrettyName (line 107) | func (bln Balloon) PrettyName() string {
method ContainerIDs (line 113) | func (bln Balloon) ContainerIDs() []string {
method ContainerCount (line 122) | func (bln Balloon) ContainerCount() int {
method AvailMilliCpus (line 130) | func (bln Balloon) AvailMilliCpus() int {
method MaxAvailMilliCpus (line 134) | func (bln Balloon) MaxAvailMilliCpus(freeCpus cpuset.CPUSet) int {
function CreateBalloonsPolicy (line 142) | func CreateBalloonsPolicy(policyOptions *policy.BackendOptions) policy.B...
function largest (line 459) | func largest(sliceLen int, valueOf func(i int) int) (int, int) {
function namespaceMatches (line 757) | func namespaceMatches(namespace string, patterns []string) bool {
function changesBalloons (line 870) | func changesBalloons(opts0, opts1 *BalloonsOptions) bool {
function changesCpuClasses (line 897) | func changesCpuClasses(opts0, opts1 *BalloonsOptions) bool {
function filterBalloons (line 1135) | func filterBalloons(balloons []*Balloon, test func(*Balloon) bool) (ret ...
function balloonsError (line 1314) | func balloonsError(format string, args ...interface{}) error {
function removeString (line 1319) | func removeString(strings []string, element string) []string {
function max (line 1329) | func max(a, b int) int {
function init (line 1337) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/balloons/balloons-policy_test.go
function TestChangesBalloons (line 21) | func TestChangesBalloons(t *testing.T) {
FILE: pkg/cri/resource-manager/policy/builtin/balloons/cputree.go
type CPUTopologyLevel (line 28) | type CPUTopologyLevel
method String (line 87) | func (ctl CPUTopologyLevel) String() string {
method MarshalJSON (line 107) | func (ctl CPUTopologyLevel) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 112) | func (ctl *CPUTopologyLevel) UnmarshalJSON(data []byte) error {
constant CPUTopologyLevelUndefined (line 31) | CPUTopologyLevelUndefined CPUTopologyLevel = iota
constant CPUTopologyLevelSystem (line 32) | CPUTopologyLevelSystem
constant CPUTopologyLevelPackage (line 33) | CPUTopologyLevelPackage
constant CPUTopologyLevelDie (line 34) | CPUTopologyLevelDie
constant CPUTopologyLevelNuma (line 35) | CPUTopologyLevelNuma
constant CPUTopologyLevelCore (line 36) | CPUTopologyLevelCore
constant CPUTopologyLevelThread (line 37) | CPUTopologyLevelThread
constant CPUTopologyLevelCount (line 38) | CPUTopologyLevelCount
type cpuTreeNode (line 42) | type cpuTreeNode struct
method String (line 128) | func (t *cpuTreeNode) String() string {
method PrettyPrint (line 135) | func (t *cpuTreeNode) PrettyPrint() string {
method CopyTree (line 163) | func (t *cpuTreeNode) CopyTree() *cpuTreeNode {
method CopyNode (line 172) | func (t *cpuTreeNode) CopyNode() *cpuTreeNode {
method Depth (line 184) | func (t *cpuTreeNode) Depth() int {
method AddChild (line 192) | func (t *cpuTreeNode) AddChild(child *cpuTreeNode) {
method AddCpus (line 198) | func (t *cpuTreeNode) AddCpus(cpus cpuset.CPUSet) {
method Cpus (line 206) | func (t *cpuTreeNode) Cpus() cpuset.CPUSet {
method SiblingIndex (line 213) | func (t *cpuTreeNode) SiblingIndex() int {
method FindLeafWithCpu (line 225) | func (t *cpuTreeNode) FindLeafWithCpu(cpu int) *cpuTreeNode {
method DepthFirstWalk (line 258) | func (t *cpuTreeNode) DepthFirstWalk(handler func(*cpuTreeNode) error)...
method CpuLocations (line 276) | func (t *cpuTreeNode) CpuLocations(cpus cpuset.CPUSet) [][]string {
method ToAttributedSlice (line 343) | func (t *cpuTreeNode) ToAttributedSlice(
method toAttributedSlice (line 353) | func (t *cpuTreeNode) toAttributedSlice(
method SplitLevel (line 396) | func (t *cpuTreeNode) SplitLevel(splitLevel CPUTopologyLevel, cpuClass...
method NewAllocator (line 451) | func (t *cpuTreeNode) NewAllocator(options cpuTreeAllocatorOptions) *c...
type cpuTreeNodeAttributes (line 58) | type cpuTreeNodeAttributes struct
method String (line 149) | func (tna cpuTreeNodeAttributes) String() string {
type cpuTreeAllocator (line 71) | type cpuTreeAllocator struct
method sorterAllocate (line 478) | func (ta *cpuTreeAllocator) sorterAllocate(tnas []cpuTreeNodeAttribute...
method sorterRelease (line 510) | func (ta *cpuTreeAllocator) sorterRelease(tnas []cpuTreeNodeAttributes...
method ResizeCpus (line 559) | func (ta *cpuTreeAllocator) ResizeCpus(currentCpus, freeCpus cpuset.CP...
method resizeCpus (line 621) | func (ta *cpuTreeAllocator) resizeCpus(currentCpus, freeCpus cpuset.CP...
type cpuTreeAllocatorOptions (line 78) | type cpuTreeAllocatorOptions struct
function NewCpuTree (line 156) | func NewCpuTree(name string) *cpuTreeNode {
function NewCpuTreeFromSystem (line 291) | func NewCpuTreeFromSystem() (*cpuTreeNode, error) {
FILE: pkg/cri/resource-manager/policy/builtin/balloons/cputree_test.go
type cpuInTopology (line 26) | type cpuInTopology struct
method TopoName (line 33) | func (cit cpuInTopology) TopoName(topoLevel string) string {
type cpusInTopology (line 31) | type cpusInTopology
method dumps (line 49) | func (csit cpusInTopology) dumps(nameCpus map[string]cpuset.CPUSet) st...
method getElements (line 160) | func (csit cpusInTopology) getElements(topoLevel string, cpus cpuset.C...
method verifyDisjoint (line 168) | func (csit cpusInTopology) verifyDisjoint(t *testing.T, topoLevel stri...
function newCpuTreeFromInt5 (line 68) | func newCpuTreeFromInt5(pdnct [5]int) (*cpuTreeNode, cpusInTopology) {
function verifyNotOn (line 113) | func verifyNotOn(t *testing.T, nameContents string, cpus cpuset.CPUSet, ...
function doVerifySame (line 122) | func doVerifySame(t *testing.T, topoLevel string, cpus cpuset.CPUSet, cs...
function verifySame (line 152) | func verifySame(t *testing.T, topoLevel string, cpus cpuset.CPUSet, csit...
function verifyNotSame (line 156) | func verifyNotSame(t *testing.T, topoLevel string, cpus cpuset.CPUSet, c...
function TestResizeCpus (line 226) | func TestResizeCpus(t *testing.T) {
function TestWalk (line 579) | func TestWalk(t *testing.T) {
function TestCpuLocations (line 645) | func TestCpuLocations(t *testing.T) {
function TestCPUTopologyLevel (line 672) | func TestCPUTopologyLevel(t *testing.T) {
function TestSplitLevel (line 715) | func TestSplitLevel(t *testing.T) {
FILE: pkg/cri/resource-manager/policy/builtin/balloons/fillmethod.go
type FillMethod (line 24) | type FillMethod
method String (line 79) | func (fm FillMethod) String() string {
method MarshalJSON (line 87) | func (fm FillMethod) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 93) | func (fm *FillMethod) UnmarshalJSON(b []byte) error {
constant FillUnspecified (line 27) | FillUnspecified FillMethod = iota
constant FillBalanced (line 30) | FillBalanced
constant FillBalancedInflate (line 34) | FillBalancedInflate
constant FillPacked (line 38) | FillPacked
constant FillPackedInflate (line 42) | FillPackedInflate
constant FillSameNamespace (line 45) | FillSameNamespace
constant FillSamePod (line 48) | FillSamePod
constant FillNewBalloon (line 51) | FillNewBalloon
constant FillNewBalloonMust (line 55) | FillNewBalloonMust
constant FillReservedBalloon (line 58) | FillReservedBalloon
constant FillDefaultBalloon (line 61) | FillDefaultBalloon
FILE: pkg/cri/resource-manager/policy/builtin/balloons/flags.go
type BalloonsOptions (line 26) | type BalloonsOptions
method DeepCopy (line 131) | func (bo *BalloonsOptions) DeepCopy() *BalloonsOptions {
method UnmarshalJSON (line 169) | func (bo *BalloonsOptions) UnmarshalJSON(data []byte) error {
type balloonsOptionsWrapped (line 29) | type balloonsOptionsWrapped struct
type BalloonDef (line 64) | type BalloonDef struct
method String (line 143) | func (bdef BalloonDef) String() string {
method DeepCopy (line 148) | func (bdef *BalloonDef) DeepCopy() *BalloonDef {
function defaultBalloonsOptions (line 156) | func defaultBalloonsOptions() interface{} {
function init (line 179) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/balloons/metrics.go
constant balloonsDesc (line 29) | balloonsDesc = iota
type Metrics (line 62) | type Metrics struct
type BalloonMetrics (line 67) | type BalloonMetrics struct
method DescribeMetrics (line 94) | func (p *balloons) DescribeMetrics() []*prometheus.Desc {
method PollMetrics (line 99) | func (p *balloons) PollMetrics() policy.Metrics {
method CollectMetrics (line 145) | func (p *balloons) CollectMetrics(m policy.Metrics) ([]prometheus.Metric...
FILE: pkg/cri/resource-manager/policy/builtin/dynamic-pools/cpu.go
type cpuTimesStat (line 18) | type cpuTimesStat struct
function getCpuUtilization (line 33) | func getCpuUtilization(interval time.Duration) ([]float64, error) {
function getCpuTimesStat (line 49) | func getCpuTimesStat(ctx context.Context) ([]cpuTimesStat, error) {
function wait (line 68) | func wait(ctx context.Context, interval time.Duration) error {
function calculateAllCpusUtilization (line 78) | func calculateAllCpusUtilization(cts1, cts2 []cpuTimesStat) ([]float64, ...
function readCpuLines (line 90) | func readCpuLines(filename string) ([]string, error) {
function parseStatLine (line 120) | func parseStatLine(cpuLine string) (*cpuTimesStat, error) {
function calculateOneCpuUtilization (line 189) | func calculateOneCpuUtilization(cts1, cts2 cpuTimesStat) float64 {
function getBusyTime (line 201) | func getBusyTime(cts cpuTimesStat) (float64, float64) {
FILE: pkg/cri/resource-manager/policy/builtin/dynamic-pools/dyp.go
constant PolicyName (line 43) | PolicyName = "dynamic-pools"
constant PolicyDescription (line 45) | PolicyDescription = "The cpuset of the dynamic pools can be dynamically ...
constant PolicyPath (line 47) | PolicyPath = "policy." + PolicyName
constant dynamicPoolKey (line 49) | dynamicPoolKey = "dynamic-pool." + PolicyName + "." + kubernetes.ResmgrK...
constant reservedDynamicPoolDefName (line 51) | reservedDynamicPoolDefName = "reserved"
constant sharedDynamicPoolDefName (line 53) | sharedDynamicPoolDefName = "shared"
type dynamicPools (line 57) | type dynamicPools struct
method calculateAllPoolWeights (line 139) | func (p *dynamicPools) calculateAllPoolWeights() (map[*DynamicPool]flo...
method calculateAllPoolRequests (line 167) | func (p *dynamicPools) calculateAllPoolRequests() (map[*DynamicPool]in...
method containerPinPool (line 182) | func (p *dynamicPools) containerPinPool(dp *DynamicPool) {
method calculatePoolCpuset (line 192) | func (p *dynamicPools) calculatePoolCpuset(requestCpu map[*DynamicPool...
method isNeedReallocate (line 235) | func (p *dynamicPools) isNeedReallocate(newPoolCpu map[*DynamicPool]in...
method updatePoolCpuset (line 248) | func (p *dynamicPools) updatePoolCpuset() error {
method Name (line 345) | func (p *dynamicPools) Name() string {
method Description (line 350) | func (p *dynamicPools) Description() string {
method Start (line 355) | func (p *dynamicPools) Start(add []cache.Container, del []cache.Contai...
method Sync (line 361) | func (p *dynamicPools) Sync(add []cache.Container, del []cache.Contain...
method AllocateResources (line 373) | func (p *dynamicPools) AllocateResources(c cache.Container) error {
method ReleaseResources (line 398) | func (p *dynamicPools) ReleaseResources(c cache.Container) error {
method UpdateResources (line 418) | func (p *dynamicPools) UpdateResources(c cache.Container) error {
method Rebalance (line 424) | func (p *dynamicPools) Rebalance() (bool, error) {
method HandleEvent (line 431) | func (p *dynamicPools) HandleEvent(*events.Policy) (bool, error) {
method ExportResourceData (line 437) | func (p *dynamicPools) ExportResourceData(c cache.Container) map[strin...
method Introspect (line 442) | func (p *dynamicPools) Introspect(*introspect.State) {
method dynamicPoolByContainer (line 447) | func (p *dynamicPools) dynamicPoolByContainer(c cache.Container) *Dyna...
method dynamicPoolByDef (line 461) | func (p *dynamicPools) dynamicPoolByDef(dpDef *DynamicPoolDef) *Dynami...
method dynamicPoolDefByName (line 471) | func (p *dynamicPools) dynamicPoolDefByName(defName string) *DynamicPo...
method chooseDynamicPoolDef (line 487) | func (p *dynamicPools) chooseDynamicPoolDef(c cache.Container) (*Dynam...
method containerRequestedMilliCpus (line 521) | func (p *dynamicPools) containerRequestedMilliCpus(contID string) int {
method containerLimitedMilliCpus (line 533) | func (p *dynamicPools) containerLimitedMilliCpus(contID string) int {
method requestedMaxMilliCpus (line 547) | func (p *dynamicPools) requestedMaxMilliCpus(dp *DynamicPool) int {
method requestedMinMilliCpus (line 557) | func (p *dynamicPools) requestedMinMilliCpus(dp *DynamicPool) int {
method useCpuClass (line 566) | func (p *dynamicPools) useCpuClass(dp *DynamicPool) error {
method newDynamicPool (line 590) | func (p *dynamicPools) newDynamicPool(dpDef *DynamicPoolDef, confCpus ...
method allocateDynamicPool (line 628) | func (p *dynamicPools) allocateDynamicPool(c cache.Container) (*Dynami...
method dumpDynamicPool (line 644) | func (p *dynamicPools) dumpDynamicPool(dp *DynamicPool) string {
method configNotify (line 719) | func (p *dynamicPools) configNotify(event pkgcfg.Event, source pkgcfg....
method applyDynamicPoolDef (line 754) | func (p *dynamicPools) applyDynamicPoolDef(dynamicPools *[]*DynamicPoo...
method setConfig (line 790) | func (p *dynamicPools) setConfig(dpoptions *DynamicPoolsOptions) error {
method closestMems (line 852) | func (p *dynamicPools) closestMems(cpus cpuset.CPUSet) idset.IDSet {
method assignContainer (line 864) | func (p *dynamicPools) assignContainer(c cache.Container, dp *DynamicP...
method dismissContainer (line 872) | func (p *dynamicPools) dismissContainer(c cache.Container, dp *Dynamic...
method pinCpuMem (line 881) | func (p *dynamicPools) pinCpuMem(c cache.Container, cpus cpuset.CPUSet...
type DynamicPool (line 73) | type DynamicPool struct
method String (line 89) | func (dp DynamicPool) String() string {
method PrettyName (line 94) | func (dp DynamicPool) PrettyName() string {
method ContainerIDs (line 100) | func (dp DynamicPool) ContainerIDs() []string {
method ContainerCount (line 109) | func (dp DynamicPool) ContainerCount() int {
method AvailMilliCpus (line 118) | func (dp DynamicPool) AvailMilliCpus() int {
method updateRealCpuUsed (line 123) | func (dp *DynamicPool) updateRealCpuUsed(cpuInfo []float64) (float64, ...
function CreateDynamicPoolsPolicy (line 300) | func CreateDynamicPoolsPolicy(policyOptions *policy.BackendOptions) poli...
function namespaceMatches (line 617) | func namespaceMatches(namespace string, patterns []string) bool {
function changesDynamicPools (line 675) | func changesDynamicPools(opts0, opts1 *DynamicPoolsOptions) bool {
function changesCpuClasses (line 700) | func changesCpuClasses(opts0, opts1 *DynamicPoolsOptions) bool {
function dynamicPoolsError (line 897) | func dynamicPoolsError(format string, args ...interface{}) error {
function removeString (line 902) | func removeString(strings []string, element string) []string {
function init (line 913) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/dynamic-pools/dyp_test.go
function TestChangesDynamicPools (line 23) | func TestChangesDynamicPools(t *testing.T) {
function TestIsNeedReallocate (line 82) | func TestIsNeedReallocate(t *testing.T) {
function TestCalculatePoolCpuset (line 147) | func TestCalculatePoolCpuset(t *testing.T) {
FILE: pkg/cri/resource-manager/policy/builtin/dynamic-pools/flags.go
type DynamicPoolsOptions (line 26) | type DynamicPoolsOptions
method DeepCopy (line 58) | func (dpo *DynamicPoolsOptions) DeepCopy() *DynamicPoolsOptions {
method UnmarshalJSON (line 96) | func (bo *DynamicPoolsOptions) UnmarshalJSON(data []byte) error {
type dynamicPoolsOptionsWrapped (line 29) | type dynamicPoolsOptionsWrapped struct
type DynamicPoolDef (line 42) | type DynamicPoolDef struct
method String (line 70) | func (dpDef DynamicPoolDef) String() string {
method DeepCopy (line 75) | func (bdef *DynamicPoolDef) DeepCopy() *DynamicPoolDef {
function defaultDynamicPoolsOptions (line 83) | func defaultDynamicPoolsOptions() interface{} {
function init (line 106) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/dynamic-pools/metrics.go
constant dynamicPoolsDesc (line 29) | dynamicPoolsDesc = iota
type Metrics (line 50) | type Metrics struct
type DynamicPoolMetrics (line 55) | type DynamicPoolMetrics struct
method DescribeMetrics (line 70) | func (p *dynamicPools) DescribeMetrics() []*prometheus.Desc {
method PollMetrics (line 75) | func (p *dynamicPools) PollMetrics() policy.Metrics {
method CollectMetrics (line 106) | func (p *dynamicPools) CollectMetrics(m policy.Metrics) ([]prometheus.Me...
FILE: pkg/cri/resource-manager/policy/builtin/none/none-policy.go
constant PolicyName (line 28) | PolicyName = policy.NonePolicy
constant PolicyDescription (line 30) | PolicyDescription = "A no-op policy, doing pretty much nothing."
type none (line 33) | type none struct
method Name (line 48) | func (n *none) Name() string {
method Description (line 53) | func (n *none) Description() string {
method Start (line 58) | func (n *none) Start(add []cache.Container, del []cache.Container) err...
method Sync (line 64) | func (n *none) Sync(add []cache.Container, del []cache.Container) error {
method AllocateResources (line 70) | func (n *none) AllocateResources(c cache.Container) error {
method ReleaseResources (line 76) | func (n *none) ReleaseResources(c cache.Container) error {
method UpdateResources (line 82) | func (n *none) UpdateResources(c cache.Container) error {
method Rebalance (line 88) | func (n *none) Rebalance() (bool, error) {
method HandleEvent (line 94) | func (n *none) HandleEvent(*events.Policy) (bool, error) {
method ExportResourceData (line 100) | func (n *none) ExportResourceData(c cache.Container) map[string]string {
method Introspect (line 105) | func (n *none) Introspect(*introspect.State) {
method PollMetrics (line 110) | func (p *none) PollMetrics() policy.Metrics {
method DescribeMetrics (line 115) | func (p *none) DescribeMetrics() []*prometheus.Desc {
method CollectMetrics (line 120) | func (p *none) CollectMetrics(policy.Metrics) ([]prometheus.Metric, er...
function CreateNonePolicy (line 41) | func CreateNonePolicy(opts *policy.BackendOptions) policy.Backend {
function init (line 125) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/podpools/flags.go
type PodpoolsOptions (line 26) | type PodpoolsOptions struct
type PoolDef (line 36) | type PoolDef struct
type FillOrder (line 63) | type FillOrder
method String (line 78) | func (fo FillOrder) String() string {
method MarshalJSON (line 86) | func (fo FillOrder) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 92) | func (fo *FillOrder) UnmarshalJSON(b []byte) error {
constant FillBalanced (line 66) | FillBalanced FillOrder = iota
constant FillPacked (line 67) | FillPacked
constant FillFirstFree (line 68) | FillFirstFree
function defaultPodpoolsOptions (line 108) | func defaultPodpoolsOptions() interface{} {
function init (line 119) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/podpools/metrics.go
type Metrics (line 30) | type Metrics struct
type PoolMetrics (line 35) | type PoolMetrics struct
constant cpuUsageDesc (line 48) | cpuUsageDesc = iota
constant poolCPUUsageDesc (line 49) | poolCPUUsageDesc
method DescribeMetrics (line 79) | func (p *podpools) DescribeMetrics() []*prometheus.Desc {
method PollMetrics (line 84) | func (p *podpools) PollMetrics() policy.Metrics {
method CollectMetrics (line 134) | func (p *podpools) CollectMetrics(m policy.Metrics) ([]prometheus.Metric...
function updateCPUUsageMetrics (line 172) | func updateCPUUsageMetrics() ([]prometheus.Metric, error) {
function updatePoolCPUUsageMetrics (line 193) | func updatePoolCPUUsageMetrics(ppm *Metrics) ([]prometheus.Metric, error) {
FILE: pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy.go
constant PolicyName (line 42) | PolicyName = "podpools"
constant PolicyDescription (line 44) | PolicyDescription = "Pod-granularity workload placement"
constant PolicyPath (line 46) | PolicyPath = "policy." + PolicyName
constant podpoolKey (line 48) | podpoolKey = "pool." + PolicyName + "." + kubernetes.ResmgrKeyNamespace
constant reservedPoolDefName (line 50) | reservedPoolDefName = "reserved"
constant defaultPoolDefName (line 52) | defaultPoolDefName = "default"
constant podMilliCPUErrorMargin (line 57) | podMilliCPUErrorMargin = int64(10)
type podpools (line 61) | type podpools struct
method Name (line 169) | func (p *podpools) Name() string {
method Description (line 174) | func (p *podpools) Description() string {
method Start (line 179) | func (p *podpools) Start(add []cache.Container, del []cache.Container)...
method Sync (line 185) | func (p *podpools) Sync(add []cache.Container, del []cache.Container) ...
method AllocateResources (line 197) | func (p *podpools) AllocateResources(c cache.Container) error {
method ReleaseResources (line 218) | func (p *podpools) ReleaseResources(c cache.Container) error {
method UpdateResources (line 241) | func (p *podpools) UpdateResources(c cache.Container) error {
method Rebalance (line 247) | func (p *podpools) Rebalance() (bool, error) {
method HandleEvent (line 253) | func (p *podpools) HandleEvent(*events.Policy) (bool, error) {
method ExportResourceData (line 259) | func (p *podpools) ExportResourceData(c cache.Container) map[string]st...
method Introspect (line 264) | func (p *podpools) Introspect(*introspect.State) {
method allocatedPool (line 269) | func (p *podpools) allocatedPool(pod cache.Pod) *Pool {
method allocatePool (line 280) | func (p *podpools) allocatePool(pod cache.Pod) *Pool {
method containersInPool (line 320) | func (p *podpools) containersInPool(pod cache.Pod, pool *Pool) int {
method dumpPool (line 328) | func (p *podpools) dumpPool(pool *Pool) string {
method freePool (line 351) | func (p *podpools) freePool(pod cache.Pod, pool *Pool) {
method trackPodCPU (line 358) | func (p *podpools) trackPodCPU(pod cache.Pod, pool *Pool) {
method validatePodCPU (line 381) | func (p *podpools) validatePodCPU(pod cache.Pod, pool *Pool) {
method getPodMilliCPU (line 406) | func (p *podpools) getPodMilliCPU(podID string) int64 {
method configNotify (line 419) | func (p *podpools) configNotify(event pkgcfg.Event, source pkgcfg.Sour...
method getPoolDefName (line 431) | func (p *podpools) getPoolDefName(pod cache.Pod) string {
method getPoolDef (line 442) | func (p *podpools) getPoolDef(pod cache.Pod) *PoolDef {
method applyPoolDef (line 461) | func (p *podpools) applyPoolDef(pools *[]*Pool, poolDef *PoolDef, free...
method setConfig (line 545) | func (p *podpools) setConfig(ppoptions *PodpoolsOptions) error {
method closestMems (line 623) | func (p *podpools) closestMems(cpus cpuset.CPUSet) idset.IDSet {
method availableMilliCPUs (line 704) | func (p *podpools) availableMilliCPUs(pool *Pool) int64 {
method assignContainer (line 714) | func (p *podpools) assignContainer(c cache.Container, pool *Pool) {
method dismissContainer (line 722) | func (p *podpools) dismissContainer(c cache.Container, pool *Pool) {
method pinCpuMem (line 728) | func (p *podpools) pinCpuMem(c cache.Container, cpus cpuset.CPUSet, me...
type Pool (line 75) | type Pool struct
method String (line 97) | func (pool Pool) String() string {
method PrettyName (line 109) | func (pool Pool) PrettyName() string {
function CreatePodpoolsPolicy (line 114) | func CreatePodpoolsPolicy(policyOptions *policy.BackendOptions) policy.B...
function filterPools (line 635) | func filterPools(pools []*Pool, test func(*Pool) bool) (ret []*Pool) {
function parseInstancesCPUs (line 647) | func parseInstancesCPUs(is string, cs string, freeCpus int) (int, int, e...
function podpoolsError (line 744) | func podpoolsError(format string, args ...interface{}) error {
function removeString (line 749) | func removeString(strings []string, element string) []string {
function init (line 760) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/podpools/podpools-policy_test.go
function validateError (line 26) | func validateError(t *testing.T, expectedError string, err error) bool {
function assertEqualPools (line 44) | func assertEqualPools(t *testing.T, expectedPool, gotPool Pool) bool {
type mockCpuAllocator (line 62) | type mockCpuAllocator struct
method AllocateCpus (line 64) | func (mca *mockCpuAllocator) AllocateCpus(from *cpuset.CPUSet, cnt int...
method ReleaseCpus (line 85) | func (mca *mockCpuAllocator) ReleaseCpus(*cpuset.CPUSet, int, cpualloc...
function TestApplyPoolDef (line 89) | func TestApplyPoolDef(t *testing.T) {
function TestParseInstancesCPUs (line 431) | func TestParseInstancesCPUs(t *testing.T) {
FILE: pkg/cri/resource-manager/policy/builtin/static-plus/static-plus-policy.go
constant PolicyName (line 40) | PolicyName = "static-plus"
constant PolicyDescription (line 42) | PolicyDescription = "A simple policy supporting exclusive/pinned and sha...
constant keyAllocations (line 44) | keyAllocations = "allocations"
constant keySharedPool (line 46) | keySharedPool = "shared-pool"
constant keyPreferIsolated (line 48) | keyPreferIsolated = "prefer-isolated-cpus"
type Assignment (line 52) | type Assignment struct
type Allocations (line 58) | type Allocations
type staticplus (line 61) | type staticplus struct
method Name (line 98) | func (p *staticplus) Name() string {
method Description (line 103) | func (p *staticplus) Description() string {
method Start (line 108) | func (p *staticplus) Start(add []cache.Container, del []cache.Containe...
method Sync (line 121) | func (p *staticplus) Sync(add []cache.Container, del []cache.Container...
method AllocateResources (line 134) | func (p *staticplus) AllocateResources(c cache.Container) error {
method ReleaseResources (line 154) | func (p *staticplus) ReleaseResources(c cache.Container) error {
method UpdateResources (line 168) | func (p *staticplus) UpdateResources(c cache.Container) error {
method Rebalance (line 174) | func (p *staticplus) Rebalance() (bool, error) {
method HandleEvent (line 180) | func (p *staticplus) HandleEvent(*events.Policy) (bool, error) {
method ExportResourceData (line 186) | func (p *staticplus) ExportResourceData(c cache.Container) map[string]...
method Introspect (line 214) | func (p *staticplus) Introspect(*introspect.State) {
method DescribeMetrics (line 219) | func (p *staticplus) DescribeMetrics() []*prometheus.Desc {
method PollMetrics (line 224) | func (p *staticplus) PollMetrics() policy.Metrics {
method CollectMetrics (line 229) | func (p *staticplus) CollectMetrics(policy.Metrics) ([]prometheus.Metr...
method setupPools (line 239) | func (p *staticplus) setupPools(available, reserved policy.ConstraintS...
method restoreCache (line 311) | func (p *staticplus) restoreCache() error {
method requestedCpus (line 337) | func (p *staticplus) requestedCpus(c cache.Container) (int, int) {
method optOutFromIsolation (line 350) | func (p *staticplus) optOutFromIsolation(c cache.Container) bool {
method assignCpus (line 377) | func (p *staticplus) assignCpus(c cache.Container) (*Assignment, error) {
method addAssignment (line 416) | func (p *staticplus) addAssignment(c cache.Container, a *Assignment) e...
method delAssignment (line 473) | func (p *staticplus) delAssignment(a *Assignment, id string) error {
method updateSharedAllocations (line 509) | func (p *staticplus) updateSharedAllocations() error {
method updatePools (line 554) | func (p *staticplus) updatePools() error {
method dumpPools (line 584) | func (p *staticplus) dumpPools() {
method dumpAllocations (line 603) | func (p *staticplus) dumpAllocations() {
method takeCPUs (line 622) | func (p *staticplus) takeCPUs(from, to *cpuset.CPUSet, cnt int, prefer...
function CreateStaticPlusPolicy (line 78) | func CreateStaticPlusPolicy(opts *policy.BackendOptions) policy.Backend {
function policyError (line 234) | func policyError(format string, args ...interface{}) error {
type CachedAllocations (line 640) | type CachedAllocations interface
type cachedAllocations (line 644) | type cachedAllocations struct
method Get (line 653) | func (ca *cachedAllocations) Get() interface{} {
method Set (line 657) | func (ca *cachedAllocations) Set(value interface{}) {
method MarshalJSON (line 671) | func (ca *cachedAllocations) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 683) | func (ca *cachedAllocations) UnmarshalJSON(data []byte) error {
type marshallableAssignment (line 666) | type marshallableAssignment struct
constant MinShares (line 719) | MinShares = 2
constant SharesPerCPU (line 720) | SharesPerCPU = 1024
constant MilliCPUToCPU (line 721) | MilliCPUToCPU = 1000
constant QuotaPeriod (line 724) | QuotaPeriod = 100000
constant MinQuotaPeriod (line 725) | MinQuotaPeriod = 1000
function MilliCPUToQuota (line 729) | func MilliCPUToQuota(milliCPU int64, period int64) (quota int64) {
function MilliCPUToShares (line 756) | func MilliCPUToShares(milliCPU int) int64 {
function init (line 772) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/static-pools/config.go
type config (line 33) | type config struct
type pools (line 46) | type pools
type cpuList (line 48) | type cpuList struct
method addContainer (line 65) | func (c *cpuList) addContainer(id string) {
method removeContainer (line 72) | func (c *cpuList) removeContainer(id string) {
method getContainers (line 79) | func (c *cpuList) getContainers() []string {
function defaultConfig (line 58) | func defaultConfig() interface{} {
type poolConfig (line 93) | type poolConfig struct
method cpuSet (line 99) | func (p *poolConfig) cpuSet() string {
function parseConfData (line 113) | func parseConfData(raw []byte) (pools, error) {
function readConfFile (line 125) | func readConfFile(filepath string) (pools, error) {
function readConfDir (line 135) | func readConfDir(confDir string) (pools, error) {
function readPoolConfDir (line 158) | func readPoolConfDir(poolDir string) (poolConfig, error) {
function readSocketConfDir (line 194) | func readSocketConfDir(socketDir string) ([]*cpuList, error) {
function validateCPUList (line 221) | func validateCPUList(name string) error {
function parseCPUListName (line 232) | func parseCPUListName(name string) ([]uint, error) {
function init (line 250) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/static-pools/node.go
constant exclusiveCoreResourceName (line 30) | exclusiveCoreResourceName = "cmk.intel.com/exclusive-cores"
constant cmkLegacyNodeLabelName (line 31) | cmkLegacyNodeLabelName = "cmk.intel.com/cmk-node"
type nodeUpdater (line 34) | type nodeUpdater struct
method start (line 48) | func (u *nodeUpdater) start() error {
method update (line 85) | func (u *nodeUpdater) update(c config) {
method updateNode (line 95) | func (u *nodeUpdater) updateNode(conf *config, opTimeout time.Duration...
function newNodeUpdater (line 40) | func newNodeUpdater(agent agent.Interface) *nodeUpdater {
FILE: pkg/cri/resource-manager/policy/builtin/static-pools/stp-policy.go
constant PolicyName (line 37) | PolicyName = "static-pools"
constant PolicyDescription (line 39) | PolicyDescription = "A reimplementation of CMK (CPU Manager for Kubernet...
constant PolicyPath (line 41) | PolicyPath = "policy." + PolicyName
constant StpEnvPool (line 43) | StpEnvPool = "STP_POOL"
constant StpEnvSocketID (line 45) | StpEnvSocketID = "STP_SOCKET_ID"
constant StpEnvNoAffinity (line 47) | StpEnvNoAffinity = "STP_NO_AFFINITY"
constant CmkEnvAssigned (line 51) | CmkEnvAssigned = "CMK_CPUS_ASSIGNED"
constant CmkEnvInfra (line 55) | CmkEnvInfra = "CMK_CPUS_INFRA"
constant CmkEnvShared (line 59) | CmkEnvShared = "CMK_CPUS_SHARED"
constant CmkEnvNumCores (line 62) | CmkEnvNumCores = "CMK_NUM_CORES"
constant CmkPoolInfra (line 64) | CmkPoolInfra = "infra"
constant CmkPoolShared (line 66) | CmkPoolShared = "shared"
type stp (line 69) | type stp struct
method Name (line 99) | func (stp *stp) Name() string {
method Description (line 104) | func (stp *stp) Description() string {
method Start (line 109) | func (stp *stp) Start(add []cache.Container, del []cache.Container) er...
method Sync (line 135) | func (stp *stp) Sync(add []cache.Container, del []cache.Container) err...
method AllocateResources (line 148) | func (stp *stp) AllocateResources(c cache.Container) error {
method ReleaseResources (line 221) | func (stp *stp) ReleaseResources(c cache.Container) error {
method UpdateResources (line 228) | func (stp *stp) UpdateResources(c cache.Container) error {
method Rebalance (line 234) | func (stp *stp) Rebalance() (bool, error) {
method HandleEvent (line 240) | func (stp *stp) HandleEvent(*events.Policy) (bool, error) {
method ExportResourceData (line 246) | func (stp *stp) ExportResourceData(c cache.Container) map[string]string {
method Introspect (line 251) | func (stp *stp) Introspect(*introspect.State) {
method DescribeMetrics (line 256) | func (p *stp) DescribeMetrics() []*prometheus.Desc {
method PollMetrics (line 261) | func (p *stp) PollMetrics() policy.Metrics {
method CollectMetrics (line 266) | func (p *stp) CollectMetrics(policy.Metrics) ([]prometheus.Metric, err...
method configNotify (line 270) | func (stp *stp) configNotify(event pkgcfg.Event, source pkgcfg.Source)...
method setConfig (line 282) | func (stp *stp) setConfig(cfg *config) error {
method initializeState (line 329) | func (stp *stp) initializeState() error {
method verifyConfig (line 344) | func (stp *stp) verifyConfig(cfg *config) error {
method parseContainerCmdline (line 397) | func (stp *stp) parseContainerCmdline(cmd, args []string) *cmkLegacyAr...
method allocateStpResources (line 447) | func (stp *stp) allocateStpResources(c cache.Container, cs stpContaine...
method releaseStpResources (line 552) | func (stp *stp) releaseStpResources(containerID string) error {
method getContainerRegistry (line 607) | func (stp *stp) getContainerRegistry() *stpContainerCache {
method setContainerRegistry (line 618) | func (stp *stp) setContainerRegistry(ccr *stpContainerCache) {
function CreateStpPolicy (line 84) | func CreateStpPolicy(opts *policy.BackendOptions) policy.Backend {
function stpError (line 325) | func stpError(format string, args ...interface{}) error {
type cmkLegacyArgs (line 388) | type cmkLegacyArgs struct
function parseCmkCmdline (line 420) | func parseCmkCmdline(args []string) *cmkLegacyArgs {
function getAvailableCPULists (line 539) | func getAvailableCPULists(socket int64, pool *poolConfig) [](*cpuList) {
constant cacheKeyContainerRegistry (line 576) | cacheKeyContainerRegistry = "ContainerRegistry"
type stpContainerStatus (line 579) | type stpContainerStatus struct
type stpContainerCache (line 588) | type stpContainerCache
method Set (line 591) | func (c *stpContainerCache) Set(value interface{}) {
method Get (line 602) | func (c *stpContainerCache) Get() interface{} {
function init (line 623) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/static-pools/stp-policy_test.go
function TestParseContainerCmdline (line 28) | func TestParseContainerCmdline(t *testing.T) {
function TestCachableData (line 71) | func TestCachableData(t *testing.T) {
FILE: pkg/cri/resource-manager/policy/builtin/static/flags.go
type options (line 23) | type options struct
type Tristate (line 31) | type Tristate
method UnmarshalJSON (line 46) | func (t *Tristate) UnmarshalJSON(data []byte) error {
method MarshalJSON (line 67) | func (t Tristate) MarshalJSON() ([]byte, error) {
method String (line 80) | func (t *Tristate) String() string {
constant TristateOff (line 35) | TristateOff = iota
constant TristateOn (line 37) | TristateOn
constant TristateAuto (line 39) | TristateAuto
function defaultOptions (line 91) | func defaultOptions() interface{} {
function init (line 96) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/static/static-policy.go
constant PolicyName (line 41) | PolicyName = "static"
constant PolicyDescription (line 43) | PolicyDescription = "A reimplementation of the static CPU Manager policy."
constant PolicyPath (line 45) | PolicyPath = "policy." + PolicyName
type static (line 48) | type static struct
method Name (line 95) | func (s *static) Name() string {
method Description (line 100) | func (s *static) Description() string {
method Start (line 105) | func (s *static) Start(add []cache.Container, del []cache.Container) e...
method Sync (line 125) | func (s *static) Sync(add []cache.Container, del []cache.Container) er...
method AllocateResources (line 138) | func (s *static) AllocateResources(c cache.Container) error {
method ReleaseResources (line 154) | func (s *static) ReleaseResources(c cache.Container) error {
method UpdateResources (line 164) | func (s *static) UpdateResources(c cache.Container) error {
method Rebalance (line 170) | func (s *static) Rebalance() (bool, error) {
method HandleEvent (line 176) | func (s *static) HandleEvent(*events.Policy) (bool, error) {
method ExportResourceData (line 182) | func (s *static) ExportResourceData(c cache.Container) map[string]stri...
method Introspect (line 203) | func (s *static) Introspect(*introspect.State) {
method DescribeMetrics (line 208) | func (p *static) DescribeMetrics() []*prometheus.Desc {
method PollMetrics (line 213) | func (p *static) PollMetrics() policy.Metrics {
method CollectMetrics (line 218) | func (p *static) CollectMetrics(policy.Metrics) ([]prometheus.Metric, ...
method configNotify (line 222) | func (s *static) configNotify(event config.Event, source config.Source...
method assignableCPUs (line 238) | func (s *static) assignableCPUs(numCPUs int) cpuset.CPUSet {
method AddContainer (line 251) | func (s *static) AddContainer(pod cache.Pod, container cache.Container...
method RemoveContainer (line 274) | func (s *static) RemoveContainer(containerID string) error {
method cpuPreference (line 297) | func (s *static) cpuPreference(containerID string, numCPUs int) (bool,...
method allocateOrdinaryCPUs (line 333) | func (s *static) allocateOrdinaryCPUs(numCPUs int) (cpuset.CPUSet, err...
method allocateIsolatedCPUs (line 347) | func (s *static) allocateIsolatedCPUs(numCPUs int, prefer bool) (cpuse...
method allocateCPUs (line 364) | func (s *static) allocateCPUs(numCPUs int, containerID string) (cpuset...
method guaranteedCPUs (line 388) | func (s *static) guaranteedCPUs(pod cache.Pod, container cache.Contain...
method checkConstraints (line 407) | func (s *static) checkConstraints() error {
method allocateReserved (line 431) | func (s *static) allocateReserved() error {
method validateState (line 462) | func (s *static) validateState(state cache.Cache) error {
method takeByTopology (line 529) | func (s *static) takeByTopology(available cpuset.CPUSet, numCPUs int, ...
method validateAssignments (line 540) | func (s *static) validateAssignments() {
method GetCPUAssignments (line 582) | func (s *static) GetCPUAssignments() ContainerCPUAssignments {
method SetCPUAssignments (line 598) | func (s *static) SetCPUAssignments(ca ContainerCPUAssignments) {
method GetDefaultCPUSet (line 603) | func (s *static) GetDefaultCPUSet() cpuset.CPUSet {
method SetDefaultCPUSet (line 614) | func (s *static) SetDefaultCPUSet(cset cpuset.CPUSet) {
method GetCPUSet (line 627) | func (s *static) GetCPUSet(containerID string) (cpuset.CPUSet, bool) {
method SetCPUSet (line 635) | func (s *static) SetCPUSet(containerID string, cset cpuset.CPUSet) {
method Delete (line 644) | func (s *static) Delete(containerID string) {
method SetCpusetCpus (line 654) | func (s *static) SetCpusetCpus(id, value string) error {
constant keyPreferIsolated (line 67) | keyPreferIsolated = "prefer-isolated-cpus"
function NewStaticPolicy (line 71) | func NewStaticPolicy(opts *policy.BackendOptions) policy.Backend {
function policyError (line 555) | func policyError(format string, args ...interface{}) error {
type ContainerCPUAssignments (line 569) | type ContainerCPUAssignments
constant keyAssignments (line 577) | keyAssignments = "CPUAssignments"
constant keyDefaultCPUs (line 578) | keyDefaultCPUs = "DefaultCPUSet"
function init (line 667) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/affinity.go
method calculatePoolAffinities (line 23) | func (p *policy) calculatePoolAffinities(container cache.Container) (map...
method calculateContainerAffinity (line 47) | func (p *policy) calculateContainerAffinity(container cache.Container) (...
method registerImplicitAffinities (line 71) | func (p *policy) registerImplicitAffinities() error {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/cache.go
constant keyAllocations (line 27) | keyAllocations = "allocations"
constant keyConfig (line 28) | keyConfig = "config"
method saveAllocations (line 31) | func (p *policy) saveAllocations() {
method restoreAllocations (line 36) | func (p *policy) restoreAllocations(allocations *allocations) error {
method reinstateGrants (line 62) | func (p *policy) reinstateGrants(grants map[string]Grant) error {
type cachedGrant (line 96) | type cachedGrant struct
method ToGrant (line 130) | func (ccg *cachedGrant) ToGrant(policy *policy) (Grant, error) {
function newCachedGrant (line 109) | func newCachedGrant(cg Grant) *cachedGrant {
method MarshalJSON (line 159) | func (cg *grant) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 163) | func (cg *grant) UnmarshalJSON(data []byte) error {
method MarshalJSON (line 175) | func (a *allocations) MarshalJSON() ([]byte, error) {
method UnmarshalJSON (line 184) | func (a *allocations) UnmarshalJSON(data []byte) error {
method Get (line 206) | func (a *allocations) Get() interface{} {
method Set (line 210) | func (a *allocations) Set(value interface{}) {
method Dump (line 227) | func (a *allocations) Dump(logfn func(format string, args ...interface{}...
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/cache_test.go
function TestToGrant (line 24) | func TestToGrant(t *testing.T) {
function TestAllocationMarshalling (line 82) | func TestAllocationMarshalling(t *testing.T) {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/coldstart.go
method triggerColdStart (line 25) | func (p *policy) triggerColdStart(c cache.Container) error {
method finishColdStart (line 59) | func (p *policy) finishColdStart(c cache.Container) (bool, error) {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/coldstart_test.go
function sendEvent (line 33) | func sendEvent(param interface{}) error {
function TestColdStart (line 44) | func TestColdStart(t *testing.T) {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/error.go
function policyError (line 22) | func policyError(format string, args ...interface{}) error {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/flags.go
type options (line 22) | type options struct
function defaultOptions (line 44) | func defaultOptions() interface{} {
function init (line 55) | func init() {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/hint.go
function cpuHintScore (line 28) | func cpuHintScore(hint topology.Hint, CPUs cpuset.CPUSet) float64 {
function numaHintScore (line 39) | func numaHintScore(hint topology.Hint, sysIDs ...idset.ID) float64 {
function dieHintScore (line 58) | func dieHintScore(hint topology.Hint, sysID idset.ID, socket system.CPUP...
function socketHintScore (line 77) | func socketHintScore(hint topology.Hint, sysID idset.ID) float64 {
method hintCpus (line 93) | func (cs *supply) hintCpus(h topology.Hint) cpuset.CPUSet {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/hint_test.go
function TestCpuHintScore (line 25) | func TestCpuHintScore(t *testing.T) {
function TestNumaHintScore (line 71) | func TestNumaHintScore(t *testing.T) {
function TestSocketHintScore (line 109) | func TestSocketHintScore(t *testing.T) {
function TestHintCpus (line 147) | func TestHintCpus(t *testing.T) {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/logging.go
constant IndentDepth (line 28) | IndentDepth = 4
function indent (line 31) | func indent(prefix string, level ...int) string {
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/mocks_test.go
type mockSystemNode (line 33) | type mockSystemNode struct
method MemoryInfo (line 41) | func (fake *mockSystemNode) MemoryInfo() (*system.MemInfo, error) {
method PackageID (line 45) | func (fake *mockSystemNode) PackageID() idset.ID {
method DieID (line 49) | func (fake *mockSystemNode) DieID() idset.ID {
method ID (line 53) | func (fake *mockSystemNode) ID() idset.ID {
method GetMemoryType (line 57) | func (fake *mockSystemNode) GetMemoryType() system.MemoryType {
method HasNormalMemory (line 61) | func (fake *mockSystemNode) HasNormalMemory() bool {
method CPUSet (line 65) | func (fake *mockSystemNode) CPUSet() cpuset.CPUSet {
method Distance (line 69) | func (fake *mockSystemNode) Distance() []int {
method DistanceFrom (line 76) | func (fake *mockSystemNode) DistanceFrom(id idset.ID) int {
type mockCPUPackage (line 80) | type mockCPUPackage struct
method ID (line 83) | func (p *mockCPUPackage) ID() idset.ID {
method CPUSet (line 87) | func (p *mockCPUPackage) CPUSet() cpuset.CPUSet {
method NodeIDs (line 91) | func (p *mockCPUPackage) NodeIDs() []idset.ID {
method DieIDs (line 95) | func (p *mockCPUPackage) DieIDs() []idset.ID {
method DieCPUSet (line 99) | func (p *mockCPUPackage) DieCPUSet(idset.ID) cpuset.CPUSet {
method DieNodeIDs (line 103) | func (p *mockCPUPackage) DieNodeIDs(idset.ID) []idset.ID {
method SstInfo (line 107) | func (p *mockCPUPackage) SstInfo() *sst.SstPackageInfo {
type mockCPU (line 111) | type mockCPU struct
method BaseFrequency (line 119) | func (c *mockCPU) BaseFrequency() uint64 {
method EPP (line 122) | func (c *mockCPU) EPP() system.EPP {
method ID (line 125) | func (c *mockCPU) ID() idset.ID {
method PackageID (line 128) | func (c *mockCPU) PackageID() idset.ID {
method DieID (line 131) | func (c *mockCPU) DieID() idset.ID {
method NodeID (line 134) | func (c *mockCPU) NodeID() idset.ID {
method CoreID (line 137) | func (c *mockCPU) CoreID() idset.ID {
method ThreadCPUSet (line 140) | func (c *mockCPU) ThreadCPUSet() cpuset.CPUSet {
method FrequencyRange (line 143) | func (c *mockCPU) FrequencyRange() system.CPUFreq {
method Online (line 146) | func (c *mockCPU) Online() bool {
method Isolated (line 149) | func (c *mockCPU) Isolated() bool {
method SetFrequencyLimits (line 152) | func (c *mockCPU) SetFrequencyLimits(min, max uint64) error {
method SstClos (line 156) | func (c *mockCPU) SstClos() int {
type mockSystem (line 160) | type mockSystem struct
method Node (line 168) | func (fake *mockSystem) Node(id idset.ID) system.Node {
method CPU (line 177) | func (fake *mockSystem) CPU(idset.ID) system.CPU {
method CPUCount (line 180) | func (fake *mockSystem) CPUCount() int {
method Discover (line 186) | func (fake *mockSystem) Discover() error {
method Package (line 189) | func (fake *mockSystem) Package(idset.ID) system.CPUPackage {
method Offlined (line 192) | func (fake *mockSystem) Offlined() cpuset.CPUSet {
method Isolated (line 195) | func (fake *mockSystem) Isolated() cpuset.CPUSet {
method CPUSet (line 202) | func (fake *mockSystem) CPUSet() cpuset.CPUSet {
method CPUIDs (line 205) | func (fake *mockSystem) CPUIDs() []idset.ID {
method PackageCount (line 208) | func (fake *mockSystem) PackageCount() int {
method SocketCount (line 214) | func (fake *mockSystem) SocketCount() int {
method NUMANodeCount (line 220) | func (fake *mockSystem) NUMANodeCount() int {
method ThreadCount (line 223) | func (fake *mockSystem) ThreadCount() int {
method PackageIDs (line 229) | func (fake *mockSystem) PackageIDs() []idset.ID {
method NodeIDs (line 236) | func (fake *mockSystem) NodeIDs() []idset.ID {
method SetCPUFrequencyLimits (line 243) | func (fake *mockSystem) SetCPUFrequencyLimits(min, max uint64, cpus id...
method SetCpusOnline (line 246) | func (fake *mockSystem) SetCpusOnline(online bool, cpus idset.IDSet) (...
method NodeDistance (line 249) | func (fake *mockSystem) NodeDistance(idset.ID, idset.ID) int {
type mockContainer (line 253) | type mockContainer struct
method PrettyName (line 265) | func (m *mockContainer) PrettyName() string {
method GetPod (line 268) | func (m *mockContainer) GetPod() (cache.Pod, bool) {
method GetID (line 274) | func (m *mockContainer) GetID() string {
method GetPodID (line 277) | func (m *mockContainer) GetPodID() string {
method GetCacheID (line 280) | func (m *mockContainer) GetCacheID() string {
method GetName (line 287) | func (m *mockContainer) GetName() string {
method GetNamespace (line 290) | func (m *mockContainer) GetNamespace() string {
method UpdateState (line 293) | func (m *mockContainer) UpdateState(cache.ContainerState) {
method GetState (line 296) | func (m *mockContainer) GetState() cache.ContainerState {
method GetQOSClass (line 299) | func (m *mockContainer) GetQOSClass() v1.PodQOSClass {
method GetImage (line 306) | func (m *mockContainer) GetImage() string {
method GetCommand (line 309) | func (m *mockContainer) GetCommand() []string {
method GetArgs (line 312) | func (m *mockContainer) GetArgs() []string {
method GetLabelKeys (line 315) | func (m *mockContainer) GetLabelKeys() []string {
method GetLabel (line 318) | func (m *mockContainer) GetLabel(string) (string, bool) {
method GetLabels (line 321) | func (m *mockContainer) GetLabels() map[string]string {
method GetResmgrLabelKeys (line 324) | func (m *mockContainer) GetResmgrLabelKeys() []string {
method GetResmgrLabel (line 327) | func (m *mockContainer) GetResmgrLabel(string) (string, bool) {
method GetAnnotationKeys (line 330) | func (m *mockContainer) GetAnnotationKeys() []string {
method GetAnnotation (line 333) | func (m *mockContainer) GetAnnotation(string, interface{}) (string, bo...
method GetResmgrAnnotationKeys (line 336) | func (m *mockContainer) GetResmgrAnnotationKeys() []string {
method GetResmgrAnnotation (line 339) | func (m *mockContainer) GetResmgrAnnotation(string, interface{}) (stri...
method GetEffectiveAnnotation (line 342) | func (m *mockContainer) GetEffectiveAnnotation(key string) (string, bo...
method GetAnnotations (line 349) | func (m *mockContainer) GetAnnotations() map[string]string {
method GetEnvKeys (line 352) | func (m *mockContainer) GetEnvKeys() []string {
method GetEnv (line 355) | func (m *mockContainer) GetEnv(string) (string, bool) {
method GetMounts (line 358) | func (m *mockContainer) GetMounts() []cache.Mount {
method GetMountByHost (line 361) | func (m *mockContainer) GetMountByHost(string) *cache.Mount {
method GetMountByContainer (line 364) | func (m *mockContainer) GetMountByContainer(string) *cache.Mount {
method GetDevices (line 367) | func (m *mockContainer) GetDevices() []cache.Device {
method GetDeviceByHost (line 370) | func (m *mockContainer) GetDeviceByHost(string) *cache.Device {
method GetDeviceByContainer (line 373) | func (m *mockContainer) GetDeviceByContainer(string) *cache.Device {
method GetResourceRequirements (line 376) | func (m *mockContainer) GetResourceRequirements() v1.ResourceRequireme...
method GetLinuxResources (line 379) | func (m *mockContainer) GetLinuxResources() *criv1.LinuxContainerResou...
method SetCommand (line 382) | func (m *mockContainer) SetCommand([]string) {
method SetArgs (line 385) | func (m *mockContainer) SetArgs([]string) {
method SetLabel (line 388) | func (m *mockContainer) SetLabel(string, string) {
method DeleteLabel (line 391) | func (m *mockContainer) DeleteLabel(string) {
method SetAnnotation (line 394) | func (m *mockContainer) SetAnnotation(string, string) {
method DeleteAnnotation (line 397) | func (m *mockContainer) DeleteAnnotation(string) {
method SetEnv (line 400) | func (m *mockContainer) SetEnv(string, string) {
method UnsetEnv (line 403) | func (m *mockContainer) UnsetEnv(string) {
method InsertMount (line 406) | func (m *mockContainer) InsertMount(*cache.Mount) {
method DeleteMount (line 409) | func (m *mockContainer) DeleteMount(string) {
method InsertDevice (line 412) | func (m *mockContainer) InsertDevice(*cache.Device) {
method DeleteDevice (line 415) | func (m *mockContainer) DeleteDevice(string) {
method GetTopologyHints (line 418) | func (m *mockContainer) GetTopologyHints() topology.Hints {
method GetCPUPeriod (line 421) | func (m *mockContainer) GetCPUPeriod() int64 {
method GetCPUQuota (line 424) | func (m *mockContainer) GetCPUQuota() int64 {
method GetCPUShares (line 427) | func (m *mockContainer) GetCPUShares() int64 {
method GetMemoryLimit (line 430) | func (m *mockContainer) GetMemoryLimit() int64 {
method GetOomScoreAdj (line 433) | func (m *mockContainer) GetOomScoreAdj() int64 {
method GetCpusetCpus (line 436) | func (m *mockContainer) GetCpusetCpus() string {
method GetCpusetMems (line 439) | func (m *mockContainer) GetCpusetMems() string {
method SetLinuxResources (line 442) | func (m *mockContainer) SetLinuxResources(*criv1.LinuxContainerResourc...
method SetCPUPeriod (line 445) | func (m *mockContainer) SetCPUPeriod(int64) {
method SetCPUQuota (line 448) | func (m *mockContainer) SetCPUQuota(int64) {
method SetCPUShares (line 451) | func (m *mockContainer) SetCPUShares(int64) {
method SetMemoryLimit (line 453) | func (m *mockContainer) SetMemoryLimit(int64) {
method SetOomScoreAdj (line 456) | func (m *mockContainer) SetOomScoreAdj(int64) {
method SetCpusetCpus (line 459) | func (m *mockContainer) SetCpusetCpus(string) {
method SetCpusetMems (line 461) | func (m *mockContainer) SetCpusetMems(string) {
method UpdateCriCreateRequest (line 463) | func (m *mockContainer) UpdateCriCreateRequest(*criv1.CreateContainerR...
method CriUpdateRequest (line 466) | func (m *mockContainer) CriUpdateRequest() (*criv1.UpdateContainerReso...
method GetAffinity (line 469) | func (m *mockContainer) GetAffinity() ([]*cache.Affinity, error) {
method SetRDTClass (line 472) | func (m *mockContainer) SetRDTClass(string) {
method GetRDTClass (line 475) | func (m *mockContainer) GetRDTClass() string {
method SetBlockIOClass (line 478) | func (m *mockContainer) SetBlockIOClass(string) {
method GetBlockIOClass (line 481) | func (m *mockContainer) GetBlockIOClass() string {
method SetToptierLimit (line 484) | func (m *mockContainer) SetToptierLimit(int64) {
method GetToptierLimit (line 487) | func (m *mockContainer) GetToptierLimit() int64 {
method SetPageMigration (line 490) | func (m *mockContainer) SetPageMigration(*cache.PageMigrate) {
method GetPageMigration (line 493) | func (m *mockContainer) GetPageMigration() *cache.PageMigrate {
method SetCRIRequest (line 496) | func (m *mockContainer) SetCRIRequest(req interface{}) error {
method GetCRIRequest (line 499) | func (m *mockContainer) GetCRIRequest() (interface{}, bool) {
method ClearCRIRequest (line 502) | func (m *mockContainer) ClearCRIRequest() (interface{}, bool) {
method GetCRIEnvs (line 505) | func (m *mockContainer) GetCRIEnvs() []*criv1.KeyValue {
method GetCRIMounts (line 508) | func (m *mockContainer) GetCRIMounts() []*criv1.Mount {
method GetCRIDevices (line 511) | func (m *mockContainer) GetCRIDevices() []*criv1.Device {
method GetPending (line 514) | func (m *mockContainer) GetPending() []string {
method HasPending (line 517) | func (m *mockContainer) HasPending(string) bool {
method ClearPending (line 520) | func (m *mockContainer) ClearPending(string) {
method GetTag (line 523) | func (m *mockContainer) GetTag(string) (string, bool) {
method SetTag (line 526) | func (m *mockContainer) SetTag(string, string) (string, bool) {
method DeleteTag (line 529) | func (m *mockContainer) DeleteTag(string) (string, bool) {
method String (line 532) | func (m *mockContainer) String() string {
method Eval (line 535) | func (m *mockContainer) Eval(string) interface{} {
method GetProcesses (line 538) | func (m *mockContainer) GetProcesses() ([]string, error) {
method GetTasks (line 541) | func (m *mockContainer) GetTasks() ([]string, error) {
method GetCgroupDir (line 544) | func (m *mockContainer) GetCgroupDir() string {
type mockPod (line 548) | type mockPod struct
method GetInitContainers (line 558) | func (m *mockPod) GetInitContainers() []cache.Container {
method GetContainers (line 561) | func (m *mockPod) GetContainers() []cache.Container {
method GetContainer (line 564) | func (m *mockPod) GetContainer(string) (cache.Container, bool) {
method GetID (line 567) | func (m *mockPod) GetID() string {
method GetUID (line 570) | func (m *mockPod) GetUID() string {
method GetName (line 573) | func (m *mockPod) GetName() string {
method GetNamespace (line 576) | func (m *mockPod) GetNamespace() string {
method GetState (line 579) | func (m *mockPod) GetState() cache.PodState {
method GetQOSClass (line 582) | func (m *mockPod) GetQOSClass() v1.PodQOSClass {
method GetLabelKeys (line 585) | func (m *mockPod) GetLabelKeys() []string {
method GetLabel (line 588) | func (m *mockPod) GetLabel(string) (string, bool) {
method GetResmgrLabelKeys (line 591) | func (m *mockPod) GetResmgrLabelKeys() []string {
method GetResmgrLabel (line 594) | func (m *mockPod) GetResmgrLabel(string) (string, bool) {
method GetAnnotationKeys (line 597) | func (m *mockPod) GetAnnotationKeys() []string {
method GetAnnotation (line 600) | func (m *mockPod) GetAnnotation(string) (string, bool) {
method GetAnnotationObject (line 603) | func (m *mockPod) GetAnnotationObject(string, interface{}, func([]byte...
method GetResmgrAnnotationKeys (line 606) | func (m *mockPod) GetResmgrAnnotationKeys() []string {
method GetResmgrAnnotation (line 609) | func (m *mockPod) GetResmgrAnnotation(key string) (string, bool) {
method GetResmgrAnnotationObject (line 615) | func (m *mockPod) GetResmgrAnnotationObject(string, interface{}, func(...
method GetEffectiveAnnotation (line 618) | func (m *mockPod) GetEffectiveAnnotation(key, container string) (strin...
method GetCgroupParentDir (line 628) | func (m *mockPod) GetCgroupParentDir() string {
method GetPodResourceRequirements (line 631) | func (m *mockPod) GetPodResourceRequirements() cache.PodResourceRequir...
method GetContainerAffinity (line 634) | func (m *mockPod) GetContainerAffinity(string) ([]*cache.Affinity, err...
method ScopeExpression (line 637) | func (m *mockPod) ScopeExpression() *resmgr.Expression {
method String (line 640) | func (m *mockPod) String() string {
method Eval (line 643) | func (m *mockPod) Eval(string) interface{} {
method GetProcesses (line 646) | func (m *mockPod) GetProcesses(bool) ([]string, error) {
method GetTasks (line 649) | func (m *mockPod) GetTasks(bool) ([]string, error) {
type mockCache (line 653) | type mockCache struct
method InsertPod (line 659) | func (m *mockCache) InsertPod(string, interface{}, *cache.PodStatus) (...
method DeletePod (line 662) | func (m *mockCache) DeletePod(string) cache.Pod {
method LookupPod (line 665) | func (m *mockCache) LookupPod(string) (cache.Pod, bool) {
method InsertContainer (line 668) | func (m *mockCache) InsertContainer(interface{}) (cache.Container, err...
method UpdateContainerID (line 671) | func (m *mockCache) UpdateContainerID(string, interface{}) (cache.Cont...
method DeleteContainer (line 674) | func (m *mockCache) DeleteContainer(string) cache.Container {
method LookupContainer (line 677) | func (m *mockCache) LookupContainer(string) (cache.Container, bool) {
method LookupContainerByCgroup (line 680) | func (m *mockCache) LookupContainerByCgroup(path string) (cache.Contai...
method GetPendingContainers (line 683) | func (m *mockCache) GetPendingContainers() []cache.Container {
method GetPods (line 686) | func (m *mockCache) GetPods() []cache.Pod {
method GetContainers (line 689) | func (m *mockCache) GetContainers() []cache.Container {
method GetContainerCacheIds (line 692) | func (m *mockCache) GetContainerCacheIds() []string {
method GetContainerIds (line 695) | func (m *mockCache) GetContainerIds() []string {
method FilterScope (line 698) | func (m *mockCache) FilterScope(*resmgr.Expression) []cache.Container {
method EvaluateAffinity (line 701) | func (m *mockCache) EvaluateAffinity(*cache.Affinity) map[string]int32 {
method AddImplicitAffinities (line 706) | func (m *mockCache) AddImplicitAffinities(map[string]cache.ImplicitAff...
method GetActivePolicy (line 709) | func (m *mockCache) GetActivePolicy() string {
method SetActivePolicy (line 712) | func (m *mockCache) SetActivePolicy(string) error {
method ResetActivePolicy (line 715) | func (m *mockCache) ResetActivePolicy() error {
method SetPolicyEntry (line 718) | func (m *mockCache) SetPolicyEntry(string, interface{}) {
method GetPolicyEntry (line 720) | func (m *mockCache) GetPolicyEntry(string, interface{}) bool {
method SetConfig (line 723) | func (m *mockCache) SetConfig(*config.RawConfig) error {
method GetConfig (line 726) | func (m *mockCache) GetConfig() *config.RawConfig {
method ResetConfig (line 729) | func (m *mockCache) ResetConfig() error {
method SetAdjustment (line 732) | func (m *mockCache) SetAdjustment(*config.Adjustment) (bool, map[strin...
method Save (line 735) | func (m *mockCache) Save() error {
method RefreshPods (line 738) | func (m *mockCache) RefreshPods(*criv1.ListPodSandboxResponse, map[str...
method RefreshContainers (line 741) | func (m *mockCache) RefreshContainers(*criv1.ListContainersResponse) (...
method ContainerDirectory (line 744) | func (m *mockCache) ContainerDirectory(string) string {
method OpenFile (line 747) | func (m *mockCache) OpenFile(string, string, os.FileMode) (*os.File, e...
method WriteFile (line 750) | func (m *mockCache) WriteFile(string, string, os.FileMode, []byte) err...
FILE: pkg/cri/resource-manager/policy/builtin/topology-aware/node.go
type NodeKind (line 37) | type NodeKind
constant NilNode (line 41) | NilNode NodeKind = ""
constant UnknownNode (line 43) | UnknownNode NodeKind = "unknown"
constant SocketNode (line 45) | SocketNode NodeKind = "socket"
constant DieNode (line 47) | DieNode NodeKind = "die"
constant NumaNode (line 49) | NumaNode NodeKind = "numa node"
constant VirtualNode (line 51) | VirtualNode NodeKind = "virtual node"
constant OverfitPenalty (line 56) | OverfitPenalty = 0.9
type Node (line 60) | type Node interface
type node (line 123) | type node struct
method init (line 180) | func (n *node) init(p *policy, name string, kind NodeKind, parent Node) {
method IsNil (line 195) | func (n *node) IsNil() bool {
method Name (line 200) | func (n *node) Name() string {
method Kind (line 208) | func (n *node) Kind() NodeKind {
method NodeID (line 213) | func (n *node) NodeID() int {
method IsSameNode (line 221) | func (n *node) IsSameNode(other Node) bool {
method IsRootNode (line 226) | func (n *node) IsRootNode() bool {
method IsLeafNode (line 231) | func (n *node) IsLeafNode() bool {
method RootDistance (line 236) | func (n *node) RootDistance() int {
method NodeHeight (line 244) | func (n *node) NodeHeight() int {
method Parent (line 252) | func (n *node) Parent() Node {
method Children (line 261) | func (n *node) Children() []Node {
method LinkParent (line 270) | func (n *node) LinkParent(parent Node) {
method AddChildren (line 280) | func (n *node) AddChildren(nodes []Node) {
method Dump (line 285) | func (n *node) Dump(prefix string, level ...int) {
method dump (line 333) | func (n *node) dump(prefix string, level ...int) {
method DepthFirst (line 338) | func (n *node) DepthFirst(fn func(Node) error) error {
method BreadthFirst (line 349) | func (n *node) BreadthFirst(fn func(Node) error) error {
method System (line 364) | func (n *node) System() system.System {
method Policy (line 369) | func (n *node) Policy() *policy {
method GetSupply (line 374) | func (n *node) GetSupply() Supply {
method DiscoverSupply (line 379) | func (n *node) DiscoverSupply(assignedNUMANodes []idset.ID) Supply {
method discoverSupply (line 384) | func (n *node) discoverSupply(assignedNUMANodes []idset.ID) Supply {
method FreeSupply (line 473) | func (n *node) FreeSupply() Supply {
method GetMemset (line 478) | func (n *node) GetMemset(mtype memoryType) idset.IDSet {
method AssignNUMANodes (line 486) | func (n *node) AssignNUMANodes(ids []idset.ID) {
method assignNUMANodes (line 491) | func (n *node) assignNUMANodes(ids []idset.ID) {
method GetPhysicalNodeIDs (line 535) | func (n *node) GetPhysicalNodeIDs() []idset.ID {
method GrantedReservedCPU (line 540) | func (n *node) GrantedReservedCPU() int {
method GrantedSharedCPU (line 549) | func (n *node) GrantedSharedCPU() int {
method GetScore (line 558) | func (n *node) GetScore(req Request) Score {
method HintScore (line 564) | func (n *node) HintScore(hint topology.Hint) float64 {
method GetMemoryType (line 568) | func (n *node) GetMemoryType() memoryType {
method HasMemoryType (line 582) | func (n *node) HasMemoryType(reqType memoryType) bool {
type nodeself (line 140) | type nodeself struct
type socketnode (line 145) | type socketnode struct
method dump (line 753) | func (n *socketnode) dump(prefix string, level ...int) {
method GetSupply (line 758) | func (n *socketnode) GetSupply() Supply {
method GetPhysicalNodeIDs (line 762) | func (n *socketnode) GetPhysicalNodeIDs() []idset.ID {
method DiscoverSupply (line 773) | func (n *socketnode) DiscoverSupply(assignedNUMANodes []idset.ID) Supp...
method GetMemset (line 778) | func (n *socketnode) GetMemset(mtype memoryType) idset.IDSet {
method AssignNUMANodes (line 795) | func (n *socketnode) AssignNUMANodes(ids []idset.ID) {
Condensed preview — 555 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (2,571K chars).
[
{
"path": ".githooks/pre-commit.d/00-gofmt",
"chars": 952,
"preview": "#!/bin/bash\n# Copyright 2012 The Go Authors. All rights reserved.\n# Use of this source code is governed by a BSD-style\n#"
},
{
"path": ".githooks/pre-commit.d/10-shellcheck",
"chars": 1038,
"preview": "#!/bin/bash\n\n# git shellcheck pre-commit hook\n#\n# To use, store as .git/hooks/pre-commit/shellcheck inside your reposito"
},
{
"path": ".githooks/pre-commit.d/20-go-version",
"chars": 556,
"preview": "#!/bin/bash\n\nWORKFLOWS=\".github/workflows/verify.yml\"\n\nif git diff --cached go.mod | grep -q '^+go '; then\n gomod=$(g"
},
{
"path": ".githooks/run-hooks",
"chars": 485,
"preview": "#!/bin/bash\n\ntype=${0##*/}\nhdir=$0.d\norig=${0%/*}/../.git/hooks/$type\n\nexec 1>&2\n\nfor hlet in \"$hdir\"/???*; do\n case "
},
{
"path": ".github/ISSUE_TEMPLATE/bug_report.md",
"chars": 493,
"preview": "---\nname: Bug report\nabout: Create a report to help us improve\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe the b"
},
{
"path": ".github/ISSUE_TEMPLATE/feature_request.md",
"chars": 330,
"preview": "---\nname: Feature request\nabout: Suggest an idea for this project\ntitle: ''\nlabels: ''\nassignees: ''\n\n---\n\n**Describe th"
},
{
"path": ".github/ISSUE_TEMPLATE/new-release.md",
"chars": 2079,
"preview": "---\nname: New release\nabout: Propose a new release\ntitle: Release v0.0.0\nlabels: ''\nassignees: ''\n\n---\n\n## Release Proce"
},
{
"path": ".github/workflows/common-build-docs.yaml",
"chars": 1058,
"preview": "name: Build documentation\non:\n workflow_call:\n inputs:\n publish:\n default: false\n required: false"
},
{
"path": ".github/workflows/common-build-images.yaml",
"chars": 1080,
"preview": "name: Build container images\n\non:\n workflow_call:\n inputs:\n image-tag:\n default: ${{ github.ref_name }}\n"
},
{
"path": ".github/workflows/common-codeql.yaml",
"chars": 1028,
"preview": "name: CodeQL scanning\non:\n workflow_call:\n inputs:\n export-report:\n default: false\n required: fal"
},
{
"path": ".github/workflows/common-trivy.yaml",
"chars": 2343,
"preview": "name: Trivy scanning\non:\n workflow_call:\n inputs:\n upload-to-github-security-tab:\n default: false\n "
},
{
"path": ".github/workflows/common-verify-code.yaml",
"chars": 1106,
"preview": "name: Verify code\n\non:\n - workflow_call\n\npermissions:\n contents: read\n\njobs:\n build-and-test:\n runs-on: ubuntu-22."
},
{
"path": ".github/workflows/publish-devel-images.yaml",
"chars": 563,
"preview": "name: Build and publish devel container images\n\non:\n push:\n branches: [\"master\"]\n\npermissions:\n contents: read\n\ncon"
},
{
"path": ".github/workflows/publish-docs.yml",
"chars": 458,
"preview": "name: Publish documentation\n\non:\n push:\n branches:\n - master\n - release-*\n # Path filters are ignor"
},
{
"path": ".github/workflows/release.yaml",
"chars": 1353,
"preview": "name: Build and publish release artifacts\n\non:\n push:\n tags: [ 'v*' ]\n\npermissions:\n contents: read\n\nconcurrency:\n "
},
{
"path": ".github/workflows/trivy-csv.tpl",
"chars": 843,
"preview": "{{ range . }}\nTrivy Vulnerability Scan Results ({{- .Target -}})\nVulnerabilityID,Severity,CVSS Score,Title,Library,Vulne"
},
{
"path": ".github/workflows/verify-periodic.yaml",
"chars": 340,
"preview": "name: Verify branches periodic\n\non:\n schedule:\n - cron: '30 2 * * 0'\n\npermissions:\n contents: read\n\nconcurrency:\n "
},
{
"path": ".github/workflows/verify-pr-code.yaml",
"chars": 322,
"preview": "name: Verify code\n\non:\n pull_request\n\npermissions:\n contents: read\n\nconcurrency:\n group: ${{ github.workflow }}-${{ g"
},
{
"path": ".github/workflows/verify-pr-docs.yaml",
"chars": 385,
"preview": "name: Verify documentation\n\non:\n pull_request:\n paths:\n - \"docs/**\"\n - \"Makefile\"\n\npermissions:\n contents"
},
{
"path": ".gitignore",
"chars": 170,
"preview": "*~\n*.swp\n\n*_gendata.go\n/bin\ncoverage.html\ncoverage.txt\n.git-hooks.redirected\n\n*.tar\n*.tar.*\n*.spec\n.static.*\n/debian\n/pa"
},
{
"path": "CODEOWNERS",
"chars": 62,
"preview": "* @kad @klihub @marquiz @mythi @askervin @jukkar @fmuyassarov\n"
},
{
"path": "Jenkinsfile",
"chars": 746,
"preview": "pipeline {\n agent {\n label \"cri-rm\"\n }\n\n environment {\n IMAGE_REPO = \"cloud-native-image-registry"
},
{
"path": "LICENSE",
"chars": 11358,
"preview": "\n Apache License\n Version 2.0, January 2004\n "
},
{
"path": "Makefile",
"chars": 30003,
"preview": "# We use bashisms in this Makefile.\nSHELL := /bin/bash\n\n# Go compiler/toolchain and extra related binaries we ues/need.\n"
},
{
"path": "README.md",
"chars": 537,
"preview": "# CRI Resource Manager for Kubernetes\\*\n\n## ⚠️ The project is no longer maintained ⚠️\n\nThe CRI Resource manager project "
},
{
"path": "SECURITY.md",
"chars": 405,
"preview": "# Security Policy\nIntel is committed to rapidly addressing security vulnerabilities affecting our customers and providin"
},
{
"path": "cmd/cri-resmgr/cri-resource-manager.service.in",
"chars": 418,
"preview": "[Unit]\nDescription=A CRI proxy with (hardware) resource aware container placement policies.\nDocumentation=https://github"
},
{
"path": "cmd/cri-resmgr/cri-resource-manager.sysconf",
"chars": 342,
"preview": "# Configuration options to pass to cri-resmgr when started via systemd.\n\n# Use a fallback file for configuration if/when"
},
{
"path": "cmd/cri-resmgr/fallback.cfg.sample",
"chars": 1396,
"preview": "#\n# If you pass this file to cri-resmgr using the --fallback-config\n# command line option, it will be used if configurat"
},
{
"path": "cmd/cri-resmgr/main.go",
"chars": 2605,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "cmd/cri-resmgr-agent/Dockerfile",
"chars": 747,
"preview": "ARG GO_VERSION=1.24\n\nFROM golang:${GO_VERSION}-bullseye as builder\n\nARG GOLICENSES_VERSION\n\nWORKDIR /go/build\n\n# Fetch g"
},
{
"path": "cmd/cri-resmgr-agent/agent-deployment.yaml",
"chars": 2769,
"preview": "apiVersion: v1\nkind: ServiceAccount\nmetadata:\n name: cri-resmgr-agent\n namespace: kube-system\n---\napiVersion: rbac.aut"
},
{
"path": "cmd/cri-resmgr-agent/main.go",
"chars": 1203,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "cmd/cri-resmgr-agent-probe/main.go",
"chars": 2027,
"preview": "/*\nCopyright 2020 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "cmd/cri-resmgr-webhook/Dockerfile",
"chars": 708,
"preview": "ARG GO_VERSION=1.24\n\nFROM golang:${GO_VERSION}-bullseye as builder\n\nARG GOLICENSES_VERSION\n\nWORKDIR /go/build\n\n# Fetch g"
},
{
"path": "cmd/cri-resmgr-webhook/handlers.go",
"chars": 5971,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "cmd/cri-resmgr-webhook/main.go",
"chars": 1069,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "cmd/cri-resmgr-webhook/mutating-webhook-config.yaml",
"chars": 452,
"preview": "apiVersion: admissionregistration.k8s.io/v1\nkind: MutatingWebhookConfiguration\nmetadata:\n name: cri-resmgr\nwebhooks:\n- "
},
{
"path": "cmd/cri-resmgr-webhook/webhook-deployment.yaml",
"chars": 2159,
"preview": "apiVersion: v1\nkind: Namespace\nmetadata:\n name: cri-resmgr\n labels:\n name: cri-resmgr\n---\napiVersion: apps/v1\nkind:"
},
{
"path": "cmd/cri-resmgr-webhook/webhook.go",
"chars": 1372,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "demo/blockio/bb-scanner.yaml",
"chars": 1876,
"preview": "# bb-scanner continuously calculates checksums of files found\n# under /scan. Output reveals added, deleted, renamed and "
},
{
"path": "demo/blockio/cri-resmgr-config.default.yaml",
"chars": 299,
"preview": "apiVersion: v1\nkind: ConfigMap\nmetadata:\n name: cri-resmgr-config.default\n namespace: kube-system\ndata:\n policy: |+\n "
},
{
"path": "demo/blockio/run.sh",
"chars": 9126,
"preview": "#!/bin/bash\n\nDEMO_TITLE=\"CRI Resource Manager: Block I/O Demo\"\n\nPV='pv -qL'\n\nSCRIPT_DIR=\"$(dirname \"${BASH_SOURCE[0]}\")\""
},
{
"path": "demo/lib/command.bash",
"chars": 3512,
"preview": "# Hooks for displaying and logging how shell commands (local and\n# remote) are executed, and handling their output and e"
},
{
"path": "demo/lib/distro.bash",
"chars": 38004,
"preview": "# shellcheck disable=SC2120\nGO_URLDIR=https://golang.org/dl\nGO_VERSION=1.24.1\nGOLANG_URL=$GO_URLDIR/go$GO_VERSION.linux-"
},
{
"path": "demo/lib/host.bash",
"chars": 11301,
"preview": "source \"$(dirname \"${BASH_SOURCE[0]}\")/command.bash\"\n\nHOST_PROMPT=${HOST_PROMPT-\"\\e[38;5;11mhost>\\e[0m \"}\nHOST_LIB_DIR=\""
},
{
"path": "demo/lib/numactlH2numajson.py",
"chars": 11025,
"preview": "#!/usr/bin/env python3\n\n\"\"\"numactlH2numajson - convert numactl -H output to numajson\n\nExample:\n numactl -H | numactlH2n"
},
{
"path": "demo/lib/topology.py",
"chars": 16526,
"preview": "#!/usr/bin/env python3\n\n\"\"\"topology.py - topology utility\n\nUsage: topology.py [options] command\n\nOptions:\n -t TOPOLOGY_"
},
{
"path": "demo/lib/topology2qemuopts.py",
"chars": 17896,
"preview": "#!/usr/bin/env python3\n\n\"\"\"topology2qemuopts - convert NUMA node list from JSON to Qemu options\n\nNUMA node group definit"
},
{
"path": "demo/lib/vm.bash",
"chars": 39630,
"preview": "# shellcheck disable=SC1091\n# shellcheck source=command.bash\nsource \"$(dirname \"${BASH_SOURCE[0]}\")/command.bash\"\n# shel"
},
{
"path": "dockerfiles/cross-build/Dockerfile.debian-11",
"chars": 814,
"preview": "# pull in base + a minimal set of useful packages\nFROM debian:bullseye as debian-11-build\n\nARG GO_VERSION=x.yz\nARG GOLIC"
},
{
"path": "dockerfiles/cross-build/Dockerfile.debian-12",
"chars": 814,
"preview": "# pull in base + a minimal set of useful packages\nFROM debian:bookworm as debian-11-build\n\nARG GO_VERSION=x.yz\nARG GOLIC"
},
{
"path": "dockerfiles/cross-build/Dockerfile.debian-sid",
"chars": 810,
"preview": "# pull in base + a minimal set of useful packages\nFROM debian:sid as debian-sid-build\n\nARG GO_VERSION=x.yz\nARG GOLICENSE"
},
{
"path": "dockerfiles/cross-build/Dockerfile.fedora",
"chars": 669,
"preview": "# pull in base + a minimal set of useful packages\nFROM fedora:latest as fedora-build\n\nARG GO_VERSION=x.yz\nARG GOLICENSES"
},
{
"path": "dockerfiles/cross-build/Dockerfile.opensuse-leap-15.6",
"chars": 656,
"preview": "# pull in base + a minimal set of useful packages\nFROM opensuse/leap:15.6 as suse-15.6-build\n\nARG GO_VERSION=x.yz\nARG GO"
},
{
"path": "dockerfiles/cross-build/Dockerfile.ubuntu-18.04",
"chars": 814,
"preview": "# pull in base + a minimal set of useful packages\nFROM ubuntu:18.04 as ubuntu-18.04-build\n\nARG GO_VERSION=x.yz\nARG GOLIC"
},
{
"path": "dockerfiles/cross-build/Dockerfile.ubuntu-20.04",
"chars": 861,
"preview": "# pull in base + a minimal set of useful packages\nFROM ubuntu:20.04 as ubuntu-20.04-build\n\nARG GO_VERSION=x.yz\nARG GOLIC"
},
{
"path": "dockerfiles/cross-build/Dockerfile.ubuntu-22.04",
"chars": 861,
"preview": "# pull in base + a minimal set of useful packages\nFROM ubuntu:22.04 as ubuntu-22.04-build\n\nARG GO_VERSION=x.yz\nARG GOLIC"
},
{
"path": "dockerfiles/cross-build/Dockerfile.ubuntu-24.04",
"chars": 981,
"preview": "# pull in base + a minimal set of useful packages\nFROM ubuntu:24.04 as ubuntu-24.04-build\n\nARG GO_VERSION=x.yz\nARG GOLIC"
},
{
"path": "docs/Dockerfile",
"chars": 400,
"preview": "FROM sphinxdoc/sphinx:5.3.0\n\nRUN apt-get update && apt-get install -y wget git\n\n# Note: Any golang version that can 'go "
},
{
"path": "docs/_templates/layout.html",
"chars": 1196,
"preview": "{%- extends \"!layout.html\" %}\n\n{% block footer %}\n {% if versions_menu %}\n <div class=\"rst-versions\" data-toggle=\"rs"
},
{
"path": "docs/conf.py",
"chars": 10865,
"preview": "# Configuration file for the Sphinx documentation builder.\n#\n# This file only contains a selection of the most common op"
},
{
"path": "docs/contributing.md",
"chars": 486,
"preview": "# Contributing\n\nPlease use the GitHub\\* infrastructure for contributing to\nCRI Resource Manager.\nUse [pull requests](htt"
},
{
"path": "docs/demos/blockio.md",
"chars": 720,
"preview": "# Block I/O Demo\n\nThis demo creates a virtual machine for a single-node Kubernetes\\*\ncluster where container runtime fea"
},
{
"path": "docs/demos/index.rst",
"chars": 55,
"preview": "Demos\n#####\n.. toctree::\n :maxdepth: 1\n\n blockio.md\n\n"
},
{
"path": "docs/developers-guide/architecture.md",
"chars": 13981,
"preview": "# Architecture\n\n## Overview\n\nCRI Resource Manager (CRI-RM) is a pluggable add-on for controlling how much\nand which reso"
},
{
"path": "docs/developers-guide/cri-test.md",
"chars": 399,
"preview": "# CRI Validation\n\n[This test](/test/critest) runs\n[`critest`](https://github.com/kubernetes-sigs/cri-tools/blob/master/d"
},
{
"path": "docs/developers-guide/e2e-test.md",
"chars": 6937,
"preview": "# End-to-End tests\n\n## Prerequisites\n\nInstall:\n- `docker`\n- `govm` v0.95\n In case of errors in building `govm` with `go"
},
{
"path": "docs/developers-guide/index.rst",
"chars": 127,
"preview": "Developer's Guide\n#################\n.. toctree::\n :maxdepth: 1\n\n architecture.md\n policy-writers-guide.md\n testi"
},
{
"path": "docs/developers-guide/policy-writers-guide.md",
"chars": 48,
"preview": "# Policy Writer's Guide\n\n***WORK IN PROGRESS***\n"
},
{
"path": "docs/developers-guide/testing.rst",
"chars": 93,
"preview": "Testing\n#######\n\n.. toctree::\n :maxdepth: 1\n\n unit-test.md\n cri-test.md\n e2e-test.md\n"
},
{
"path": "docs/developers-guide/unit-test.md",
"chars": 53,
"preview": "# Unit tests\n\nRun unit tests with\n```\nmake test\n```\n\n"
},
{
"path": "docs/index.html",
"chars": 65,
"preview": "<meta http-equiv=\"refresh\" content=\"0; URL='docs/index.html'\" />\n"
},
{
"path": "docs/index.rst",
"chars": 533,
"preview": ".. CRI Resource Manager documentation master file\n\nWelcome to CRI Resource Manager's documentation!\n===================="
},
{
"path": "docs/installation.md",
"chars": 3221,
"preview": "# Installation\n\n## Installing from packages\n\nYou can install CRI Resource Manager from `deb` or `rpm` packages\nfor suppo"
},
{
"path": "docs/introduction.md",
"chars": 1125,
"preview": "# Introduction\n\nCRI Resource Manager is a Container Runtime Interface Proxy. It sits between\nclients and the actual Cont"
},
{
"path": "docs/migration-to-NRI.md",
"chars": 8034,
"preview": "# Migrating from CRI-RM to NRI\n\n## Prerequisities\n\n- Up and running CRI Resource Manager\n- One of the two supported poli"
},
{
"path": "docs/node-agent.md",
"chars": 2364,
"preview": "# Node Agent\n\nCRI Resource Manager can be configured dynamically using the CRI Resource\nManager Node Agent and Kubernete"
},
{
"path": "docs/policy/balloons.md",
"chars": 9833,
"preview": "# Balloons Policy\n\n## Overview\n\nThe balloons policy implements workload placement into \"balloons\" that\nare disjoint CPU "
},
{
"path": "docs/policy/blockio.md",
"chars": 502,
"preview": "# Block IO\n\n## Overview\n\nBlock IO controller provides means to control\n- block device IO scheduling priority (weight)\n- "
},
{
"path": "docs/policy/container-affinity.md",
"chars": 10038,
"preview": "# Container Affinity and Anti-Affinity\n\n## Introduction\n\nSome policies allow the user to give hints about how particular"
},
{
"path": "docs/policy/cpu-allocator.md",
"chars": 2704,
"preview": "# CPU Allocator\n\nCRI Resource Manager has a separate CPU allocator component that helps policies\nmake educated allocatio"
},
{
"path": "docs/policy/dynamic-pools.md",
"chars": 6875,
"preview": "# Dynamic-Pools Policy\n\n## Overview\n\nThe dynamic-pools policy can put the workload into different dynamic-pools. Each dy"
},
{
"path": "docs/policy/index.rst",
"chars": 207,
"preview": "Policies\n########\n\n.. toctree::\n :maxdepth: 1\n\n topology-aware.md\n static-pools.md\n balloons.md\n podpools.md\n "
},
{
"path": "docs/policy/podpools.md",
"chars": 3029,
"preview": "# Podpools Policy\n\n## Overview\n\nThe podpools policy implements pod-level workload placement. It\nassigns all containers o"
},
{
"path": "docs/policy/rdt.md",
"chars": 7018,
"preview": "# RDT (Intel® Resource Director Technology)\n\n## Background\n\nIntel® RDT provides capabilities for cache and memory alloca"
},
{
"path": "docs/policy/static-pools.md",
"chars": 7866,
"preview": "# Static-Pools (STP) Policy\n\n## Overview\n\nThe `static-pools` (STP) builtin policy was inspired by [CMK (CPU Manager for\n"
},
{
"path": "docs/policy/topology-aware.md",
"chars": 19920,
"preview": "# Topology-Aware Policy\n\n## Background\n\nOn server-grade hardware the CPU cores, I/O devices and other peripherals\nform a"
},
{
"path": "docs/quick-start.md",
"chars": 2993,
"preview": "# Quick-start\n\nThe following describes the minimum number of steps to get started with CRI\nResource Manager.\n\n## Pre-req"
},
{
"path": "docs/reference/agent-command-line-reference.md",
"chars": 66,
"preview": "# CRI-Resmgr-Agent Command-line Reference\n\n***WORK IN PROGRESS***\n"
},
{
"path": "docs/reference/configuration-reference.md",
"chars": 1169,
"preview": "# Configuration Reference\n\n## Configuration file\n\n***WORK IN PROGRESS***\n\n### `policy`\n\n**Active** specifies the active "
},
{
"path": "docs/reference/index.rst",
"chars": 151,
"preview": "Reference\n#########\n.. toctree::\n :maxdepth: 1\n\n resmgr-command-line-reference.md\n agent-command-line-reference.md"
},
{
"path": "docs/reference/resmgr-command-line-reference.md",
"chars": 60,
"preview": "# CRI-Resmgr Command-line Reference\n\n***WORK IN PROGRESS***\n"
},
{
"path": "docs/releases/conf.py",
"chars": 2398,
"preview": "# Configuration file for the Sphinx documentation builder.\n#\n# This file only contains a selection of the most common op"
},
{
"path": "docs/releases/index.md",
"chars": 768,
"preview": "# Releases\n\nFor up-to-date user documentation see the [documentation site](/cri-resource-manager)\n\n## Documentation for "
},
{
"path": "docs/requirements.txt",
"chars": 91,
"preview": "sphinx==5.3.0\nsphinx_rtd_theme\nmyst-parser==0.18.1\nsphinx-markdown-tables\nPygments==2.15.1\n"
},
{
"path": "docs/security.md",
"chars": 137,
"preview": "# Reporting a Potential Security Vulnerability\n\nPlease visit [intel.com/security](https://intel.com/security) to report\n"
},
{
"path": "docs/setup.md",
"chars": 15252,
"preview": "# Setup and Usage\n\nIf you want to give CRI Resource Manager a try, here is the list of things\nyou need to do, assuming y"
},
{
"path": "docs/webhook.md",
"chars": 2797,
"preview": "# Webhook\n\nBy default, CRI Resource Manager does not see the original container\n*resource requirements* specified in the"
},
{
"path": "elf/avx512.c",
"chars": 4022,
"preview": "#include <uapi/linux/bpf.h>\n#include <asm/page_types.h>\n#include <asm/fpu/types.h>\n\n#define SEC(NAME) __attribute__((sec"
},
{
"path": "go.mod",
"chars": 4670,
"preview": "module github.com/intel/cri-resource-manager\n\ngo 1.24\n\nrequire (\n\tcontrib.go.opencensus.io/exporter/jaeger v0.2.1\n\tcontr"
},
{
"path": "go.sum",
"chars": 63120,
"preview": "cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=\ncloud.google.com/go v0.34.0/go.mod h1"
},
{
"path": "packaging/deb.in/changelog",
"chars": 151,
"preview": "__PACKAGE__ (__VERSION__) unstable; urgency=low\n\n * Release build of __PACKAGE__ __VERSION__ for debian/ubuntu.\n\n -- __"
},
{
"path": "packaging/deb.in/compat",
"chars": 3,
"preview": "11\n"
},
{
"path": "packaging/deb.in/control",
"chars": 152,
"preview": "Source: __PACKAGE__\nMaintainer: __AUTHOR__ <__EMAIL__>\n\nPackage: __PACKAGE__\nArchitecture: any\nDescription: A CRI Proxy "
},
{
"path": "packaging/deb.in/rules",
"chars": 701,
"preview": "#!/usr/bin/make -f\n#-*- make -*-\n\nDISTRIBUTION = $(shell sed -n \"s/^VERSION_CODENAME=//p\" /etc/os-release)\nVERSION = __V"
},
{
"path": "packaging/rpm/cri-resource-manager.spec.in",
"chars": 1201,
"preview": "Name: cri-resource-manager\nVersion: __VERSION__\nRelease: 0\nSummary: CRI Resource Manager, a CRI proxy with various in"
},
{
"path": "pkg/agent/agent.go",
"chars": 3973,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/agent/api/v1/api.go",
"chars": 1050,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/agent/api/v1/api.pb.go",
"chars": 22736,
"preview": "//\n//Copyright 2019 Intel Corporation\n//\n//Licensed under the Apache License, Version 2.0 (the \"License\");\n//you may not"
},
{
"path": "pkg/agent/api/v1/api.proto",
"chars": 1536,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/agent/api/v1/api_grpc.pb.go",
"chars": 7658,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc "
},
{
"path": "pkg/agent/api/v1/constants.go",
"chars": 692,
"preview": "/*\nCopyright Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this fil"
},
{
"path": "pkg/agent/config-updater.go",
"chars": 5941,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/agent/flags.go",
"chars": 1709,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/agent/kubernetes.go",
"chars": 8219,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/agent/server.go",
"chars": 5210,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/agent/watcher.go",
"chars": 14495,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/apis/resmgr/expression.go",
"chars": 7743,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/expression_test.go",
"chars": 11030,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/clientset.go",
"chars": 3168,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/doc.go",
"chars": 746,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/fake/clientset_generated.go",
"chars": 2944,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/fake/doc.go",
"chars": 746,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/fake/register.go",
"chars": 1974,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/scheme/doc.go",
"chars": 762,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/scheme/register.go",
"chars": 1976,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/adjustment.go",
"chars": 6354,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/doc.go",
"chars": 749,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/fake/doc.go",
"chars": 739,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/fake/fake_adjustment.go",
"chars": 5267,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/fake/fake_resmgr_client.go",
"chars": 1283,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/generated_expansion.go",
"chars": 724,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/clientset/versioned/typed/resmgr/v1alpha1/resmgr_client.go",
"chars": 2638,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/informers/externalversions/factory.go",
"chars": 6531,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/informers/externalversions/generic.go",
"chars": 2079,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/informers/externalversions/internalinterfaces/factory_interfaces.go",
"chars": 1507,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/informers/externalversions/resmgr/interface.go",
"chars": 1737,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/informers/externalversions/resmgr/v1alpha1/adjustment.go",
"chars": 3793,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/informers/externalversions/resmgr/v1alpha1/interface.go",
"chars": 1656,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/listers/resmgr/v1alpha1/adjustment.go",
"chars": 3350,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/generated/listers/resmgr/v1alpha1/expansion_generated.go",
"chars": 975,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/v1alpha1/adjustment-schema.yaml",
"chars": 2586,
"preview": "apiVersion: apiextensions.k8s.io/v1\nkind: CustomResourceDefinition\nmetadata:\n name: adjustments.criresmgr.intel.com\nspe"
},
{
"path": "pkg/apis/resmgr/v1alpha1/adjustment.go",
"chars": 8336,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/v1alpha1/doc.go",
"chars": 703,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/v1alpha1/register.go",
"chars": 1551,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/v1alpha1/types.go",
"chars": 2948,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/apis/resmgr/v1alpha1/zz_generated.deepcopy.go",
"chars": 6343,
"preview": "//go:build !ignore_autogenerated\n// +build !ignore_autogenerated\n\n// Copyright 2019-2020 Intel Corporation. All Rights R"
},
{
"path": "pkg/avx/collector.go",
"chars": 9856,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/avx/elfdump.go",
"chars": 1760,
"preview": "//go:build ignore\n// +build ignore\n\n/*\nCopyright 2020 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 "
},
{
"path": "pkg/avx/register.go",
"chars": 879,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/blockio/blockio.go",
"chars": 13975,
"preview": "/*\nCopyright 2020 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/blockio/blockio_test.go",
"chars": 9060,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/blockio/config.go",
"chars": 1572,
"preview": "/*\nCopyright 2020 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/cgroups/cgroupblkio.go",
"chars": 13102,
"preview": "// Copyright 2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cgroups/cgroupblkio_test.go",
"chars": 16028,
"preview": "// Copyright 2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cgroups/cgroupcontrol.go",
"chars": 5831,
"preview": "// Copyright 2020-2021 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/cgroups/cgroupid.go",
"chars": 1405,
"preview": "package cgroups\n\nimport (\n\t\"encoding/binary\"\n\t\"fmt\"\n\t\"os\"\n\t\"path/filepath\"\n\t\"sync\"\n\n\t\"golang.org/x/sys/unix\"\n)\n\n// Cgrou"
},
{
"path": "pkg/cgroups/cgrouppath.go",
"chars": 2954,
"preview": "// Copyright 2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cgroups/cgroupstats.go",
"chars": 12252,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cgroupstats/collector.go",
"chars": 11049,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/config/config.go",
"chars": 12264,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/config/data.go",
"chars": 3820,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/config/duration.go",
"chars": 1396,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/config/error.go",
"chars": 833,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/config/help.go",
"chars": 3250,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/config/log.go",
"chars": 2862,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/config/options.go",
"chars": 1897,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cpuallocator/allocator.go",
"chars": 18333,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cpuallocator/cpuallocator_test.go",
"chars": 2890,
"preview": "// Copyright 2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/client/client.go",
"chars": 15524,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/client/v1/client.go",
"chars": 11080,
"preview": "// Copyright Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\""
},
{
"path": "pkg/cri/relay/image-service.go",
"chars": 1492,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/relay/relay.go",
"chars": 5775,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/relay/runtime-service.go",
"chars": 8696,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/agent/agent.go",
"chars": 10557,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/cri/resource-manager/builtin-policies.go",
"chars": 1492,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/affinity.go",
"chars": 7226,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/affinity_test.go",
"chars": 3747,
"preview": "// Copyright 2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/cache.go",
"chars": 51268,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/cache_test.go",
"chars": 11592,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/container.go",
"chars": 26403,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/container_test.go",
"chars": 4120,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/error.go",
"chars": 759,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/pod.go",
"chars": 14027,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/cache/utils.go",
"chars": 6989,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/config/api/v1/api.pb.go",
"chars": 15713,
"preview": "//\n//Copyright 2019 Intel Corporation\n//\n//Licensed under the Apache License, Version 2.0 (the \"License\");\n//you may not"
},
{
"path": "pkg/cri/resource-manager/config/api/v1/api.proto",
"chars": 1510,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/cri/resource-manager/config/api/v1/api_grpc.pb.go",
"chars": 4975,
"preview": "// Code generated by protoc-gen-go-grpc. DO NOT EDIT.\n// versions:\n// - protoc-gen-go-grpc v1.2.0\n// - protoc "
},
{
"path": "pkg/cri/resource-manager/config/config.go",
"chars": 1672,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/cri/resource-manager/config/server.go",
"chars": 4564,
"preview": "/*\nCopyright 2019 Intel Corporation\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use thi"
},
{
"path": "pkg/cri/resource-manager/control/blockio/blockio.go",
"chars": 5333,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/control/control.go",
"chars": 8015,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/control/cpu/api.go",
"chars": 2200,
"preview": "// Copyright 2022 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/control/cpu/cache.go",
"chars": 1776,
"preview": "// Copyright 2022 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/control/cpu/cpu.go",
"chars": 9572,
"preview": "// Copyright 2022 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/control/cri/cri.go",
"chars": 4310,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/control/flags.go",
"chars": 3143,
"preview": "// Copyright 2019 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
},
{
"path": "pkg/cri/resource-manager/control/memory/memory.go",
"chars": 4546,
"preview": "// Copyright 2019-2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the"
},
{
"path": "pkg/cri/resource-manager/control/page-migrate/demoter.go",
"chars": 17244,
"preview": "// Copyright 2020 Intel Corporation. All Rights Reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"Lic"
}
]
// ... and 355 more files (download for full content)
About this extraction
This page contains the full source code of the intel/cri-resource-manager GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 555 files (2.2 MB), approximately 621.4k tokens, and a symbol index with 3268 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.