Commit Graph

97638 Commits

Author SHA1 Message Date
Artyom Lukianov
102124464a memory manager: improve the reserved memory validation logic
We will have two layers of the validation.

- the first part of the validation logic will be implemented under the
`ValidateKubeletConfiguration` method
- the second one that requires knowledge about machine topology and
node allocatable resources will be implemented under the memory manager.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:02 +02:00
Artyom Lukianov
932134034c memory manager: update API constant to have camel case format
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:02 +02:00
Artyom Lukianov
e8ea461bfd memory manager: update all relevant part of code to use []MemoryReservation
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:01 +02:00
Artyom Lukianov
7561a0f96e memory manager: provide new flag var to parse reserved-memory parameter
The new flag will parse the `--reserved-memory` flag straight forward
to the []kubeletconfig.MemoryReservation variable instead of parsing
it to the middle map representation.

It gives us possibility to get rid of a lot of unneeded code and use the single
presentation for the reserved-memory.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:01 +02:00
Artyom Lukianov
b7cfc40deb memory manager: update kubelet config API
Update kubelet config API to use slice of MemoryReservation
structs instead of slice of maps.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:01 +02:00
Artyom Lukianov
0fa5dd5532 memory manager: move the fakeTopologyManagerWithHint
Move the fakeTopologyManagerWithHint and all related methods
from the topology manager package to the memory manager static policy unittests.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:01 +02:00
Artyom Lukianov
d0089db2ec memory manager: remove unused variable under stateCheckpoint 2021-02-09 01:10:01 +02:00
Artyom Lukianov
ff2a110920 memory manager: provide the new type to contain resources for each NUMA node
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:00 +02:00
Artyom Lukianov
74eeef2a0a memory manager: provide additional e2e tests
With the memory manager static policy:

- start multiple guaranteed pods and verify that pods succeeded to start
- start workload pod on each NUMA node to load the memory and start the
  pod that requested more memory than each NUMA node have, the pod should fail
  to start with the admission error, because no single NUMA node has enough
  memory to start the pod and also each NUMA node already used for single
  NUMA node allocation
  The test requires at least two NUMA nodes

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:00 +02:00
Pawel Rapacz
606fea29f5 memory manager: add e2e test to run guaranteed pod with init containers
Signed-off-by: Pawel Rapacz <p.rapacz@partner.samsung.com>
2021-02-09 01:10:00 +02:00
Artyom Lukianov
f3d4ac2f7e memory manager: add basice e2e tests
Provides basic tests e2e to verify that pod succeeds
to start with MemoryManager enabled.

Verifies both MemoryManager policies and when the node has
multiple NUMA nodes it will verify the memory pinning.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:00 +02:00
Artyom Lukianov
a015e4163f memory manager: rename state structs and fields
The commit rename state structs and some fields under these structs.

- NodeMap -> NUMANodeMap
- NodeState -> NUMANodeState
- NUMANodeState.Nodes -> NUMANodesState.Cells

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:00 +02:00
Artyom Lukianov
aa63e5aed2 memory manager: provide an additional validation for reserved memory
Calculate the total amount of reserved memory only for NUMA nodes
that are existing under the machine.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:00 +02:00
Artyom Lukianov
27c5efe8ec memory manager: fix scheme unit test
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:10:00 +02:00
Artyom Lukianov
24be74e759 memory manager: update bazel files
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:09:59 +02:00
Artyom Lukianov
f7845ed4e9 memory manager: provide memory manager static policy unittests
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:09:59 +02:00
Krzysztof Wiatrzyk
d7175a831c memory manager: adding Memory Manager component unit tests
Signed-off-by: Krzysztof Wiatrzyk <k.wiatrzyk@samsung.com>
2021-02-09 01:09:59 +02:00
Pawel Rapacz
18c8a821e0 memory manager: implement GetPodTopologyHints method
It will return memory and hugepages hints for the whole pod.

Signed-off-by: Pawel Rapacz <p.rapacz@partner.samsung.com>
2021-02-09 01:09:59 +02:00
Artyom Lukianov
abb94bec51 memory manager: implement the memory manager static policy
- The `Allocate` method will try to allocate the memory according to the affinity hints
  saved under the `TopologyManager` store. If the store does not have any hints for the memory
  it will call `getDefaultHint` to get the default hint. If the affinity does not satisfy
  the memory request, it will call `extendTopologyManagerHint` to extend the topology hint to
  satisfy the memory request. Once it has the preferred hint, it will allocate the memory and
  update the the memory manager state accordingly.

