Commit Graph

2418 Commits

Author SHA1 Message Date
Michal Wozniak
4e732e20d0 Do not revert the pod condition if there might be running containers, skip condition update instead. 2022-11-07 16:22:29 +01:00
Kubernetes Prow Robot
3edbebe348
Merge pull request #110268 from danwinship/minimize-iptables-changes
minimize iptables-restore input
2022-11-01 18:06:46 -07:00
Kubernetes Prow Robot
4c657e5014
Merge pull request #110403 from claudiubelu/unittests-3
unittests: Fixes unit tests for Windows (part 3)
2022-10-31 15:52:44 -07:00
Kubernetes Prow Robot
36dd5f2846
Merge pull request #113191 from saltbo/refa-remove-unused-ipconfig
Remove the unused pkg/util/ipconfig
2022-10-23 19:22:25 -07:00
Claudiu Belu
9f95b7b18c unittests: Fixes unit tests for Windows (part 3)
Currently, there are some unit tests that are failing on Windows due to
various reasons:

- paths not properly joined (filepath.Join should be used).
- Proxy Mode IPVS not supported on Windows.
- DeadlineExceeded can occur when trying to read data from an UDP
  socket. This can be used to detect whether the port was closed or not.
- In Windows, with long file name support enabled, file names can have
  up to 32,767 characters. In this case, the error
  windows.ERROR_FILENAME_EXCED_RANGE will be encountered instead.
- files not closed, which means that they cannot be removed / renamed.
- time.Now() is not as precise on Windows, which means that 2
  consecutive calls may return the same timestamp.
- path.Base() will return the same path. filepath.Base() should be used
  instead.
- path.Join() will always join the paths with a / instead of the OS
  specific separator. filepath.Join() should be used instead.
2022-10-21 19:25:48 +03:00
saltbo
cc90e819bc
refactor: replace the ioutil by the os and io
Signed-off-by: saltbo <saltbo@foxmail.com>
2022-10-20 15:13:28 +08:00
saltbo
266404ec8c
refactor: remove the unused pkg/util/ipconfig
Signed-off-by: saltbo <saltbo@foxmail.com>
2022-10-20 14:21:42 +08:00
Amim Knabben
7df6c02288 Remove Linux and Windows Kube-proxy Userspace mode 2022-10-05 16:59:02 -03:00
Dan Winship
818de5a545 proxy/iptables: Add metric for partial sync failures, add test 2022-09-26 16:31:42 -04:00
Mengjiao Liu
1b9e4eb073 Improve test readability by fixing previous code variables that could easily be changed and
improve unit test coverage in `pkg/util/taints/taints_test.go`
2022-09-16 17:23:35 +08:00
Mengjiao Liu
3ee0eea45c Remove unused functions in pkg/util/taints/ 2022-09-14 11:13:03 +08:00
Kubernetes Prow Robot
baf6014e0c
Merge pull request #112182 from dcbw/pkg-util-ipset-sig-net-approvers
pkg/util/ipset: add sig-network to reviewers/approvers
2022-09-01 20:08:04 -07:00
Kubernetes Prow Robot
9924814270
Merge pull request #108460 from Nordix/issue-72236
Prevent host access on VIP addresses in proxy-mode=ipvs
2022-09-01 12:59:18 -07:00
Dan Williams
24cf5e51a5 pkg/util/ipset: add sig-network to reviewers/approvers
Signed-off-by: Dan Williams <dcbw@redhat.com>
2022-09-01 11:35:11 -05:00
Aaron Crickenberger
cb98449156 pkg/util/coverage: update fakeTestDeps impl
testing.testDeps has had more methods added so fakeTestDeps needs to
follow suit
2022-08-25 17:23:49 -07:00
lojies
89fdd8858b code cleanup: omit comparison to bool constant 2022-08-17 14:46:32 +08:00
Michal Wozniak
04fcbd721c Introduction of a pod condition type indicating disruption. Its reason field indicates the reason:
- PreemptionByKubeScheduler (Pod preempted by kube-scheduler)
- DeletionByTaintManager (Pod deleted by taint manager due to NoExecute taint)
- EvictionByEvictionAPI (Pod evicted by Eviction API)
- DeletionByPodGC (an orphaned Pod deleted by PodGC)PreemptedByScheduler (Pod preempted by kube-scheduler)
2022-08-02 11:12:16 +02:00
Davanum Srinivas
a9593d634c
Generate and format files
- Run hack/update-codegen.sh
- Run hack/update-generated-device-plugin.sh
- Run hack/update-generated-protobuf.sh
- Run hack/update-generated-runtime.sh
- Run hack/update-generated-swagger-docs.sh
- Run hack/update-openapi-spec.sh
- Run hack/update-gofmt.sh

Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2022-07-26 13:14:05 -04:00
jianfei.zhang
49e7a7b51d fix:handle error and remove Redundant type conversion
Signed-off-by: jianfei.zhang <jianfei.zhang@daocloud.io>
2022-07-19 11:30:46 +08:00
Kubernetes Prow Robot
a3f777603b
Merge pull request #110825 from zhoumingcheng/master-unit-v4
add unit test coverage for pkg/util/node and Remove duplicate testcases for func TestGetNodeHostIPs
2022-07-10 20:55:46 -07:00
zhoumingcheng
673930e384 update test func for pkg/util/node
Signed-off-by: zhoumingcheng <zhoumingcheng@beyondcent.com>
2022-07-07 10:45:45 +08:00
zhoumingcheng
509c487fe8 add unit test coverage for pkg/util/slice
Signed-off-by: zhoumingcheng <zhoumingcheng@beyondcent.com>
2022-06-30 15:21:37 +08:00
Kubernetes Prow Robot
0d9ed2c3e7
Merge pull request #110328 from danwinship/iptables-counters
Stop trying to "preserve" iptables counters that are always 0
2022-06-29 08:06:06 -07:00
Dan Winship
7c27cf0b9b Simplify iptables-save parsing
We don't need to parse out the counter values from the iptables-save
output (since they are always 0 for the chains we care about). Just
parse the chain names themselves.

