Commit Graph

26 Commits

Author SHA1 Message Date
Ian K. Coolidge
22d3f67850 cpuset: Fix Parse() error message for n-k s.t. k<n
This case is tested extensively in cpuset_test.go, but the error message
needs a small adjustmnet.
2023-02-21 04:51:14 +00:00
Ian K. Coolidge
5533e49e2c cpuset: Add package comment
Describe use cases (node IDs, HT siblings, etc)

Call out novelty (Linux CPU list parse/dump)

Describe future work (relax immutable, refactor to use 'set')
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
cbb985a310 cpuset: Delete 'builder' methods
All usage of builder pattern is convertible to cpuset.New()
with the same or fewer lines of code.

Migrate Builder.Add to a private method of CPUSet, with a comment
that it is only intended for internal use to preserve immutable
propoerty of the exported interface.

This also removes 'require' library dependency, which avoids
non-standard library usage.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
f3829c4be3 cpuset: Rename 'NewCPUSet' to 'New' 2023-01-06 23:32:51 +00:00
Ian K. Coolidge
768b1ecfb6 cpuset: hide 'Filter' API
FilterNot is only used in this file, and is trivially converted to a
'filter' call site by inverting the predicate.

Filter is only used in this file, so don't export it.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
e5143d16c2 cpuset: Make 'ToSlice*' methods look like 'set' methods
In 'set', conversions to slice are done also, but with different names:

ToSliceNoSort() -> UnsortedList()
ToSlice() -> List()

Reimplement List() in terms of UnsortedList to save some duplication.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
a0c989b99a cpuset: Remove *Int64 methods
These are rarely used and can be accommodated with a trivial helper.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
67a057d4f2 cpuset: Remove 'MustParse' method
Removes exit/fatal from cpuset library.

Usage in podresources test was not necessary.

Library reference in cpu_manager_test was moved to a local function, and
converted to use e2e test framework error catching.
2023-01-06 23:32:51 +00:00
Ian K. Coolidge
824bd57ad6 cpuset: Convert Union arguments to variadic
This allows Union to implement UnionAll easily.
2023-01-06 23:32:50 +00:00
jesse.tang
759e043136
Optimize: file /cpuset slice make cap (#112270) 2022-09-30 16:56:25 -07:00
chymy
5374f6fad8 Fix comment typo
Signed-off-by: chymy <chang.min1@zte.com.cn>
2022-03-14 16:53:29 +08:00
tiloso
2b86541313 Fix staticcheck failure in pkg/kubelet/cm/cpuset 2021-08-26 08:50:08 +02:00
Frame
9255f2ccf3
Fix kubelet cpuset typo 2021-06-10 18:17:04 +08:00
Jim Ramsay
a21179ae69 cpuset.Parse: Fix edge cases and add negative tests
The cpuset.Parse function missed a couple bad input cases, specifically
"1--3" and "10-6".  These were silently ignored when they should instead
be flagged as invalid.

This now catches these cases and expands the unit tests for cpuset to
cover them (and other negative test cases as well).

Signed-off-by: Jim Ramsay <jramsay@redhat.com>
2021-05-11 11:05:38 -04:00
Kubernetes Prow Robot
21de277402
Merge pull request #100007 from utsavoza/ugo/issue-98976/09-03-2021
Migrate remaining pkg/kubelet/cm/ top level files to structured logging
2021-03-16 14:50:14 -07:00
Utsav Oza
13513f9762 Migrate pkg/kubelet/cm/ top level files to structured logging 2021-03-09 23:15:24 +05:30
Francesco Romani
9c69db3f04 e2e: node: add tests for GetAllocatableResources
Add e2e tests for the new GetAllocatableResources API.
The tests are added in the `podresources_test` suite
created previously in this series.

Signed-off-by: Francesco Romani <fromani@redhat.com>
2021-03-09 13:13:36 +01:00
Artyom Lukianov
69db36b958 Provide additional methods under the CPUSet
- ToSliceInt64 returns sorted slice of cores IDs in int64 format
- ToSliceNoSortInt64 returns slice of cores IDs in int64 format

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-01-20 13:21:57 +02:00
Davanum Srinivas
442a69c3bd
switch over k/k to use klog v2
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2020-05-16 07:54:27 -04:00
Kubernetes Prow Robot
b276043051
Merge pull request #77421 from tedyu/cpu-free-no-sort
Obtain unsorted slice in cpuAccumulator#freeCores
2019-05-16 16:26:53 -07:00
Ted Yu
e967c37068 Union all CPUSets in one round 2019-05-03 14:40:33 -07:00
Ted Yu
f83bac61a4 Obtain unsorted slice in cpuAccumulator#freeCores 2019-05-03 14:07:47 -07:00
Davanum Srinivas
954996e231
Move from glog to klog
- Move from the old github.com/golang/glog to k8s.io/klog
- klog as explicit InitFlags() so we add them as necessary
- we update the other repositories that we vendor that made a similar
change from glog to klog
  * github.com/kubernetes/repo-infra
  * k8s.io/gengo/
  * k8s.io/kube-openapi/
  * github.com/google/cadvisor
- Entirely remove all references to glog
- Fix some tests by explicit InitFlags in their init() methods

Change-Id: I92db545ff36fcec83afe98f550c9e630098b3135
2018-11-10 07:50:31 -05:00
Connor Doyle
515d86faa0 Add CPUSetBuilder, make CPUSet immutable. 2017-08-22 22:33:04 -07:00
Connor Doyle
e686ecb6ea Renamed CPUSet.AsSlice() => CPUSet.ToSlice() 2017-08-22 21:21:26 -07:00
Connor Doyle
8f38abb350 Add cpuset helper library. 2017-08-22 11:42:01 -07:00