- The `RemoveContainer` will release the allocated memory and update the memory manager state accordingly.

- The `GetTopologyHints` method will try to re-generate topology hints when the container already presents
  under the memory manager state. If it does not present it will call `calculateHints` to get topology hints.
  The `calculateHints` uses an approach similar to the one used under the CPU manager:
  1. If the container memory request can be satisfied by the single NUMA node, it will not allocate the memory from
     more than one NUMA node and it will set only single NUMA hints as the preferred one.
     It can affect the density, but it gives us guarantees regarding the NUMA alignment.
  2. The NUMA node used in the multi NUMA assignment can not be used in the single NUMA assignment.
     And the NUMA node used in the single NUMA assignment can not be used in the multi NUMA assignment.
  3. Only hints with NUMA node that have enough memory will be returned.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:09:59 +02:00
Artyom Lukianov
371c918e6c memory manager: add memory manager policy to defaulter and conversion files
Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:09:59 +02:00
Artyom Lukianov
afb1ae3458 memory manager: add fake memory manager
The fake memory manager needed for the unittesting.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 01:09:59 +02:00
Cezary Zukowski
4a64102918 memory manager: validate reserved-memory against Node Allocatable
Reserved memory of all kinds (and over all
NUMA nodes) must be equal to the values determined
by Node Allocatable feature.

Signed-off-by: Cezary Zukowski <c.zukowski@samsung.com>
2021-02-09 00:54:58 +02:00
Krzysztof Wiatrzyk
711e85af24 memory manager: adding additional tests for server.go file, for parseReservedMemoryConfig() function. 2021-02-09 00:54:58 +02:00
Artyom Lukianov
9ae499ae46 memory manager: pass memory manager flags to the container manager
Pass memory manager flags to the container manager and call all relevant memory manager
methods under the container manager.

Signed-off-by: Byonggon Chun <bg.chun@samsung.com>
2021-02-09 00:54:58 +02:00
Artyom Lukianov
93accb51e4 memory manager: add memory manager flag under kubelet options and kubelet config
The commit also includes generated files after `make generated_files`.

Signed-off-by: Byonggon Chun <bg.chun@samsung.com>
2021-02-09 00:54:58 +02:00
Artyom Lukianov
b95d45e803 memory manager: add new flag type BracketSeparatedSliceMapStringString
Add BracketSeparatedSliceMapStringString to parse config like the below
{numa-node=0,type=memory,limit=1Gi},{numa-node=1,type=memory,limit=1Gi}

Signed-off-by: Byonggon Chun <bg.chun@samsung.com>
2021-02-09 00:54:58 +02:00
Artyom Lukianov
95f81372e2 memory manager: implement the manager interface methods
The commit adds implementation for methods:
- Start
- AddContainer
- Allocate
- RemoveContainer
- State
- GetTopologyHints

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 00:54:58 +02:00
Artyom Lukianov
d0caec90e2 memory manager: add the policy interface
The commit also adds two policy skeletons:
- none
- static

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 00:54:58 +02:00
Artyom Lukianov
86df524948 memory manager: provide unittest for the state package
The commit includes tests to verify the functionallity:
- to restore state from the file
- to store the state to the file
- to clean the state from old data

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 00:54:58 +02:00
Artyom Lukianov
48ca6e53e6 memory manager: provide and use the checkpoint manager
The checkpoint manager provides a way to save the memory manager
`MemoryTable` both under the memory and under the state file.

Saving the `MemoryTable` under the state file can be useful when kubelet
restarted and you want to restore memory allocations for running containers.
Also, it provides a way to monitor memory allocations done by the memory manager,
and in the future, the state file content can be exposed under the pod metrics.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 00:54:58 +02:00
Artyom Lukianov
4c75be0604 memory manager: provide the skeleton for the memory manager
Provide memory manager struct and methods that should be implemented.