Also, all of the callers of GetChainLines() pass it input that
contains only a single table, so just assume that, rather than
carefully parsing only a single table's worth of the input.
2022-06-28 08:39:32 -04:00
Dan Winship
4988699c2f Use dedent to fix GetChainLines() tests
The test was calling GetChainLines() on invalid pseudo-iptables-save
output where most of the lines were indented. GetChainLines() happened
to still parse this "correctly", but it would be better to be testing
it on actually-correct data.
2022-06-28 08:39:32 -04:00
zhoumingcheng
8dfb7af374 update unit test for pkg/util/node
Remove duplicate testcases for func TestGetNodeHostIPs

Signed-off-by: zhoumingcheng <zhoumingcheng@beyondcent.com>
2022-06-28 17:40:04 +08:00
zhoumingcheng
540ec51196 add unit test coverage for pkg/util/node
Signed-off-by: zhoumingcheng <zhoumingcheng@beyondcent.com>
2022-06-28 16:07:30 +08:00
21kyu
df168d5b5c Change reflect.Ptr to reflect.Pointer 2022-06-26 01:23:43 +09:00
Lars Ekman
c1e5a9e6f0 Prevent host access on VIP addresses in proxy-mode=ipvs 2022-06-24 08:33:58 +02:00
Kubernetes Prow Robot
dc4e91a875
Merge pull request #109844 from danwinship/iptables-tests-new
improve parsing in iptables unit tests
2022-06-10 14:27:44 -07:00
Dan Winship
913f4bc0ba pkg/util/iptables/testing: Fix FakeIPTables
FakeIPTables barely implemented any of the iptables interface, and the
main part that it did implement, it implemented incorrectly. Fix it:

- Implement EnsureChain, DeleteChain, EnsureRule, and DeleteRule, not
  just SaveInto/Restore/RestoreAll.

- Restore/RestoreAll now correctly merge the provided state with the
  existing state, rather than simply overwriting it.

- SaveInto now returns the table that was requested, rather than just
  echoing back the Restore/RestoreAll.
