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

3264 commits

Author SHA1 Message Date
Charles-Edouard Brétéché
de00c78513
refactor: simplify engine responses (#6804)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-05 22:55:42 +00:00
Charles-Edouard Brétéché
166122b0ea
refactor: engine response stats (#6796)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-06 01:07:04 +08:00
Charles-Edouard Brétéché
5ec66918f6
feat: add subresource support to resource filters (#6780)
* feat: add subresource support to resource filters

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

* filter

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

* values

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-04-05 13:51:07 +00:00
Charles-Edouard Brétéché
efde33c816
fix: drop hardcoded default exclusions (#6789)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-05 13:05:04 +00:00
Charles-Edouard Brétéché
ab8639b643
refactor: engine execution stats (#6792)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-05 12:27:18 +00:00
Charles-Edouard Brétéché
a710cccb7a
fix: replace background sa name in config by a flag (#6790)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-05 11:50:29 +00:00
Charles-Edouard Brétéché
784ca07419
refactor: engine rule response creation (#6784)
* refactor: engine rule response creation

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

* private fields

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

* more private

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

* more more private

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

* more private

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

* more private

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

* more private

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

* more private

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

* more private

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

* more private

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

* more private

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

* more private

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

* more private

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 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-04-05 10:35:38 +00:00
Charles-Edouard Brétéché
6f8ef4fd30
fix: histogram buckets (#6783)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-05 09:58:07 +00:00
Charles-Edouard Brétéché
5d6b987eec
refactor: kyverno_policy_execution_duration_seconds metric management (#6782)
* refactor: kyverno_policy_results metric management

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

* refactor: kyverno_policy_results metric management

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-04-04 16:34:58 +00:00
Charles-Edouard Brétéché
b2340785fc
refactor: kyverno_policy_results metric management (#6781)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-04 23:07:43 +08:00
Charles-Edouard Brétéché
2f1ac317f4
feat: add flag to skip resource filters in reports controller (#6778)
* feat: add flag to skip resource filters in reports controller

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-04-04 13:05:29 +00:00
Charles-Edouard Brétéché
298e250693
feat: add exclude roles/cluster roles support in configmap (#6779)
* feat: add exclude roles/cluster roles support in configmap

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

* update chart

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

* filter handler

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-04-04 11:59:02 +00:00
Vyom Yadav
80fc3013d3
fix: Support subresources as the trigger in generate rules (#6760)
* fix: check background scanning only for validation policies

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

* fix: Support subresources as the trigger in generate rules

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

---------

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>
2023-04-04 11:01:06 +00:00
Charles-Edouard Brétéché
4634760e9e
refactor: resolve roles/cluster roles/top level GVK earlier in the admission chain (#6775)
* refactor: remove more admission request pointers

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

* more

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

* refactor: resolve roles/cluster roles earlier in the admission chain

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>

* enrich

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

* enrich

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-04-04 10:23:20 +00:00
Charles-Edouard Brétéché
c9bbf38191
refactor: remove more admission request pointers (#6774)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-04 13:11:18 +08:00
Charles-Edouard Brétéché
40ac8eb863
feat: add context/preconditions support to mutate existing (#6754)
* refactor: engine handlers

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>

* feat: add context/preconditions support to mutate existing

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>

* kuttl

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>

* readme

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

* fix and context kuttl 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>

* validation

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>

* final 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: shuting <shuting@nirmata.com>
2023-04-03 19:58:58 +00:00
Charles-Edouard Brétéché
18033a415b
refactor: remove admission request/response pointers (#6769)
* refactor: remove admission request/response pointers

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

* fix 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-04-03 18:08:57 +00:00
Charles-Edouard Brétéché
4cf5903545
fix: allow empty image (#6767)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-03 17:01:35 +00:00
Pradeep Lakshmi Narasimha
cc9adc5cd8
Adding validation to reject audit mode policy creation/updation when mutateDigest is set to true (#6757)
* Adding validation to reject audit mode policy creation/updation when mutateDigest is set to true

Signed-off-by: praddy26 <pradeep.vaishnav4@gmail.com>

* fix tests

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

---------

Signed-off-by: praddy26 <pradeep.vaishnav4@gmail.com>
Signed-off-by: realshuting <shutting06@gmail.com>
Co-authored-by: realshuting <shutting06@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-04-03 15:52:32 +00:00
Charles-Edouard Brétéché
9ac141fcb9
fix: don't filter on group when service based apiservice discovery fails (#6766)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-04-03 14:44:01 +00:00
Ved Ratan
367156f60b
[Chore] Bump to Go 1.20 (#6683)
* changed go version 1.19->1.20

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

* updated go version in actions

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

* bumped golangci-lint

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

* fix

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

* fix conflicts

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

* fix

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

* fixed some linter issues

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

* fixed some linter issues

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

* possible fix

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

* fix

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

* small 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>
Signed-off-by: Ved Ratan <82467006+VedRatan@users.noreply.github.com>
2023-04-03 11:40:47 +00:00
Charles-Edouard Brétéché
b4a4e3a4f3
refactor: don't process context/preconditions in invokeHandler (#6751)
* refactor: engine handlers

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: don't process context/preconditions in invokeHandler

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-04-03 12:57:48 +08:00
shuting
a243b405d2
add a kuttl test (#6622)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-31 12:27:25 +02:00
Charles-Edouard Brétéché
263fd8a7a8
refactor: introduce image mutation handler (#6735)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-31 06:41:48 +00:00
shuting
55d2eeaded
refactor - fire generate upon trigger deletion (#6736)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-31 06:08:14 +00:00
shuting
efe09b286e
fix source in events (#6739)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-31 07:34:31 +02:00
Charles-Edouard Brétéché
94f0829a37
fix: no skip result when no image match the rule (#6733)
* fix: no skip result when no image match the rule

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>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-30 15:31:11 +00:00
Charles-Edouard Brétéché
eaaa8a0236
refactor: engine responses (#6738)
* refactor: engine responses

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-03-30 11:59:32 +00:00
Charles-Edouard Brétéché
d0841e4918
refactor: introduce pss validation handler (#6724)
* refactor: remove rules pointer

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

* refactor: introduce pss validation handler

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

* handler

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-03-30 09:51:16 +00:00
shuting
e2a8d9fa04
fix: event message for the image verify rule (#6734)
* debug

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* debug

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* debug

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* debug

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-30 09:14:02 +00:00
shuting
805f7b72a9
remove unused ctx (#6725)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-29 18:23:29 +00:00
Charles-Edouard Brétéché
43811733dc
refactor: remove rules pointer (#6722)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-29 17:44:09 +00:00
Vyom Yadav
c01b5cc381
fix: Don't check for subresource existence when it is the trigger. (#6544)
Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-29 15:54:42 +00:00
Charles-Edouard Brétéché
c7192912fa
refactor: add preconditions check to engine invokeHandler (#6721)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-29 13:33:02 +00:00
Charles-Edouard Brétéché
7e8f72ccd3
fix: cap and validate webhook timeout (#6715)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-29 07:02:52 +00:00
Charles-Edouard Brétéché
dc8a60a43e
feat: add operations support in match/exclude (#6658)
* feat: add operations support in match/exclude

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>

* clean

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

* matching

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

* operation

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

* make operation mandatory

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

* kuttl

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-03-29 04:22:21 +00:00
Charles-Edouard Brétéché
74664d4280
chore: remove dead code (#6710)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-28 14:43:25 +00:00
Charles-Edouard Brétéché
db29d8b2ba
fix: propagate error when parsing an image fails (#6706)
* fix: propagate error when parsing an image fails

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

* Apply suggestions from code review

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-03-28 13:36:07 +00:00
Charles-Edouard Brétéché
391f1ae487
fix: allow image to be not present (#6707)
* fix: allow image to be not present

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

* log

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-03-28 13:02:29 +00:00
Charles-Edouard Brétéché
341ed36e54
refactor: make use of handlers in engine validation (#6704)
* refactor: make use of handlers in engine validation

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

* polex

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-03-28 07:47:53 +02:00
Charles-Edouard Brétéché
dbc442b9e1
refactor: introduce image validation handler (#6697)
* refactor: factorise rule handler invocation code

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>

* refactor: introduce validation handler

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 image validation handler

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-03-27 15:11:27 +00:00
Charles-Edouard Brétéché
84d4bb4998
refactor: introduce validation handler (#6695)
* refactor: factorise rule handler invocation code

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>

* refactor: introduce validation handler

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-03-27 13:53:42 +00:00
shuting
81ec6c96a1
fix auth validation (#6696)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-27 11:56:24 +00:00
Charles-Edouard Brétéché
03220cd8a9
refactor: factorise rule handler invocation code (#6694)
* refactor: factorise rule handler invocation code

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-03-27 11:22:54 +00:00
shuting
6a60a3da2b
fix: failed to update UR status (#6676)
* reconcile failed URs

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* - getting URs by client; - lose ur status update;

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* retry if the trigger is in termination

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* set retry limit to 3

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-27 08:44:12 +00:00
Charles-Edouard Brétéché
e3b4a84c66
refactor: implement mutation rule handlers (#6684)
* refactor: implement mutation rule handlers

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-03-27 16:09:46 +08:00
Charles-Edouard Brétéché
873ea5c564
refactor: introduce engine handler (#6680)
* refactor: introduce engine handler

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

* clean

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: shuting <shuting@nirmata.com>
2023-03-24 16:24:00 +00:00
Charles-Edouard Brétéché
1e30aacbd9
fix: replace more refect.DeepEqual (#6674)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-24 10:01:49 +00:00
Charles-Edouard Brétéché
5a9befd847
fix: HasVerifyImages check (#6668)
* fix: HasVerifyImages check

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-03-24 08:52:26 +00:00
Charles-Edouard Brétéché
7c571f76f4
feat: add support for ready message (#6670)
* feat: add support for ready message

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

* Update .vscode/launch.json

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

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shutting06@gmail.com>
2023-03-24 07:33:55 +00:00
Charles-Edouard Brétéché
36964a3d95
refactor: engine matching/filtering (#6289)
* refactor: improve engine logger management

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

* logger

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: engine matching/filtering

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

* more

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 cli tests

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

* fix 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>

* match in the engine first

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

* match in the engine first

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>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-24 00:03:40 +08:00
Charles-Edouard Brétéché
dd7ecff386
refactor: remove more pointers from engine api (#6651)
* refactor: remove more pointers from engine api

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>

* debug

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-03-23 20:58:52 +08:00
Charles-Edouard Brétéché
6f65b4416e
fix: filter name in add/sum error (#6657)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-23 08:11:56 -04:00
Ankit Kurmi
f8b352ff55
fix: adding verbosity to openapi unit tests (#6580)
Signed-off-by: Ankit152 <ankitkurmi152@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-23 12:01:49 +01:00
Ved Ratan
893c22b96b
[Feature] The ability to sum quantities (#6552)
* implemented array sum functionality

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

* provided tests and fixed some bugs

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

* added sum functionality

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

* fixed sonatype liftbot issue

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

* restructured the code implementation

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

* added helper errors

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

* removed commented codes

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

* modified error message

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

* applied requested changes

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

* removed some more comments

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

* added more tests

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

* fixed linter issues

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

---------

Signed-off-by: Ved Ratan <vedratan8@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-23 08:59:05 +00:00
Charles-Edouard Brétéché
7cd160a90a
refactor: discovery client (#6652)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-23 06:12:44 +00:00
Charles-Edouard Brétéché
49f0baa277
fix: policy validation with subresource and background scan enabled (#6571)
* fix: policy validation with subresource

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

* kuttl

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

* workflow

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-03-22 17:12:10 +00:00
Charles-Edouard Brétéché
9e5f19b899
fix: do not create UR for dryrun admission requests (#6649)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-22 15:29:42 +00:00
Charles-Edouard Brétéché
6a0a336755
refactor: return structs instead of pointer in engine api (#6647)
* refactor: return structs instead of pointer in engine api

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-03-22 22:55:00 +08:00
shuting
6249ab70e8
fix: block generate policies when lack of permission to operate downstream resources (#6610)
* debug

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* return on errors only

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* update clusterrolebinding

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* update clusterrolebinding

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* remove debug

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add kuttl tests

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix ns

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-22 13:14:57 +00:00
Charles-Edouard Brétéché
f5e96e6ef2
fix: check if resource is empty when matching (#6644)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-22 12:41:16 +00:00
Charles-Edouard Brétéché
3aa3c022f4
fix: GVK fallback in policy context (#6648)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-22 20:07:12 +08:00
Charles-Edouard Brétéché
aa6400269e
refactor: implement matching based on GVK/subresource (#6633)
* refactor: do not allow matching with subresource kind

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

* fix kuttl

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

* fix kuttl

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>

* refactor: implement matching based on GVK/subresource

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-03-22 18:18:11 +08:00
Charles-Edouard Brétéché
aadaec09e1
fix: remove a couple DeepEqual and fix deletion check bug (#6640)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-22 04:46:35 +00:00
shuting
56a4222ceb
fix: skip duplicate PSa checks for the latest version (#6634)
* add version check

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* debug

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* debug

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* skip multiple applies

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* skip multiple applies

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-21 14:03:40 +00:00
Charles-Edouard Brétéché
e06c20f5cc
refactor: do not allow matching with subresource kind (#6625)
* refactor: do not allow matching with subresource kind

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

* fix kuttl

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

* fix kuttl

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>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-21 13:28:00 +00:00
Charles-Edouard Brétéché
08def22d04
fix: incorrect old resource check (#6635)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-21 12:47:50 +00:00
Charles-Edouard Brétéché
bf8a478310
fix: use GVR in reports resource controller (#6612)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-20 13:08:31 +08:00
Charles-Edouard Brétéché
3c16c60912
refactor: admission reports aggregation (#6568)
* refactor: addmission reports aggregation

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 kuttl

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-03-17 12:07:17 +00:00
Charles-Edouard Brétéché
0b56613d59
fix: map APIResource in FindResources results (#6611)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-17 11:21:26 +00:00
Charles-Edouard Brétéché
fc453b1faa
fix: improve shutdown gracefulness (#5107)
* fix: improve shutdown gracefulness

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>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-17 18:48:48 +08:00
shuting
6f7f06f0d4
chore: cleanup generate codebase (#6598)
* add debug info

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* cleanup code

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* linter fix

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* remove unused labels

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* rename ns

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* reset resource version

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* remove ur updater

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix tests

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix tests

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* cleanup code

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* remove code to add labels to clone source #6583

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* rename ns

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* remvove labels from test resource

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* remove generated by labels

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-17 08:36:06 +00:00
HIHIA
0849c8f929
fix: schema validation for mutateExisting type of policy (#6602)
Signed-off-by: HIHIA <283304489@qq.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-17 05:01:02 +00:00
Charles-Edouard Brétéché
a60e4c038c
feat: log when changes happen in policies (#6601)
* feat: log when changes happen in policies

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-03-16 17:17:21 +00:00
Charles-Edouard Brétéché
818b92bf60
test: add config unit test (#6595)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-16 16:34:30 +00:00
Charles-Edouard Brétéché
ad3bf969bf
fix: add message to bypass schema validation when it fails (#6604)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-16 15:03:00 +00:00
Abhishek Sawan
8be4460668
Added JMESPath filter to_boolean() (#6292)
* added to_boolean in JMESPath Filter

Signed-off-by: Abhishek Sawan <sawanabhi157@gmail.com>

* updated to_boolean JMESPath filter

Signed-off-by: Abhishek Sawan <sawanabhi157@gmail.com>

* updated to_boolean JMESPath filter with function registration

Signed-off-by: Abhishek Sawan <sawanabhi157@gmail.com>

* fixed to_boolean JMESPath filter with function registration

Signed-off-by: Abhishek Sawan <sawanabhi157@gmail.com>

* Update pkg/engine/jmespath/functions.go

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: Abhishek Sawan <sawanabhi157@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-16 12:52:26 +00:00
Charles-Edouard Brétéché
7386dc9b9d
test: add config package unit tests (#6581)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-15 22:32:56 +08:00
Charles-Edouard Brétéché
a08d0b8749
feat: add webhook annotations support in config map (#6579)
* feat: add webhook annotations support in config map

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

* release notes

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

* example

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-03-15 14:17:37 +01:00
shuting
dbfeb75793
feat: ignore admission requests sent by the kyverno background controller (#6499)
* ignore ARs sent by the kyverno background controller

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add background controller sa to exclude usernames

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-15 12:27:28 +00:00
Charles-Edouard Brétéché
4bd2e42b96
chore: remove unused discovery method GetServerVersion (#6577)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-15 11:36:44 +00:00
Charles-Edouard Brétéché
a7bebc20c1
fix: use GVRS to load mutation targets (#6576)
* fix: use GVRS to load mutation targets

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

* clean

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

* clean

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-03-15 10:47:25 +00:00
Charles-Edouard Brétéché
bedc6cbd27
fix: controller duration computation (#6569) 2023-03-15 15:11:00 +08:00
Ankit Kurmi
1271784918
fix: adding verbosity to the ./pkg/autogen unit tests (#6566)
Signed-off-by: Ankit152 <ankitkurmi152@gmail.com>
2023-03-14 11:40:34 +00:00
Charles-Edouard Brétéché
ed8b36631c
fix: remove hasVerifyYaml from policy cache (#6563)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-14 08:36:53 +00:00
Charles-Edouard Brétéché
861776d50c
fix: policy cache use GVR instead of kind (#6543)
* fix: policy cache use GVR instead of kind

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>

* unit tests

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

* GVRS

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>

* ephemeralcontainers

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>

* kuttl

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

* nit

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

* fix kuttl

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-03-13 14:44:39 +00:00
Charles-Edouard Brétéché
062bd798f0
test: add kuttl tests for policy kinds validation (#6547)
* test: add kuttl tests for policy kinds validation

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-03-13 18:24:11 +08:00
Charles-Edouard Brétéché
73d2063853
feat: change webhook configuration to better support wildcards (#6534)
* feat: change webhook configuration to better support wildcards

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>

* kuttl

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-03-13 09:27:49 +00:00
shuting
637f830917
feat: apply generate rules on trigger events (#6508)
* - fire generation on trigger deletion, with condition rules;
- delete downstream if trigger no longer matches;
- delete downstream if trigger is deleted, with sync rule

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* trim condition key spaces

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix UR spec

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-create-on-trigger-deletion

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-create-on-trigger-deletion

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-data-sync-delete-trigger

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-data-nosync-delete-trigger

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-data-sync-update-trigger-no-match

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* rename policy

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-data-nosync-update-trigger-no-match

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add debug logs

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-clone-create-on-trigger-deletion

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* update readme

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-clone-sync-delete-trigger

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-clone-nosync-delete-trigger

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-clone-sync-update-trigger-no-match

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* update readme

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test cpol-clone-nosync-update-trigger-no-match

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-10 17:17:10 +00:00
Charles-Edouard Brétéché
0810290f26
fix: process audit policies when admission reports are disabled (#6531)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-10 15:44:28 +00:00
shuting
48726dcd4a
feat: validate immutable fields for a generate rule - 2 (#6451)
* update validation checks

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix ns assertions

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-10 14:39:44 +00:00
shuting
85a83e4fae
fix: namespace matching for background namespaced policies (#6530)
* fix namespace matching for background policies

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test match-trigger-namespace

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-10 13:55:08 +00:00
Charles-Edouard Brétéché
5160b63154
feat: use kind selectors (#6514)
* fix: compile regex globally

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>

* feat: use kind selectors

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

* clean

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>

* cache

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>

* kuttl

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

* kuttl

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

* webhooks rules

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

* kuttl

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-03-10 13:24:55 +00:00
Charles-Edouard Brétéché
6abc7f2e03
fix: improve reports controller default values and workers (#6522)
* fix: improve reports controller default values and worker

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>

* nits

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-03-10 09:39:20 +00:00
Charles-Edouard Brétéché
0fb8c723fe
refactor: reduce userinfos deps and add unit tests (#6524)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-10 09:09:19 +00:00
Charles-Edouard Brétéché
c491c24039
fix: lookup GVR from GVK (#6517)
* fix: lookup GVR from GVK

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

* typo

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-03-10 15:15:48 +08:00
Charles-Edouard Brétéché
1efcd40d04
fix: file name (#6523)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-09 22:17:26 +00:00
Charles-Edouard Brétéché
89cfa88c1e
fix: lookup GVK from GVR (#6516)
* fix: lookup GVK from GVR

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 tests

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>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-09 22:52:44 +08:00
Charles-Edouard Brétéché
caf10ba531
fix: compile regex globally (#6510)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-03-08 15:20:39 -08:00
shuting
4572eab750
fix: apply generate existing when a new rule is added (#6472)
* trigger generate existing when a new rule is added

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add a kuttl test

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* refactor

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* ignore existing rule updates

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-06 15:40:49 +00:00
shuting
c8a3b19d2c
disallow variabels in clone/cloneList (#6438)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-03 11:32:40 +00:00
shuting
ea306d6d7f
rename generateExistingOnPolicyUpdate to generateExisting (#6470)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-03 12:05:53 +01:00
shuting
0b359d07db
rename GenerateExistingOnPolicyUpdate to GenerateExisting (#6321)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-03 09:34:55 +00:00
shuting
c36e9a266d
update resource info in polex events (#6459)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-02 17:19:32 +00:00
shuting
264eaec049
fix: remove timestamp checks for the clone rule (#6439)
* remove timestamp checks

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add kuttl tests

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-01 15:49:05 +00:00
Charles-Edouard Brétéché
b4d62e9a3b
fix: error log (#6429)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-03-01 09:14:50 +00:00
shuting
86fc31f63b
feat: add validations for generate immutable fields (#6328)
* add validations for generate immutable fields

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* chore(deps): bump github.com/onsi/gomega from 1.26.0 to 1.27.0 (#6334)

Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.26.0...v1.27.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Jmespath typo fix (#6342)

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

* chore(deps): bump golang.org/x/net from 0.6.0 to 0.7.0 (#6341)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions (#6348)

Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 2.0.5 to 2.1.0.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](bd2868d14a...b9ddf6a515)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump github.com/onsi/gomega from 1.27.0 to 1.27.1 (#6347)

Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.0 to 1.27.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.0...v1.27.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: dump admission response (#6349)

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

* fix: use labels.Everything in userinfo clusterroles matching (#6351)

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

* update k8s.gcr.io to registry.k8s.io (#6340)

Signed-off-by: Rayan Das <rayandas91@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* Notary v2 (#6011)

* fix make debug-deploy

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* improve log messages

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* initial update

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* initial update

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* update registry credentials handling order

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* comment out ACR helper - breaks anonymous image pull

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* merge main and refactor verifiers

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix opt init

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* remove local address

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* update to NotaryV2 RC

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix fmt

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* update deps

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* format imports

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* remove env and no-op statement

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix merge issues

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix linter issue

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* remove unused field

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* make fmt

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* renable ACR credential helper

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* Update .vscode/launch.json

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

---------

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: shuting <shutting06@gmail.com>

* chore(deps): bump fluxcd/flux2 from 0.39.0 to 0.40.0 (#6362)

Bumps [fluxcd/flux2](https://github.com/fluxcd/flux2) from 0.39.0 to 0.40.0.
- [Release notes](https://github.com/fluxcd/flux2/releases)
- [Changelog](https://github.com/fluxcd/flux2/blob/main/.goreleaser.yml)
- [Commits](978cc0c5b8...2cac6ce281)

---
updated-dependencies:
- dependency-name: fluxcd/flux2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* oldObject translation solved in autogen (#6305)

* OldObject translation solved in autogen

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

* CronJob fixed in autogen

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

* tests added

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

---------

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: logger key value in wrong order (#6365)

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

* fix: missing metrics for policies in audit mode (#6363)

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

* chore(deps): bump github.com/notaryproject/notation-go (#6361)

Bumps [github.com/notaryproject/notation-go](https://github.com/notaryproject/notation-go) from 1.0.0-rc.1 to 1.0.0-rc.3.
- [Release notes](https://github.com/notaryproject/notation-go/releases)
- [Commits](https://github.com/notaryproject/notation-go/compare/v1.0.0-rc.1...v1.0.0-rc.3)

---
updated-dependencies:
- dependency-name: github.com/notaryproject/notation-go
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: role matching from authentication infos (#6358)

* fix: role matching from authentication infos

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

* more 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>

* fix: delete certificate secret if type is not TLS (#6368)

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

* refactor: user/groups exclusions (#6357)

* refactor: user/groups exclusions

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

* wildcard

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>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* add labels to downstream and source resources (#6322)

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* update generate validation checks

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Rayan Das <rayandas91@gmail.com>
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Abhishek Kumar <76171953+octonawish-akcodes@users.noreply.github.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Rayan Das <rayandas91@gmail.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2023-03-01 06:52:20 +00:00
shuting
0c91e87bbb
fix: delete downstream for a generate rule removal, with data and sync (#6393)
* remove policy handler for updates

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* remove policy update handler from the ur controller

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* rework cleanup downstream on policy deletion

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix downstream deletion on data rule removal

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add kuttl test for clusterpolicy

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* linter fix

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add kuttl test for policy

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* update api docs

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add delays

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix name assertion

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* delete downstream when deletes the clone source

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add kuttl test pol-clone-sync-delete-source

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* linter fixes

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add kuttl test pol-clone-sync-delete-downstream

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* add kuttl test pol-data-sync-modify-rule

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix panic

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix panic

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix labels

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix policy assertions

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix annotation missing names

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* rename policy

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* remove dead code

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* create unique namespaces

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* create more unique namespaces

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix assertion

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-03-01 03:48:18 +00:00
shuting
efae284745
check errors (#6424)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-28 14:58:28 +00:00
Charles-Edouard Brétéché
33a07f3c80
fix: cascading mutations (#6411)
* fix: cascading mutations

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

* remove explicit AddResource call

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

* update resource in context

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-02-27 18:33:07 +01:00
Charles-Edouard Brétéché
fb3a90c703
refactor: remove MutateResourceWithImageInfo (#6397)
* refactor: remove new resource from policy context

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

* fallback

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

* test something else

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>

* fix test

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>

* 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 kuttl test

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

* fix cli tests

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

* clean

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

* changelog

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-02-27 13:45:00 +00:00
Charles-Edouard Brétéché
c279d2f495
chore: remove dead code (#6395)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-24 20:33:57 +08:00
Charles-Edouard Brétéché
b8558df675
feat: upgrade otel (#6383)
* chore: bump a couple of deps

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

* feat: upgrade otel

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-02-23 17:54:33 +00:00
Charles-Edouard Brétéché
991d51b03e
fix: remove dead code (#6380)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-23 15:31:31 +00:00
Charles-Edouard Brétéché
d90f18f4ad
fix: remove dynamic config from match helpers (#6381)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-23 15:28:52 +01:00
shuting
ee07f658ec
remove dead code (#6377)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-23 12:18:05 +01:00
Charles-Edouard Brétéché
9bd506ced8
fix: autoUpdateWebhooks=false causes ClusterPolicy to never be ready (#6374)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-23 08:50:39 +00:00
shuting
d5684f6794
add labels to downstream and source resources (#6322)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-22 10:49:09 +00:00
Charles-Edouard Brétéché
9e4ca53c3c
refactor: user/groups exclusions (#6357)
* refactor: user/groups exclusions

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

* wildcard

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>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-02-22 10:08:41 +00:00
Charles-Edouard Brétéché
4a489b8979
fix: delete certificate secret if type is not TLS (#6368)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-22 17:04:17 +08:00
Charles-Edouard Brétéché
ef7265ca6d
fix: role matching from authentication infos (#6358)
* fix: role matching from authentication infos

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

* more 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-02-21 16:57:17 +00:00
Charles-Edouard Brétéché
bbb78abe9c
fix: missing metrics for policies in audit mode (#6363)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-21 14:13:05 +00:00
Charles-Edouard Brétéché
cdfd1fced8
fix: logger key value in wrong order (#6365)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-21 13:18:39 +00:00
Abhishek Kumar
7d4ea1dcdc
oldObject translation solved in autogen (#6305)
* OldObject translation solved in autogen

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

* CronJob fixed in autogen

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

* tests added

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

---------

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-02-21 09:06:29 +00:00
Jim Bugwadia
29997fe446
Notary v2 (#6011)
* fix make debug-deploy

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* improve log messages

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* initial update

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* initial update

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* update registry credentials handling order

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* comment out ACR helper - breaks anonymous image pull

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* merge main and refactor verifiers

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix opt init

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* remove local address

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* update to NotaryV2 RC

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix fmt

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* update deps

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* format imports

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* remove env and no-op statement

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix merge issues

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* fix linter issue

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* remove unused field

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* make fmt

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* renable ACR credential helper

Signed-off-by: Jim Bugwadia <jim@nirmata.com>

* Update .vscode/launch.json

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

---------

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: shuting <shutting06@gmail.com>
2023-02-20 16:26:10 +00:00
Rayan Das
b76a73e7b6
update k8s.gcr.io to registry.k8s.io (#6340)
Signed-off-by: Rayan Das <rayandas91@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-02-20 13:40:12 +00:00
Charles-Edouard Brétéché
f9ddc7bb9c
fix: use labels.Everything in userinfo clusterroles matching (#6351)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-20 11:06:49 +00:00
Charles-Edouard Brétéché
695e9b116d
fix: dump admission response (#6349)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-20 10:06:46 +00:00
Charles-Edouard Brétéché
86008929f6
fix: add roles and clusterroles when dumping admission requests (#6319)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-15 17:37:36 +08:00
Charles-Edouard Brétéché
ab07c39216
refactor: remove validate failure actions from response (#6304)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-13 20:27:40 +08:00
Charles-Edouard Brétéché
5cbb8e82be
feat: add new instrumented clients (#6302)
* feat: add new instrumented clients

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

* helper

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-02-10 20:54:53 +00:00
Charles-Edouard Brétéché
f401071bb3
refactor: propagate exception in rule response (#6298)
* refactor: propagate exception in rule response

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-02-10 20:14:34 +00:00
Charles-Edouard Brétéché
fe6e9abafa
refactor: make engine stats standard fields (#6301)
* refator: make engine stats standard fields

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-02-10 11:35:55 -08:00
Charles-Edouard Brétéché
b743a8999c
fix: use client instead of discovery for sanity checks (#6296)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-02-10 15:38:34 +00:00
shuting
6ff2790957
add new fields to UR; add helpers (#6294)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-10 14:56:17 +00:00
Charles-Edouard Brétéché
43924e131c
refactor: original resource tracking in engine response (#6293)
* refactor: original resource tracking in engine response

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-02-10 14:04:41 +00:00
shuting
dc8874fea7
add label keys (#6291)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-10 14:26:51 +01:00
shuting
c3559f2b8e
chore: generate controller cleanups (#6281)
* deepcopy ur before processing

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* refactor retry annotation updates

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* set pending status on UR creation

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* clean up UR on completion

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* unset

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* linter fixes

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* revert

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-10 11:22:11 +01:00
Charles-Edouard Brétéché
ed5cf2cdde
refactor: remove PolicySpec from engine api (#6159)
* refactor: introduce engine api package

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

* status

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

* refactor: clean engine api package

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

* cleanup

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

* more tests

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

* refactor: remove PolicySpec from engine api

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>

* rm

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>

* constructor

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: shuting <shuting@nirmata.com>
2023-02-10 08:11:21 +00:00
Charles-Edouard Brétéché
3a48c1fcaa
test: add pattern pkg unit tests (#6277)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-10 14:17:36 +08:00
Charles-Edouard Brétéché
7337d099bd
chore: remove testrunner package (#6283)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-09 16:34:22 +00:00
Charles-Edouard Brétéché
15cf69f737
refactor: improve engine logger management (#6280)
* refactor: improve engine logger management

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

* logger

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-02-09 15:15:51 +00:00
Charles-Edouard Brétéché
4ccb7b6bbe
refactor: add a few response helpers in engine internal (#6262)
* refactor: context loading and engine methods

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>

* refactor: add a few response helpers in engine internal

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-02-09 13:39:38 +00:00
Batuhan Apaydın
41b24fb769
move from k8s.gcr.io to registry.k8s.io (#6263)
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
2023-02-09 00:09:15 +08:00
Charles-Edouard Brétéché
7367397178
refactor: reduce store dependency in engine pkg (#6260)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-08 13:19:56 +00:00
Brian Dunnigan
d33e616d69
#6055 Add JMESPath support to imageExtractors (#6183)
Signed-off-by: Brian Dunnigan <bdunnigan@clarityinnovates.com>
Co-authored-by: bdunnigan <bdunnigan@clarityinnovates.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-02-08 11:54:59 +00:00
Charles-Edouard Brétéché
cfd4501dcc
test: add a couple pattern unit tests (#6252)
* test: add a couple pattern unit tests

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

* more

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

* more

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-02-08 11:17:42 +00:00
Ray Burgemeestre
71edb10fcf
fix: do not pass dynamicConfig to matchesResourceDescriptionMatchHelper (#6231) (#6242)
* fix: do not pass dynamicConfig to matchesResourceDescriptionMatchHelper (#6231)

(and only pass it to call for the exclude part of the rule)

Signed-off-by: Ray Burgemeestre <rayb@nvidia.com>

* chore: add unit tests to cover the fix, and to ensure the exclude behavior still works (#6231)

Signed-off-by: Ray Burgemeestre <rayb@nvidia.com>

---------

Signed-off-by: Ray Burgemeestre <rayb@nvidia.com>
Co-authored-by: Ray Burgemeestre <rayb@nvidia.com>
2023-02-08 08:08:09 +00:00
Charles-Edouard Brétéché
3ff83c7bdd
refactor: context loading and engine methods (#6253)
* refactor: context loading and engine methods

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-02-08 13:55:03 +08:00
Charles-Edouard Brétéché
76e306dbc2
refactor: use more engine internals (#6247)
* refactor: use more engine internals

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

* imageverifier

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>

* rule skip and exceptions 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-02-07 16:51:25 +00:00