Charles-Edouard Brétéché
144985ee5a
chore: fix golangcilint timeout ( #4388 )
...
* chore: fix golangcilint timeout
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* fix commit sha
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* add .gitattributes
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-08-24 21:08:24 +08:00
Anutosh Bhat
d92e16526f
Added appropriate logging levels to log.Info() calls wherever necessary ( #4341 )
...
* Added appropriate logging levels to log.Info() calls wherever necessary
Signed-off-by: anutosh491 <andersonbhat491@gmail.com>
* Changed logging levels to 2
Signed-off-by: anutosh491 <andersonbhat491@gmail.com>
Signed-off-by: anutosh491 <andersonbhat491@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-08-18 13:24:59 +00:00
Jim Bugwadia
943c3a1929
use failurePolicy to block or allow requests, on policy errors ( #4183 )
...
* use failurePolicy to block or allow requests, on policy errors
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* add warnings
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* codegen
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix linter issues
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* add unit tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* handle network errors
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix linter issues
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix test
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix title conversion
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix path in generated file
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix test
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix fake metrics
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* add check for klog flag initialization
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* check for flag reinitialization
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* check for flag reinitialization
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix spelling
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix flag init
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2022-08-02 20:24:02 +05:30
Prateek Pandey
3f1997c0e8
fix split policyreport name with background scan ( #4237 )
...
- fix split policyreport name with background scan
- fix the label selector initialising
- refactor the generatePolicyName func
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-07-21 14:31:42 +05:30
Prateek Pandey
808e6ae8b7
delete policy reports on policy deletion ( #4174 )
...
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-06-30 15:45:02 +00:00
Prateek Pandey
9226873e68
feat: split policy report per policy bases ( #4147 )
...
* feat: split policy report per policy bases
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
* add policy name as a handler key
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
* update merge change request logic
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
* handle the delete resource update on policy report
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
* add splitPolicyReport feature gate
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
* delete old reports if splitPolicyReport feature enable
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
* use trim policyname as label and create name
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
* fix change request result
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-06-28 15:27:57 +00:00
shuting
77fb10a430
Clean up RCRs if the count exceeds the threshold ( #4148 )
...
* Clean up RCRs if the count exceeds the limit
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* Sets reports to inactive on resourceExhausted error
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* fix linter
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* Add a container flag changeRequestLimit
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* Skip generating RCRs if resourceExhausted error occurs
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* set default RCR limit to 1000
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* Update log messages and CHANGELOG.md
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* Address review comments
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* Extract mapper to a separate file
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-06-28 06:18:57 +00:00
shuting
cd2d89bf55
Wait for informers' cache to be synced before starting controllers ( #4155 )
...
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-06-28 04:55:52 +00:00
Charles-Edouard Brétéché
41a3f6c388
chore: make kyverno informers and listers import aliases consistent ( #3958 )
...
* chore: make kyverno api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make apimachinery api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make dclient api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make clients import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make kube informers and listers import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make kyverno informers and listers import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-05-18 04:02:31 +00:00
Charles-Edouard Brétéché
572a76ce33
chore: make kube informers and listers import aliases consistent ( #3957 )
...
* chore: make kyverno api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make apimachinery api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make dclient api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make clients import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make kube informers and listers import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-17 17:51:03 +02:00
Charles-Edouard Brétéché
a6d4cd186d
chore: make clients import aliases consistent ( #3956 )
...
* chore: make kyverno api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make apimachinery api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make dclient api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make clients import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-17 15:26:32 +00:00
Charles-Edouard Brétéché
666bcb3c15
chore: make k8s api import aliases consistent ( #3950 )
...
* chore: make kyverno api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* chore: make apimachinery api import aliases consistent
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-17 22:14:31 +08:00
Charles-Edouard Brétéché
5aaf2d8770
chore: make kyverno api import aliases consistent ( #3939 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-17 13:12:43 +02:00
Charles-Edouard Brétéché
0099ef54ad
chore: enable gofmt and gofumpt linters ( #3931 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-17 06:19:03 +00:00
Charles-Edouard Brétéché
26a5402747
chore: enable wastedassign linter ( #3898 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-12 11:03:26 +00:00
Charles-Edouard Brétéché
2064a69b8a
refactor: make config vars private ( #3823 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-11 06:14:30 +00:00
Charles-Edouard Brétéché
97e5e64fd4
chore: enable whitespace linter ( #3864 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-05-10 17:01:29 +00:00
Moritz Johner
4d2ec26c90
CLI should respect scored annotation for warnings ( #3821 )
...
Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-05-07 13:33:50 +00:00
Jim Bugwadia
76608e315e
handle duplicate images; use container name as key ( #3779 )
...
* handle duplicate images; use container name as key
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* use OldObject for modify requests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* use unique image names
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* merge main
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* create a single annotation patch across rules and images
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fmt and change annotation key name
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix linter issues
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-05-05 14:06:18 -07:00
Charles-Edouard Brétéché
32789d1c0d
fix: add missing tombstone calls ( #3784 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-05-03 16:58:20 +00:00
Charles-Edouard Brétéché
c79223393b
refactor: dclient package ( #3775 )
...
* refactor: replace clientset by inteface
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* refactor: dclient package
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-03 13:30:04 +08:00
Charles-Edouard Brétéché
6e07acdd87
refactor: replace clientset by inteface ( #3774 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-02 20:30:07 +00:00
Charles-Edouard Brétéché
18af55ed49
refactor: wait for cache sync ( #3765 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-03 01:41:39 +08:00
Charles-Edouard Brétéché
68c35b2f2e
refactor: remove some api unnecessary pointers (2) ( #3705 )
...
* refactor: remove some api unnecessary pointers
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* refactor: remove some api unnecessary pointers (2)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-04-28 17:11:14 +08:00
Charles-Edouard Brétéché
c8275b7c00
refactor: make response type (RuleType) typed ( #3556 )
...
* refactor: move common utils
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* refactor: make response type (RuleType) typed
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* fix: merge
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-04-06 19:04:08 +00:00
Charles-Edouard Brétéché
83343697b9
refactor: make use of policy interface ( #3499 )
...
- refactor: make use of policy interface
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-03-30 18:34:30 +05:30
shuting
a30493e550
Fix policy report OwnerReference ( #3249 )
...
* add namespaces/finalizers to clusterrole kyverno:generate
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* set policy report's owner to Kyverno namespace
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* address comments
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* address comments
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* remove BlockOwnerDeletion
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* remove namespaces/finalizers permission
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-02-18 00:50:18 -08:00
shuting
2eb9660aee
Reduce throttling requests for Kyverno resources ( #3042 )
...
* remove resoureCache from the event controller
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* create rcr using typed client to reduce PUT throttling request
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* use typed client for report/rcr operations
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* clarify naming patterns for Kyverno ClusterRoles/ClusterRoleBindings (#3029 )
* clarify naming patterns for Kyverno ClusterRoles/ClusterRoleBindings (#3032 )
* fix comment
* fix comment
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-01-22 05:36:42 +00:00
shuting
376a8d3b22
Reduce throttling requests for Kyverno managed resources ( #3016 )
...
* remove resoureCache from the event controller
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* create rcr using typed client to reduce PUT throttling request
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-01-21 18:36:05 +08:00
Kumar Mallikarjuna
3f61e2dd3a
Added report generation for verifyImage rules ( #2782 )
...
* Add report generation for verifyImage rules
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Add flag comment
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Mutation: handleDelete()
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Remove redundant delete
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Test validation failure
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Validation force rules test
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Default validation behaviour
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Manual rules
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Update Config Manager
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
* Move Delete check
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-01-05 07:07:44 +00:00
shuting
045a58e2ef
Don't create ReportChangeRequest on managed pods/jobs deletion ( #2890 )
...
* don't generate policy report on managed pod/job
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* - don't generate rcr for managed pods/jobs; - add debug info
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* address linter issues
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-01-03 15:43:38 +00:00
shuting
2c9319ea87
don't generate policy report on managed pod/job ( #2889 )
...
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2021-12-30 00:34:43 +08:00
Frank Jogeleit
abb5bd2947
Add SelectorLabel to (Cluster)PolicyReporter resources ( #2841 )
...
Signed-off-by: Frank Jogeleit <frank.jogeleit@lovoo.com>
Co-authored-by: shuting <shutting06@gmail.com>
2021-12-17 05:03:52 +00:00
Marcus Noble
8690f8b142
Handle reports with missing result property ( #2696 )
...
* Handle reports with missing result property
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Make use of type structs
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Fix import
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Fix cast from map to struct
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-11-09 12:03:15 +01:00
shuting
0f0c070072
Fix memory issue - RCR conversion ( #2678 )
2021-11-08 15:53:21 -08:00
Jose Armesto
831a9826d1
Restructure project to follow standards ( #2632 )
...
Signed-off-by: Jose Armesto <github@armesto.net>
2021-10-29 18:13:20 +02:00
Marcus Noble
1966c82c6d
Fix various go lint issues ( #2639 )
...
* Fix various go lint issues
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Fix if mistake
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
* Simplified returns
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-10-29 17:06:03 +02:00
shuting
4835157cc4
fix policy report reconciliation on resource/policy deletion ( #2610 )
2021-10-27 22:59:59 -07:00
Bricktop
3f15ec5a1e
Remove dead code and unused variables ( #2537 )
...
* Remove dead code and unused variables
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
* Remove unnecessary definitions
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-13 22:45:23 +02:00
Bricktop
fe0947dcb3
Add error handling where missing ( #2516 )
...
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-11 14:57:43 -07:00
Bricktop
23864d89c8
Ensure make invocations pass linter ( #2518 )
...
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-11 14:43:09 -07:00
Jim Bugwadia
086194ffab
fix reporting
...
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-03 01:31:05 -07:00
Jim Bugwadia
6c5fb08e45
merge main
...
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-26 02:20:29 -07:00
Jim Bugwadia
39061d91c4
implement validate.foreach
...
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-26 02:12:31 -07:00
shuting
e288ed7fd2
Fix upgrade issue from 1.4.2 to 1.4.3-rc1 ( #2387 )
...
* update git command to get tag in 'v*' format
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* add label "appVersion" to report change request
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fix linter issue
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* update git hash
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-09-14 01:06:56 -07:00
Frank Jogeleit
c522343c03
Update PolicyReport CRDs to wgpolicyk8s.io/v1alpha2 ( #1825 )
2021-08-21 10:35:17 -07:00
Jim Bugwadia
003c865ab9
deprecate policy status ( #2136 )
...
* deprecate policy status
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* make fmt
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* remove policy status tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix generate metrics
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-07-14 12:18:59 -07:00
shuting
104cd310e8
Cleanup Report Change Requests ( #2134 )
...
* clean up RCRs if retry fails
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* cleanup report change request when background scan starts
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* add verb deletecollection to ClusterRole kyverno:customresources
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-07-14 09:57:16 -07:00
Valentin Velkov
63f4c9a884
Configurable success events on policies & resources. Generating failure events on policies by default. ( #1939 )
...
* Remove unused event.Reason const
Signed-off-by: Velkov <valentin.velkov@sap.com>
* Generate failure events on policies
Signed-off-by: Velkov <valentin.velkov@sap.com>
* Generate success events on policy
Signed-off-by: Velkov <valentin.velkov@sap.com>
* Introduce 'generateSuccessEvents' flag
Signed-off-by: Velkov <valentin.velkov@sap.com>
* Unit tests & chart fix
Signed-off-by: Velkov <valentin.velkov@sap.com>
2021-06-29 14:43:11 -07:00
Arsh Sharma
86045fc02c
adding support for policies.kyverno.io/scored annotation ( #1976 )
...
* initial commit
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
* added debug statements
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
* fixed report
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
* removed code for debugging
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
* newline fix
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
* fix default case
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
2021-06-21 18:37:20 -07:00