Commit Graph

10 Commits

Author SHA1 Message Date
Antonin Bas
2e282e8e02 Update Netpol e2e tests to use framework CreateNamespace
The main purpose of this change is to update the e2e Netpol tests to use
the srandard CreateNamespace function from the Framework. Before this
change, a custom Namespace creation function was used, with the
following consequences:

* Pod security admission settings had to be enforced locally (not using
  the centralized mechanism)
* the custom function was brittle, not waiting for default Namespace
  ServiceAccount creation, causing tests to fail in some infrastructures
* tests were not benefiting from standard framework capabilities:
  Namespace name generation, automatic Namespace deletion, etc.

As part of this change, we also do the following:

* clearly decouple responsibilities between the Model, which defines the
  K8s objects to be created, and the KubeManager, which has access to
  runtime information (actual Namespace names after their creation by
  the framework, Service IPs, etc.)
* simplify / clean-up tests and remove as much unneeded logic / funtions
  as possible for easier long-term maintenance
* remove the useFixedNamespaces compile-time constant switch, which
  aimed at re-using existing K8s resources across test cases. The
  reasons: a) it is currently broken as setting it to true causes most
  tests to panic on the master branch, b) it is not a good idea to have
  some switch like this which changes the behavior of the tests and is
  never exercised in CI, c) it cannot possibly work as different test
  cases have different Model requirements (e.g., the protocols list can
  differ) and hence different K8s resource requirements.

For #108298

Signed-off-by: Antonin Bas <abas@vmware.com>
2022-08-10 11:38:26 -07:00
Sergiusz Urbaniak
373c08e0c7
test/e2e/framework: configure pod security admission level for e2e tests 2022-03-28 15:42:10 +02:00
hxie
56382ddf16 Increase number of workers to 3 for Windows
Number of workers was set to be 1 because prallel probing on Windows is
flakier, network policy tests may get stuck, this symptom disappears on
the newest kubernetes, network poicy tests run very well with 3 workers.
2022-01-25 21:32:21 -08:00
hxie
ac0f2e48ad Support UDP test for netwpol on windows 2022-01-18 17:02:18 -08:00
jay vyas
59c0523bca
Using ServiceIPs instead of DNS names in the NetworkPolicy Probes + adding Interface decoupling (#102354)
* Squashed commit of the following:

commit 7f774dcb54b511a3956aed0fac5c803f145e383a
Author: Jay Vyas (jayunit100) <jvyas@vmware.com>
Date:   Fri Jun 18 10:58:16 2021 +0000

    fix commit message

commit 0ac09650742f02004dbb227310057ea3760c4da9
Author: jay vyas <jvyas@vmware.com>
Date:   Thu Jun 17 07:50:33 2021 -0400

    Update test/e2e/network/netpol/kubemanager.go

    Co-authored-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>

commit 6a8bf0a6a2690dac56fec2bdcdce929311c513ca
Author: jay vyas <jvyas@vmware.com>
Date:   Sun Jun 13 08:17:25 2021 -0400

    Implement Service polling for network policy suite to remove reliance on CoreDNS when verifying network policys

    Update test/e2e/network/netpol/probe.go

    Co-authored-by: Antonio Ojea <antonio.ojea.garcia@gmail.com>

    Add deafultNS to use service probe

commit b9c17a48327aab35a855540c2294a51137aa4a48
Author: Matthew Fenwick <mfenwick100@gmail.com>
Date:   Thu May 27 07:30:59 2021 -0400

    address code review comments for networkpolicy decoupling from dns

commit e23ef6ff0d189cf2ed80dbafed9881d68402cb56
Author: jay vyas <jvyas@vmware.com>
Date:   Wed May 26 13:30:21 2021 -0400

    NetworkPolicy decoupling from DNS

gofmt

remove old function

* model refactor

* minor

* dropped getK8sModel func

* dropped modelMap, added global model in BeforeEach and subsequent changes

Co-authored-by: Rajas Kakodkar <rajaskakodkar16@gmail.com>
2021-07-19 23:09:32 -07:00
Shiming Zhang
674802147c update to remove github.com/pkg/errors 2021-06-23 22:56:48 +08:00
jay vyas
8651fcb25a Implement a windows Netpol NewModel 2021-05-25 21:08:29 -04:00
Matthew Fenwick
35a7f91208 Removed "FromPort" in netpol tests
Co-authored-by: Dan Fenwick <dfenwick@fastmail.com>
Co-authored-by: Matt Fenwick <mfenwick100@gmail.com>
2021-01-27 20:24:35 -05:00
Amim Knabben
425e544a66 Copying SCTP netpol tests to new e2e framework 2021-01-13 13:34:11 -05:00
Matthew Fenwick
65632b8677 NetworkPolicy Validation suite
Co-authored-by: Matt Fenwick <mfenwick100@gmail.com>
Co-authored-by: Jay Vyas <jvyas@vmware.com>
Co-authored-by: Rich Renner <renner@sunder.io>
Co-authored-by: Sedef Savas <ssavas@vmware.com>
Co-authored-by: Guangyang Wang <wguangyuan@vmware.com>
Co-authored-by: Akash Sarda <akashsarda3@gmail.com>
Co-authored-by: Abhishek Raut <rauta@vmware.com>
Co-authored-by: Antonin Bas <abas@vmware.com>
Co-authored-by: Antonio Ojea <aojea@redhat.com>

addressed remaining minor comments

initial netpol-framework
2020-12-14 16:47:39 -05:00