2022-05-09 11:29:08 -04:00
Dan Winship
10a72a9e03 pkg/util/iptables/testing: Add IPTables dump-parsing helpers 2022-05-09 11:29:06 -04:00
Dan Winship
f2fa1033d0 pkg/util/iptables/testing: Add better IPTables rule-parsing helpers
There were previously some strange iptables-rule-parsing functions
that were only used by two unit tests in pkg/proxy/ipvs. Get rid of
them and replace them with some much better iptables-rule-parsing
functions.
2022-05-09 11:19:26 -04:00
Benjamin Elder
830456e027 correct coverage MainStart argument order 2022-05-05 14:00:21 -07:00
Benjamin Elder
5d8f6f1213 fix e2e coverage package for go 1.18 2022-04-27 10:05:51 -07:00
Ashutosh Kumar
c00975370a
Handle Non-graceful Node Shutdown (#108486)
Signed-off-by: Ashutosh Kumar <sonasingh46@gmail.com>

Co-authored-by: Ashutosh Kumar <sonasingh46@gmail.com>

Co-authored-by: xing-yang <xingyang105@gmail.com>
2022-03-26 09:23:21 -07:00
Carlos Eduardo Arango Gutierrez
a435ad33f4
Cleanup: pkg/util/ipset
Signed-off-by: Carlos Eduardo Arango Gutierrez <carangog@redhat.com>
2022-03-25 14:14:17 -04:00
Kubernetes Prow Robot
cbf4186a57
Merge pull request #108452 from HirazawaUi/master
show error details removing or adding ipset entry
2022-03-20 16:31:12 -07:00
Kubernetes Prow Robot
54ee338758
Merge pull request #108351 from mengjiao-liu/fix_ipset_test
Fix incorrect test cases to cover code that needs to be tested in `TestValidateIPSet`
2022-03-18 15:01:56 -07:00
Mengjiao Liu
63f600eef4 Improve unit test coverage and readability in pkg/util/netsh/ 2022-03-11 17:04:39 +08:00
HirazawaUi
279fd9abe8 After adding or deleting an ipset entry error, the cause of the error will be displayed 2022-03-02 21:51:20 +08:00
Kubernetes Prow Robot
2de37aa9fa
Merge pull request #108276 from AllenZMC/improve_util_test_coverage
improve test coverage
2022-03-01 16:57:13 -08:00
Mengjiao Liu
63667626d9 Fix incorrect test cases to cover code that needs to be tested in TestValidateIPSet 2022-02-25 16:01:37 +08:00
czm
f31bf3ff12 improve test coverage 2022-02-22 23:04:44 +08:00
Dan Winship
4af471f8be proxy/iptables: move GetChainLines unit tests to the right package
GetChainLines is a utiliptables method, so it should be part of the
unit tests there.
2022-02-21 09:16:22 -05:00
Kubernetes Prow Robot
1659924a97
Merge pull request #108070 from jsafrane/remove-selinux
Remove util/selinux package
2022-02-11 18:19:47 -08:00
Jan Safranek
77aa06d0c8 Remove util/selinux package
The package says:

> the libcontainer SELinux package is only built for Linux, so it is
> necessary to have a NOP wrapper which is built for non-Linux platforms

This is not true, Kubernetes now imports
github.com/opencontainers/selinux/go-selinux and it has proper
multiplatform support (i.e. NOOP on non-Linux platforms).

Removing the whole package and calling go-selinux directly.
2022-02-11 15:20:35 +01:00
Mengjiao Liu
bc55118b5b Improve test coverage: add unit tests TestReadAtMost in pkg/util/tail 2022-02-11 10:20:42 +08:00
Kubernetes Prow Robot
f90267f062
Merge pull request #106840 from Nordix/multi-numa
ReservedMemory Configuration for NUMA
2022-01-27 06:46:25 -08:00
Kubernetes Prow Robot
3bd422dc76
Merge pull request #107293 from dims/jan-1-owners-cleanup
Cleanup OWNERS files - Jan 2021 Week 1
2022-01-13 10:30:30 -08:00