1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
Commit graph

694 commits

Author SHA1 Message Date
Charles-Edouard Brétéché
2d8c74eb12
chore: improve unit tests in cli (#8296)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-06 17:01:23 +00:00
Charles-Edouard Brétéché
aeb8e52fec
refactor: mmove utils report cli package (#8295)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-06 19:02:23 +03:00
Charles-Edouard Brétéché
6b62358dae
refactore: move utils store package (#8293)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-06 15:17:12 +00:00
Charles-Edouard Brétéché
3b44af8dbd
refactor: move utils cobra to command package (#8291)
* refactor: introduce cli variables package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* lint

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* refactor: move utils cobra to command package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-06 14:44:50 +00:00
Charles-Edouard Brétéché
ee4e0422ed
refactor: introduce cli variables package (#8285)
* refactor: introduce cli variables package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-06 14:03:51 +00:00
Charles-Edouard Brétéché
e98bfd1cd9
refactor: introduce cli processor package (#8281)
* refactor: introduce cli processor package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* counts

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-06 12:48:55 +08:00
Charles-Edouard Brétéché
04e21da671
fix: cli dependency to controller-runtime logger (#8280)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 17:06:44 -07:00
Charles-Edouard Brétéché
cbeb5157d6
refactor: cli policy package (#8279)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 23:01:31 +00:00
Charles-Edouard Brétéché
ebebef6cb7
refactor: remove depency from validation to cli (#8274)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 21:58:03 +00:00
Charles-Edouard Brétéché
5360248135
refactor: combine unstructured and resource packages (#8276)
* refactor: introduce userinfo package in the cli

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* refactor: introduce api package in cli

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* refactor: combine unstructured and resource packages

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 21:09:31 +00:00
Charles-Edouard Brétéché
d61e0515c2
refactor: introduce api package in cli (#8275)
* refactor: introduce userinfo package in the cli

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* refactor: introduce api package in cli

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 17:50:52 +00:00
Charles-Edouard Brétéché
e8bc38f25b
refactor: introduce userinfo package in the cli (#8272)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 17:10:27 +00:00
Charles-Edouard Brétéché
cdd8b4383f
refactor: cli test command test execution (#8266)
* refactor: cli test command test execution

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* error

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 13:19:05 +00:00
Charles-Edouard Brétéché
eeb7e814b5
fix: cli exit cleanly (#8267)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 12:19:04 +00:00
Mariam Fahmy
8732183cc6
feat: generate backgroundscan reports for validating admission policies (#8135)
* feat: generate backgroundscan reports for validating admission policies

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix: skip validate check images if errors are encourted when validating the resource

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2023-09-05 11:42:17 +00:00
Charles-Edouard Brétéché
c0a74fe0d5
fix: bad test file causes all tests to pass with success (#8258)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 11:09:45 +00:00
Charles-Edouard Brétéché
0b33ae2b06
refactor: cli packages structure (#8257)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 08:55:01 +00:00
Charles-Edouard Brétéché
c51bc5beb8
docs: improve cli commands docs (#8259)
* chore: improve cli commands docs

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* docs

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* experimental

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* version

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* unit tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* oci

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* oci

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* jp

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* apply

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* create

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-05 05:14:28 +03:00
Charles-Edouard Brétéché
b6e18d7f29
refactor: introduce resource package in cli (#8256)
* refactor: introduce resource package in cli

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2023-09-05 02:25:06 +03:00
Charles-Edouard Brétéché
5615b883db
feat: add multiple paths support to cli test command (#8247)
* refactor: cli test loading

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* feat: add multiple paths support to cli test command

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 20:27:20 +00:00
Charles-Edouard Brétéché
e411eea188
refactor: add a cobra utils package to build commands doc (#8255)
* refactor: add a cobra utils package to build commands doc

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* codegen

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 19:56:23 +00:00
Charles-Edouard Brétéché
90d84d81b2
refactor: cli packages structure (#8254)
* refactor: cli packages structure

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix: unit tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 17:04:10 +00:00
Mariam Fahmy
4da72e3758
fix: return engine responses without checking TestResult.rule since it is empty in case of VAPs (#8251)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 16:32:23 +00:00
Charles-Edouard Brétéché
cef4a9b546
refactor: move all cli commands in a commands package (#8231)
* chore: name all cli command files the same

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* refactor: move all cli commands in a commands package

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* root

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 15:15:55 +00:00
Charles-Edouard Brétéché
b5030987a6
chore: add cli test utils unit tests (#8249)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 13:58:48 +00:00
Charles-Edouard Brétéché
c5300bfcda
refactor: cli test loading (#8244)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 11:36:34 +00:00
Charles-Edouard Brétéché
75da97eabf
chore: add more cli utils unit tests (#8243)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 10:49:50 +00:00
Mariam Fahmy
381fbedf21
fix: check if VAPs are registered in the API server or not (#8219)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2023-09-04 10:16:30 +00:00
Charles-Edouard Brétéché
c93ac4655c
refactor: cli test command (#8212)
* code changes

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* test changes

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 09:34:27 +00:00
Charles-Edouard Brétéché
6b7c204f05
chore: improve test coverage of source cli utils package (#8232)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 08:31:59 +00:00
Charles-Edouard Brétéché
201cd79b86
chore: add gh action to the cli readme (#8233)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-04 04:17:36 +03:00
Charles-Edouard Brétéché
1fdd1127c2
chore: add cli readme (#8223)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-03 23:16:54 +00:00
Charles-Edouard Brétéché
907af6d483
chore: name all cli command files the same (#8227)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-03 22:30:18 +00:00
Charles-Edouard Brétéché
3e4ada64cf
refactor: introduce source package in cli (#8226)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-03 21:54:53 +00:00
Charles-Edouard Brétéché
f8f9f4e628
refactor: CLI oci commands (#8224)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-03 14:21:40 -07:00
Charles-Edouard Brétéché
5c482646d1
refactor: introduce experimental cli package (#8222)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-03 20:14:42 +00:00
Charles-Edouard Brétéché
2ee28fff04
fix: remove unused struct in cli (#8218)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-02 05:08:20 +03:00
Chandan-DK
51de975e7b
feat: add support for wildcard in CLI filters (#8216)
* feat: add wildcard support to test-case-selector flag in cli test command

Signed-off-by: Chandan-DK <chandandk468@gmail.com>

* fix logic

Signed-off-by: Chandan-DK <chandandk468@gmail.com>

* add unit tests

Signed-off-by: Chandan-DK <chandandk468@gmail.com>

* update description

Signed-off-by: Chandan-DK <chandandk468@gmail.com>

---------

Signed-off-by: Chandan-DK <chandandk468@gmail.com>
2023-09-01 21:33:28 +00:00
Charles-Edouard Brétéché
9f108b11cd
feat: add fix test cli command (#8213)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-01 15:50:11 +00:00
Charles-Edouard Brétéché
33d5c81a7d
refactor: introduce report utils package and use it in cli apply (#8203)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-09-01 09:20:39 +00:00
Charles-Edouard Brétéché
6c94e5f1cb
refactor: introduce cli annotations utils package (#8201)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-31 23:42:08 +00:00
Charles-Edouard Brétéché
4d6a511437
fix: multiple test cases for generate policy lead to wrong test results (#8197)
* fix: multiple test cases for generate policy lead to wrong test results

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* add cli test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-31 23:08:54 +00:00
Charles-Edouard Brétéché
941c1ae830
chore: add a couple unit tests (#8199)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-31 17:23:26 +00:00
Charles-Edouard Brétéché
d1c8e7be93
fix: verification of cli docs breaks CI (for real) (#8193)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-31 15:17:26 +00:00
Mariam Fahmy
c583b64120
feat: generate validating admission policies and their bindings from Kyverno policies (#7840)
* feat: generate validating admission policies and their bindings from Kyverno policies

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* feat: add generate VAPs feature flag

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix: use container flags instead of feature flags

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix: limit VAP generation to cluster policies

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* feat: add policy checks for generating VAPs

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* chore: rename package

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* feat: translate match/exclude resources in Kyverno policies to their alternatives in validating admission policies

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* feat: add vap info in kyverno policy status

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix: delete the translation of

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* feat: add kuttl tests

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* feat: add generateValidatingAdmissionPolicy feature flag in the helm chart

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* chore: update codegen

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* feat: add validating admission policy kuttl tests in the workflow

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix: check K8s server version

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix lint issue

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix: remove the kind config of VAPs

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2023-08-31 10:25:21 +00:00
Charles-Edouard Brétéché
acf1192599
fix: kyverno test generated resource inconsistency (#8189)
* fix: kyverno test renerated resource inconsistency

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* unit test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* makefile

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-31 05:54:41 +05:30
Charles-Edouard Brétéché
4317519c81
fix: mutation unit test not working as expected (#8188)
* fix: mutation unit test not working as expected

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* package and unit tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-30 21:42:02 +00:00
Charles-Edouard Brétéché
31bed97806
fix: kyverno test doesn't fail when mutated YAML != patchedResource YAML (#8183)
* fix: kyverno test doesn't fail when mutated YAML != patchedResource YAML

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fixes

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* makefile

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-30 19:37:15 +00:00
Mariam Fahmy
fb166d4f0e
feat: support vap variables in the CLI (#8182)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2023-08-30 18:03:00 +00:00
Charles-Edouard Brétéché
a6bc35b740
fix: allow kyverno test variables directly in test (#8168)
* fix: allow kyverno test variables directly in test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* strict

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-30 16:17:28 +00:00