1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-15 17:51:20 +00:00
Commit graph

674 commits

Author SHA1 Message Date
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
Charles-Edouard Brétéché
23ef95a79c
fix: website docs generation (#8181)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-30 15:17:50 +00:00
Charles-Edouard Brétéché
e248757798
feat: add cli docs command (#8179)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-30 11:26:26 +00:00
Charles-Edouard Brétéché
8840be78ce
refactor: refactor cli filters and add unit tests (#8177)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-30 10:24:43 +00:00
Amit kumar
6d8ae16afa
added verify image ristretto cache implementation (#7969)
* updated flags

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added ristretto_cache impl

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added bufferSize

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* small nits

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* made cache as private member

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* made cache as private member

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added logger.withValues

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added verify image cache

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* small nits

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added cache tests

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* fixed lint issue

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added chaged policy test

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* cache time should be entered in minutes

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* removed cache.wait()

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* small nits

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* removed client.go logs and added in imageVerifier

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added level to the logs

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added notary image cache verification

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* replace intVar by flag.DurationVar()

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* removed lock from cache clinet

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* updated cosign tests

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added execution latencies comparision

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added assert.Error()

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added error assertion util

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added error log

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* Update pkg/engine/internal/imageverifier.go

Signed-off-by: shuting <shutting06@gmail.com>

* lint fixes

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* removed logs from unit tests

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added ristretto_cache impl

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* removed cache.wait()

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* small nits

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* added asssertions in tests

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* fixed conflicts

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* lint fix

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

* renamed variabls

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>

---------

Signed-off-by: hackeramitkumar <amit9116260192@gmail.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-08-30 07:26:40 +00:00
Charles-Edouard Brétéché
414c3c77dd
chore: add cli path utils unit tests (#8167)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-29 21:49:32 +00:00
Charles-Edouard Brétéché
c5eb3d2525
fix: check caSecretName and tlsSecretName flags (#8155)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-29 21:06:15 +00:00
Charles-Edouard Brétéché
3a2c71c4ba
fix: remove cli manifest commands (#8165)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-29 19:28:26 +00:00
Charles-Edouard Brétéché
afd736428f
chore: create cli pathutils package (#8164)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-29 18:20:17 +00:00
Charles-Edouard Brétéché
4c05c2833c
fix: support fully-qualified file paths in cli test command (#8163)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-29 17:08:20 +00:00
Charles-Edouard Brétéché
4d39fba931
fix: add description to CLI create command (#8160)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-29 15:37:47 +00:00
Charles-Edouard Brétéché
bb3df218ed
fix: validate the YAML test file syntactically and schematically (#8145)
* fix: validate the YAML test file syntactically

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

* schema validation

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>

* 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-28 18:04:00 -04:00
Ved Ratan
daadd36c72
[Feat]: Perform permissions check when TTL label is observed (#8128)
* added permissions check

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* lint fix

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* lint fix

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* issue_8091

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* log fix

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* refactor

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* fix

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

---------

Signed-off-by: Ved Ratan <vedratan8@gmail.com>
Signed-off-by: Ved Ratan <82467006+VedRatan@users.noreply.github.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-28 16:18:48 +00:00
Charles-Edouard Brétéché
0f9fe30c08
feat: allow overriding ca and tls secret names (#8137)
* feat: allow overriding ca and tls secret names

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-28 14:05:49 +00:00
Vishal Choudhary
b374c05517
fix: update certmanager and config to take common name and namespace as arguments (#8129)
* feat: add namespace and common name args

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

* fix: remove unnecessary dns name

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>

---------

Signed-off-by: Vishal Choudhary <sendtovishalchoudhary@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-28 12:04:37 +00:00
Ved Ratan
ebd9506f87
[Feat] TTL controller log improvements (#8112)
* upgraded verbose and enhanced label

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* enhancements

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* fix

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

* fix

Signed-off-by: Ved Ratan <vedratan8@gmail.com>

---------

Signed-off-by: Ved Ratan <vedratan8@gmail.com>
2023-08-25 22:32:56 +02:00
Charles-Edouard Brétéché
ab6fc0ad1b
fix: reduce tls package dependencies (part 2) (#8109)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-25 11:24:52 +00:00
Charles-Edouard Brétéché
e7b7dc4b9d
fix: cli logs not working (#8110)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-24 16:17:20 +00:00
Charles-Edouard Brétéché
3c09d902fd
fix: context propagation in tracing (#8104)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-24 14:45:58 +08:00
Mariam Fahmy
333845677a
fix: check if client is set in CEL validations (#8099)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2023-08-23 17:22:37 +02:00
Charles-Edouard Brétéché
794dc782bd
fix: stop hidding flags in the cli (#8077)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-08-21 11:16:05 +00:00