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é
98598e33cf
refactor: metrics package ( #3549 )
...
* refactor: use BackgroundProcessingEnabled method
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* refactor: webhooks metrics reporting
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* refactor: metrics package
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-04-07 02:14:13 +08:00
Charles-Edouard Brétéché
594a04db01
refactor: simplify autogen package ( #3532 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-04-05 15:12:22 +00:00
Charles-Edouard Brétéché
857cd1209c
refactor: separate kube utils package ( #3527 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-04-01 08:34:25 +00:00
Charles-Edouard Brétéché
04740c52fa
refactor: use more policy interface ( #3510 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-03-31 12:14:00 +05:30
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
Charles-Edouard Brétéché
20069c13c3
feat: stop mutating rules ( #3410 )
...
* feat: stop adding autogen annotation
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* feat: stop mutating rules
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* feat: stop mutating rules
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* fix: use toggle
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
* fix: review comments
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-03-28 22:01:27 +08:00
Vyankatesh Kudtarkar
e268be9e88
support for deprecated API's ( #3439 )
...
* support for deprecated API's
* add testcase
* update condition
* fix logic
2022-03-22 18:25:35 +00:00
Charles-Edouard Brétéché
0c8e8c1212
feat: move GetRules() at the policy level ( #3420 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-03-18 15:18:32 +00:00
Vyankatesh Kudtarkar
154cea21c3
fix for gvk not working for existing resources policy ( #3384 )
2022-03-14 16:03:13 +05:30
Charles-Edouard Brétéché
ce5f648f30
refactor: introduce rules getters and setters ( #3350 )
...
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Prateek Pandey <prateekpandey14@gmail.com>
2022-03-09 15:28:31 +00:00
shuting
ad56087b91
list resources once per policy in the background reconcilliation ( #3026 )
...
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-01-19 16:42:01 +00:00
shuting
b6447e0649
Remove resourceCache from engine ( #3013 )
...
* update log messages
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* remove resourceCache from the background controller when:
- register resource scope
- list resources per namespace
Signed-off-by: ShutingZhao <shuting@nirmata.com>
* - use client call for configmap lookup;
- remove resourceCache from policy controller, webhook server and generate controller
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-01-18 12:59:35 +00: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
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
shuting
b10947b975
Dynamic webhooks ( #2425 )
...
* support k8s 1.22, update admissionregistration.k8s.io/v1beta1 to admissionregistration.k8s.io/v1
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* - add failurePolicy to policy spec; - fix typo
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* - add schema validation for failurePolicy; - add a printer column
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* set default failure policy to fail if not defined
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* resolve conflicts
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* fix missing type for printerColumn
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* refactor policy controller
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* add webhook config manager
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* - build webhook objects per policy update; - add fail webhook to default webhook configurations
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* fix panic on policy update
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* build default webhook: match empty if autoUpdateWebhooks is enabled, otherwise match all
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* - set default webhook configs rule to empty; - handle policy deletion
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* reset webhook config if policies with a specific failurePolicy are cleaned up
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* handle wildcard pocliy
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* update default webhook timeout to 10s
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* cleanups
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* added webhook informer to re-create it immediately if missing
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* update tag webhookTimeoutSeconds description
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* fix e2e tests
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* fix linter issue
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* correct metric endpoint
Signed-off-by: ShutingZhao <shutting06@gmail.com>
* add pol.generate.kind to webhooks
Signed-off-by: ShutingZhao <shutting06@gmail.com>
2021-10-05 00:15:09 -07:00
Vyankatesh Kudtarkar
9541d2be3e
Validate GVK while installing policy & Fix any/all matching logic ( #2458 )
...
* Handle case-sensitive GVK & Fix any/all matching logic
* Fix any/all matching logic in the background controller
* fix cli issue
* fix any all issue
* add exclude block
* add validation for exclude block
* fix exclude issue
2021-10-04 12:00:57 -07:00
Vyankatesh Kudtarkar
bfd651cbe6
Fix Background Scan issue ( #2381 )
2021-09-13 11:36:23 -07:00
Yashvardhan Kukreja
5fcd9b83d9
added: support for metrics configuration, periodic metrics cleanup and selective namespace whitelisting and blacklisting for metrics ( #2288 )
...
Signed-off-by: Yashvardhan Kukreja <yash.kukreja.98@gmail.com>
2021-09-10 14:39:12 -07:00
Vyankatesh Kudtarkar
2ee32214f9
Dynamic process of GVK
2021-09-02 12:40:40 +05:30
Yashvardhan Kukreja
0a38f1c8ec
dealt with cardinality explosion ( #2157 )
2021-07-23 09:16:50 -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
Yashvardhan Kukreja
b8f8a47d8d
feat: added kyverno_policy_rule_execution_latency_milliseconds metric
...
Signed-off-by: Yashvardhan Kukreja <yash.kukreja.98@gmail.com>
2021-05-24 08:06:36 +05:30
Yashvardhan Kukreja
43a138a12b
feat: added kyverno_policy_rule_results_info metric
...
Signed-off-by: Yashvardhan Kukreja <yash.kukreja.98@gmail.com>
2021-05-24 08:05:14 +05:30
Yashvardhan Kukreja
6b0334f776
fix: consider policy's namespace as well while report rule results to policyreports ( #1897 )
...
Signed-off-by: Yashvardhan Kukreja <yash.kukreja.98@gmail.com>
2021-05-07 16:28:32 -07:00
Vyankatesh Kudtarkar
9e831ec959
Bug Fix: Extends match / exclude to use apiGroup and apiVersion ( #1218 ) ( #1656 )
...
* Extends match / exclude to use apiGroup and apiVersion
Signed-off-by: vyankatesh <vyankatesh@neualto.com>
* fix gvk issue
Signed-off-by: vyankatesh <vyankatesh@neualto.com>
Co-authored-by: vyankatesh <vyankatesh@neualto.com>
2021-03-04 16:45:52 -08:00
Pooja Singh
32522e7827
namespace selector ( #1532 )
...
* updated crd with namespace selector
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added logic for validate
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added condition in utils for namespace labels
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added function for extracting namespace label using lister
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added logic for generate
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added lister in generate
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* commented generate controller changes
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added ns lister
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added ns label in apply.go
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added ns label in generation.go
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added ns label in mutation.go
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* added ns label for validation
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
* using dynaminc informer
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-02-03 13:09:42 -08:00
Jim Bugwadia
e8e3b93a5f
api server lookups ( #1514 )
...
* initial commit for api server lookups
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* initial commit for API server lookups
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* Enhancing dockerfiles (multi-stage) of kyverno components and adding non-root user to the docker images (#1495 )
* Dockerfile refactored
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
* Adding non-root commands to docker images and enhanced the dockerfiles
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
* changing base image to scratch
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
* Minor typo fix
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
* changing dockerfiles to use /etc/passwd to use non-root user'
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
* minor typo
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
* minor typo
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* revert cli image name (#1507 )
Signed-off-by: Raj Babu Das <mail.rajdas@gmail.com>
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* Refactor resourceCache; Reduce throttling requests (background controller) (#1500 )
* skip sending API request for filtered resource
* fix PR comment
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fixes https://github.com/kyverno/kyverno/issues/1490
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fix bug - namespace is not returned properly
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* reduce throttling - list resource using lister
* refactor resource cache
* fix test
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fix label selector
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fix build failure
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix merge issues
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* fix unit test
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
* add nil check for API client
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Co-authored-by: Raj Babu Das <mail.rajdas@gmail.com>
Co-authored-by: shuting <shutting06@gmail.com>
2021-02-01 12:59:13 -08:00
shuting
c692263177
Refactor resourceCache; Reduce throttling requests (background controller) ( #1500 )
...
* skip sending API request for filtered resource
* fix PR comment
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fixes https://github.com/kyverno/kyverno/issues/1490
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fix bug - namespace is not returned properly
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* reduce throttling - list resource using lister
* refactor resource cache
* fix test
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fix label selector
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fix build failure
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-01-29 17:38:23 -08:00
shuting
62a4a3a7da
Reduce throttling - skip sending API request for filtered resources ( #1489 )
...
* skip sending API request for filtered resource
* fix PR comment
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
* fixes https://github.com/kyverno/kyverno/issues/1490
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-01-21 18:58:53 -08:00
Jim Bugwadia
e2f10c6f83
update validation logic
2020-12-23 15:10:07 -08:00
shuting
3c5f9f8888
1398 - Reduce RCR throttling requests ( #1406 )
...
* reduce RCR throttling requests by merging policy application (policy - namespace) results into single RCR
* - refactor policy controller; - fix RCR issue
* - refactor RCR controller; - fix cpolr on ns update; - reduce throttling when getting resources; - fix tests
* update CRD schema
* fix typo
2020-12-21 11:04:19 -08:00
shuting
5e07ecc5f3
Add Policy Report ( #1229 )
...
* add report in cli
* policy report crd added
* policy report added
* configmap added
* added jobs
* added jobs
* bug fixed
* added logic for cli
* common function added
* sub command added for policy report
* subcommand added for report
* common package changed
* configmap added
* added logic for kyverno cli
* added logic for jobs
* added logic for jobs
* added logic for jobs
* added logic for cli
* buf fix
* cli changes
* count bug fix
* docs added for command
* go fmt
* refactor codebase
* remove policy controller for policyreport
* policy report removed
* bug fixes
* bug fixes
* added job trigger if needed
* job deletation logic added
* build failed fix
* fixed e2e test
* remove hard coded variables
* packages adde
* improvment added in jobs sheduler
* policy report yaml added
* cronjob added
* small fixes
* remove background sync
* documentation added for report command
* remove extra log
* small improvement
* tested policy report
* revert hardcoded changes
* changes for demo
* demo changes
* resource aggrigation added
* More changes
* More changes
* - resolve PR comments; - refactor jobs controller
* set rbac for jobs
* add clean up in job controller
* add short names
* remove application scope for policyreport
* move job controller to policyreport
* add report logic in command apply
* - update policy report types; - upgrade k8s library; - update code gen
* temporarily comment out code to pass CI build
* generate / update policyreport to cluster
* add unit test for CLI report
* add test for apply - generate policy report
* fix unit test
* - remove job controller; - remove in-memory configmap; - clean up kustomize manifest
* remove dependency
* add reportRequest / clusterReportRequest
* clean up policy report
* generate report request
* update crd clusterReportRequest
* - update json tag of report summary; - update definition manifests; - fix dclient creation
* aggregate reportRequest into policy report
* fix unit tests
* - update report summary to optional; - generate clusterPolicyReport; - remove reportRequests after merged to report
* remove
* generate reportRequest in kyverno namespace
* update resource filter in helm chart
* - rename reportRequest to reportChangeRequest; -rename clusterReportRequest to clusterReportChangeRequest
* generate policy report in background scan
* skip generating report change request if there's entry results
* fix results entry removal when policy / rule gets deleted
* rename apiversion from policy.kubernetes.io to policy.k8s.io
* update summary.* to lower case
* move reportChangeRequest to kyverno.io/v1alpha1
* remove policy report flag
* fix report update
* clean up policy violation CRD
* remove violation CRD from manifest
* clean up policy violation code - remove pvGenerator
* change severity fields to lower case
* update import library
* set report category
Co-authored-by: Yuvraj <yuvraj.yad001@gmail.com>
Co-authored-by: Yuvraj <10830562+evalsocket@users.noreply.github.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2020-11-09 11:26:12 -08:00
Shuting Zhao
cdc5190c56
update nirmata/kyverno to kyverno/kyverno
2020-10-07 11:12:31 -07:00
Mohan B E
51ac382c6c
Feature/configmaps var 724 ( #1118 )
...
* added configmap data substitution for foreground mutate and validate
* added configmap data substitution for foreground mutate and validate fmt
* added configmap lookup for background
* added comments to resource cache
* added configmap data lookup in preConditions
* added parse strings in In operator and configmap lookup docs
* added configmap lookup docs
* modified configmap lookup docs
2020-09-22 14:11:49 -07:00
shuting
e0f617b383
810 support cronJob for auto-gen ( #1089 )
...
* add watch policy to clusterrole kyverno:customresources
* - improve auto-gen policy application logic - remove unused code
* move method to common util
* auto-gen rule for cronJob
* update doc
* set CronJob as default auto-gen pod controller
* - update doc; - fix test
* remove unused code
2020-09-01 09:11:20 -07:00
shuting
d6062fdd47
Add go fmt ( #1055 )
...
* remove empty flag
* format code
* revert change in install.yaml
2020-08-14 12:21:06 -07:00
Yuvraj
73840e3c5f
configrable rules added ( #1017 )
...
* configrable rules added
* fix exclude group logic from code
* flag added in yaml
* exclude username added
* exclude username added
* config interface implimented
* configure exclude username
* get role ref
* test case fixed
* panic fix
* move from interface to slice
* exclude added in mutate
* trim strings
* configmap changes added
* kustomize changes for configmap
* k8s resources added
2020-08-07 17:09:24 -07:00
Mohan B E
a14828246d
Feature/api version 852 ( #1028 )
...
* apiVersion support for generate
* added apiVersion to crds
2020-08-07 09:47:33 +05:30
shuting
7ffeb6efca
skip generate violation on pre-exist pod ( #952 )
2020-06-25 09:52:54 -07:00
shuting
06a2b246dd
Background mode only apply to running pods ( #949 )
...
* background mode process Running pod only
* update debug doc
2020-06-25 09:52:27 -07:00
Shuting Zhao
139000fe3f
fix namespace lister
2020-05-26 22:26:07 -07:00
Shuting Zhao
7ea2930fa4
- fix violations re-create on the same resource - skip background processing if a resource is to be deleted
2020-05-26 16:25:11 -07:00
Jim Bugwadia
838d02c475
Bugfix/659 support wildcards for namespaces ( #871 )
...
* - support wildcards for namespaces
* do not annotate resource, unless policy is an autogen policy
* close HTTP body
* improve messages
* remove policy store
Policy store was not fully implemented and simply provided a way
to list all polices and get a policy by name, which can be done via
standard client-go interfaces.
We need to revisit and design a better PolicyStore that provides fast
lookups for matching policies based on names, namespaces, etc.
* handle wildcard namespaces in background processing
* fix unit tests 1) remove platform dependent path usage 2) remove policy store
* add test case for mutate with wildcard namespaces
2020-05-26 10:36:56 -07:00
Shuting Zhao
bc981f9a11
fix 869
2020-05-20 13:42:23 -07:00
Shuting Zhao
b9d38d2fd3
fix error "failed to list resources"
2020-05-18 11:56:17 -07:00
Jim Bugwadia
8c4c98d1a4
Merge pull request #855 from nirmata/bugfix/fixes_791_792_832
...
Bugfix/fixes 791 792 832
2020-05-17 19:30:11 -07:00
Yuvraj
0635df7b11
Bug - annotation inserted to podTemplate by auto-gen should reflect the policy name ( #850 )
...
* Added check for annotation inserted to podTemplate by auto-gen
* skip reporting violation on pod which has annotation pod-policies.kyverno.io/autogen-applied
* Revert Changes
* typo fixed
* Update condition for skiping the pods
2020-05-17 18:51:56 -07:00
Jim Bugwadia
bc37d27de6
remove unnecessary comments and reduce cache resync intervals
2020-05-17 09:51:18 -07:00
shivkumar dudhani
4320111c5c
fix logs api
2020-03-20 11:43:21 -07:00