Signed-off-by: Artyom Lukianov <alukiano@redhat.com>
2021-02-09 00:54:58 +02:00
Kubernetes Prow Robot
f266f60da9
Merge pull request #98839 from Mattias-/kubeadm-fix-config-print-placeholder
kubeadm: Fix placeholder in config print help text
2021-02-08 11:54:43 -08:00
Kubernetes Prow Robot
d11e475b9b
Merge pull request #98770 from pohly/e2e-mock-container-versions
test: bump CSI container versions for mock testing
2021-02-08 10:45:37 -08:00
Kubernetes Prow Robot
0867767d6e
Merge pull request #98882 from kvaps/flatten-adminconfig
kubeadm: flatten admin.conf for cluster-info generation
2021-02-08 09:26:28 -08:00
Andrei Kvapil
9de0b2bf46
kubeadm: flatten admin.conf for cluster-info 2021-02-08 17:22:01 +01:00
Kubernetes Prow Robot
74e5080b0e
Merge pull request #97251 from navidshaikh/pr/fix-68026-test-e2e-common
Fix golint errors in test/e2e/common
2021-02-08 08:11:47 -08:00
Navid Shaikh
2e63bad5a3 Fix golint errors in test/e2e/common
- Add comments for exported types
 - Replace Uid with UID
2021-02-08 10:47:41 +05:30
Kubernetes Prow Robot
97d40890d0
Merge pull request #98802 from dabaooline/fix-ignorederr
fix ignored podinfo parserr
2021-02-07 17:53:11 -08:00
Kubernetes Prow Robot
15a8a8ec4a
Merge pull request #97738 from knabben/deny-all-ns
Default DENY all egress from pods in the namespace
2021-02-07 12:37:12 -08:00
Kubernetes Prow Robot
fc7b785e64
Merge pull request #98818 from chewong/remove-duplicated-code
fix: remove duplicated code in image-util.sh due to merge conflict
2021-02-07 09:23:11 -08:00
Amim Knabben
189edf1e73 Default deny all egress from pods in the namespace 2021-02-07 11:55:50 -05:00
Kubernetes Prow Robot
23a46d8843
Merge pull request #97819 from damemi/bz1876918-priorities-test-refactor
Move deferred taint cleanup call to ensure all are removed
2021-02-06 21:37:12 -08:00
Kubernetes Prow Robot
425d29b39a
Merge pull request #98688 from wangkai1994/fix/pvc_protection_controller_log
migrate pkg/controller/volume/pvc_protection_controller.go to structured logs
2021-02-06 20:13:11 -08:00
Kubernetes Prow Robot
3534e31ade
Merge pull request #98834 from cpanato/go1158
[go1.15] Update to go1.15.8
2021-02-06 15:35:11 -08:00
Kubernetes Prow Robot
5fa704c6a8
Merge pull request #98836 from hasheddan/kubeadm-ci-k8s-infra
kubeadm: get k8s CI version markers from k8s infra bucket
2021-02-06 11:23:11 -08:00
Kubernetes Prow Robot
4db3c93af3
Merge pull request #98805 from cpanato/k8sio-GH-1525-csi
e2e/storage-csi: replace gcr.io/gke-release to the community registry k8s.gcr.io/sig-storage
2021-02-06 10:03:11 -08:00
Mattias Appelgren
7e80d4d191 kubeadm: Fix placeholder in config print help text 2021-02-06 18:32:45 +01:00
hasheddan
8ae6a20485
kubeadm: drop explicit constant override in version test
The k8s release bucket constant is not longer overriden in network tests
because the fetcher is mocked rather than using httptest.NewServer. See
previous implementation in
https://github.com/kubernetes/kubernetes/pull/49119/files#diff-82f2b09991047d4a1884d53dedadd64a473d5c4dc75293514e71773ceedf08e2R128

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2021-02-06 11:03:00 -06:00
hasheddan
1d164d0747
kubeadm: get k8s CI version markers from k8s infra bucket
Updates kubeadm version resolution to use kubernetes community infra
bucket to fetch appropriate k8s ci versions. The images are already
being pulled from the kubernetes community infra bucket meaning that a
mismatch can occur when the ci version is fetched from the google infra
bucket and the image is not yet present on k8s infra.

Follow-up to kubernetes/kubernetes#97087

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2021-02-06 10:59:15 -06:00
Carlos Panato
c2e90d8baf
[go1.15] Use go-runner:buster-v2.3.1 image (built on go1.15.8) 2021-02-06 15:58:12 +01:00