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

839 commits

Author SHA1 Message Date
Batuhan Apaydın
4eab46fb7d
feat: support other key methods (#2607)
* feat: support other key methods

Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Co-authored-by: Furkan Turkal <furkan.turkal@trendyol.com>
Co-authored-by: Erkan Zileli <erkan.zileli@trendyol.com>

* feat: support fetch attestations from repository

Signed-off-by: Furkan <furkan.turkal@trendyol.com>
Co-authored-by: Batuhan <batuhan.apaydin@trendyol.com>
Signed-off-by: Furkan <furkan.turkal@trendyol.com>

* fix: parameter type

Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>

* fix error check

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

Co-authored-by: Furkan Turkal <furkan.turkal@trendyol.com>
Co-authored-by: Erkan Zileli <erkan.zileli@trendyol.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2021-11-03 00:45:35 -07:00
Jim Bugwadia
e701b7aceb
re-apply policies to managed pods (#2648)
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-11-01 11:08:24 -07:00
Bricktop
f42144b929
Improve consistency in jmesPath functions test file (#2640)
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-29 14:45:03 -07: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
Lukasz Jakimczuk
40b579ccd7
Improving readability (#2638)
Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>
2021-10-29 14:48:22 +02:00
Marcus Noble
373420aa6d
Fix go vet errors (#2637)
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-10-29 14:09:11 +02:00
Lukasz Jakimczuk
ca975b8e99
*Range Operators (#2622)
* Range operator: first iteration

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* Changing hyphen to colon

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* Accounting for negative numbers

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* View on the second version

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* Adding tests to the operator

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* Renoving negative support

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* Adding comment

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* Signing

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* Going for the regexp version of operator

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>

* Adding negative range operator

Signed-off-by: Łukasz Jakimczuk <lukasz.j@giantswarm.io>
2021-10-29 13:48:23 +02:00
Marcus Noble
a923dce631
Cleanup imports (#2635)
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-10-29 12:24:26 +02:00
Marcus Noble
604c0408c6
Refactored operator tests to use test cases (#2620)
Identified several situations where operators didn't return the expected result (mainly around different types) so fixed those to make all tests cases pass.

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-10-29 10:54:51 +02:00
Kumar Mallikarjuna
f74f7c841a
Change split return from []string to []interface{} (#2604)
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-10-28 22:56:18 -07:00
Sunghoon Kang
e401d57b35
Check client if nil before loading resource list (#2562)
Unlike loading resource, current implementation doesn't check if
client is nil or not when loading resource list.

This commit checks if client is nil or not before loading resource
list.

Signed-off-by: Sunghoon Kang <hoon@linecorp.com>
2021-10-26 17:30:19 -07:00
Anushka Mittal
08a3087100
New operators (#2543)
* added anyin operator

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* allin, anynotin, allnotin added

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* added operator handler info

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* fixes typos and variable names

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* reusing code from in.go in new operators

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* Added more test cases for new operators

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* updated openapiv3schema

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* matching logic

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* added deprecated tag for In and NotIn

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
2021-10-26 17:29:42 -07:00
Jim Bugwadia
a9b96ff882 fmt
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-26 13:25:41 -07:00
Jim Bugwadia
85c346c0a6 skip var substitution in attestations
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-26 13:22:00 -07:00
Jim Bugwadia
836d88191d make fmt
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-26 10:49:51 -07:00
Jim Bugwadia
ef9e9ec9ac add variable substitutoion for imageVerify and allow PEM in ConfigMaps
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-26 10:41:27 -07:00
Marcus Noble
913bbd567a
Handle durations with standard comparison operators (#2569)
* Handle durations with standard comparison operators

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

* Fix error strings

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

* Added CLI tests for duration operations

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

* Added tests with different units

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-10-22 12:41:25 -07:00
Kumar Mallikarjuna
085e46f7c4
Merge pull request #2560 from AverageMarcus/compare_quantities
Added support for comparing resource quantities
2021-10-21 12:17:08 +05:30
Kumar Mallikarjuna
b1c40e172d
Escape variables (#2563)
* Escape variables

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Escape variables test - nested

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Fixed missing changes

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-10-20 17:10:24 -07:00
Vyankatesh Kudtarkar
27cac66b87 fix comment 2021-10-19 22:08:55 +05:30
Marcus Noble
509f561d67
Added support for comparing resource quantities
Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>
2021-10-19 15:22:26 +01:00
Vyankatesh Kudtarkar
b31b343910 Fix foreach issue 2021-10-19 15:34:53 +05:30
Jim Bugwadia
e3fe8e0cc1
fix mutate handling of skipped rules (#2557) 2021-10-18 15:42:34 -07:00
Jim Bugwadia
e0b1f08a28
fix check for CREATE request (#2551)
* fix check for CREATE request

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

* add unit test

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

* fmt

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

* fix test

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-18 09:34:07 -07:00
Marcus Noble
d69b81e03e
added base64 jmespath functions (#2542)
* added base64 jmespath functions

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

* added base64_decode test to emulate working with secret

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

* Update regex to allow number in func name

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

* Added CLI tests for preconditions and custom funcs

Signed-off-by: Marcus Noble <github@marcusnoble.co.uk>

Co-authored-by: AverageMarcus <git@marcusnoble.co.uk>
Co-authored-by: Bricktop <marcel.mueller1@rwth-aachen.de>
2021-10-14 11:46:06 -07:00
Kumar Mallikarjuna
d0a36b6dcc
element variable lifecycle (#2535)
* Foreach element with background false

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Tests for foreach element

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Update Test_Validation_invalid_backgroundPolicy

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* CLI: Print invalid policies

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Remove redundant Sprintf() calls

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Updated tests for foreach list

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-10-14 10:14:11 -07:00
Vyankatesh Kudtarkar
2798287497
support list foreach (#2522)
* support list foreach

* fix testcase for each

* fix mutate issue

* Fix mutate patch issue

* fix yaml

* fix e2e test foreach validate list

* code indentation

* fix comments

* delete unwanted files
2021-10-14 00:20:52 -07:00
Vyankatesh Kudtarkar
2089767c85
wildcard support (#2485)
* wildcard support

* remove console

* fix issue

* fix deny condition

* fix comments

* fix regex issue

* remove UserInfo
2021-10-14 00:15:32 -07:00
Bricktop
d62234d776
Fix remaining static check findings (#2541)
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-13 16:00:41 -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
Sachin
0d402ec09c
Implicit memory aliasing in for loop. (#2530)
Signed-off-by: slayer321 <sachin.maurya7666@gmail.com>
2021-10-13 11:03:25 -07:00
Sachin
787d6de696
unnecessary use of fmt.Sprintf (#2531)
Signed-off-by: slayer321 <sachin.maurya7666@gmail.com>
2021-10-13 11:00:04 -07:00
Bricktop
3815b40c64
Fix various static checks related to condition handling (#2528)
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-13 11:29:45 +02:00
Bricktop
2d0df77963
Format error messages correctly (#2519)
* Format error messages correctly

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>

* No punctuation at the end or errors

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>

* Replace loop with simple if

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>

* Fix more errors

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-10-12 14:29:20 -07: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
Sachin
e16d773957
Remove unused function (#2517) 2021-10-11 12:46:28 -07:00
Bricktop
67a2466c32
Remove dead code in various packages (#2514) 2021-10-11 12:44:43 -07:00
Jim Bugwadia
1c0a303106 fix merge error
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-06 22:48:56 -07:00
Jim Bugwadia
7c761b4bc9 Merge branch 'main' into feature/foreach_mutate 2021-10-06 22:45:03 -07:00
Jim Bugwadia
4c63442028 separate MutateResourceWithImageInfo from buildContext and add comments
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-06 22:19:47 -07:00
Jim Bugwadia
683543d8e2 fmt
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-06 22:05:28 -07:00
Jim Bugwadia
fa1816d605 fix tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-06 21:50:26 -07:00
Jim Bugwadia
b9d4ee6876 fix tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-06 18:31:20 -07:00
Jim Bugwadia
676bd5f4be fmt
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-06 11:18:36 -07:00
Jim Bugwadia
0bb35aa302 merge main
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-06 10:51:43 -07:00
Anushka Mittal
7963263776
Adding log statements in context.go (#2483)
* adding logs in context.go

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>

* minor modifications

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
2021-10-06 10:29:28 -07:00
Jim Bugwadia
619ee6ac61 fix loop
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-06 09:55:23 -07:00
Jim Bugwadia
90edc69dcf merge and update
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-05 22:42:42 -07:00
Pooja Singh
ca62172b6f
Merge pull request #2462 from NoSkillGirl/feat/support_mutate_in_cli
Kyverno CLI | Support mutate policies for `test` command
2021-10-05 21:27:31 +05:30
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
NoSkillGirl
0614c2db1f fixed rule pointer
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-10-05 12:39:58 +05:30
NoSkillGirl
5ca33ce902 Merge branch 'main' of github.com:kyverno/kyverno into feat/support_mutate_in_cli 2021-10-05 12:23:34 +05:30
vivek kumar sahu
ae6f6c327f Added Code to support the test command for mutate policy (#2279)
* Added test-e2e-local in the Makefile
* Added a proper Indentation
* Added 3 more fields
* Added getPolicyResourceFullPath function
* Updating the patchedResource path to full path
* Converts Namespaced policy to ClusterPolicy
* Added GetPatchedResourceFromPath function
* Added GetPatchedResource function
* Checks for namespaced-policy from policy name provided bu user
* Generalizing resultKey for both validate and mutate. Also added kind field to this key
* Added Type field to PolicySpec
* To handle mutate case when resource and patchedResource are equal
* fetch patchResource from path provided by user and compare it with engine patchedResource
* generating result by comparing patchedResource
* Added kind to resultKey
* Handles namespaced policy results
* Skip is required
* Added []*response.EngineResponse return type in ApplyPolicyOnResource function
* namespaced policy only surpasses resources having same namespace as policy
* apply command will print the patchedResource whereas test will not
* passing engineResponse instead of validateEngineResponse because it supports results for both validate and mutate case
* default namespace will printed in the output table if no namespace is being provided by the user
* Added e2e test for mutate policy and also examples for both type of policies
* Created a separate function to get resultKey
* Changes in the resultKey for validate case
* Added help description for test command in the cli
* fixes code for more test cases
* fixes code to support more cases and also added resources for e2e-test
* some small changes like adding brackets, clubbing 2 if cond into one, changing variable name, etc.
* Rearrange GetPatchedResourceFromPath function to get rid from repetion of same thing twice.
* Added kind in the result section of test.yaml for all test-cases
* engineResponse will handle different types of response
* GetPatchedResource() uses GetResource function to fetch patched resource

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>
2021-10-05 11:11:54 +05:30
Jim Bugwadia
6cf9fdd502 fix compile errors
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-03 23:23:45 -07:00
Jim Bugwadia
ee6aafa7bb fix linter issues
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-03 23:07:40 -07:00
Jim Bugwadia
77ae92e784 improve messages
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-03 03:28:58 -07:00
Jim Bugwadia
731ffde0e7 fix messages and tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-03 03:15:22 -07:00
Jim Bugwadia
8b7d404ea2 generate CRDs and validate handling of skip/error
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-02 18:29:25 -07:00
Jim Bugwadia
89d1e4afab format
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-02 16:57:40 -07:00
Jim Bugwadia
e0e6074afc add validation; add 'element' to context
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-02 16:53:02 -07:00
Jim Bugwadia
f015c16f08 fmt
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-02 14:24:23 -07:00
Jim Bugwadia
2bd5bca721 merge foreach and add attestation checks
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-02 14:24:06 -07:00
Jim Bugwadia
249c0f62f8 support attestations
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-02 01:19:47 -07:00
Jim Bugwadia
0dbe7ea675 start attestation support
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-10-01 11:10:36 -07:00
Jim Bugwadia
1ebd2c99f2 add messages and set rule to skip when pattern does not match
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-30 23:34:04 -07:00
Jim Bugwadia
6ae3063038 merge main
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-30 11:53:33 -07:00
Jim Bugwadia
5b5a85c16a change RuleStatus values to lowercase
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-30 00:04:13 -07:00
Pooja Singh
22789443a8
Merge pull request #2420 from NoSkillGirl/debug_2406_flacky_unit_test
Fix for flaky unit test
2021-09-29 17:02:54 +05:30
NoSkillGirl
9513cca68f removing commented test case
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-09-29 11:02:07 +05:30
NoSkillGirl
ff540bfb06 removing print statement
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-09-29 10:59:54 +05:30
Shubham Palriwala
5b01dd53a7
remove minio/minio and update minio/pkg (#2440)
Signed-off-by: ShubhamPalriwala <spalriwalau@gmail.com>
2021-09-28 12:19:26 -07:00
NoSkillGirl
83a815d7cf added test cases
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-09-28 20:17:03 +05:30
Jim Bugwadia
3957a1400e fix deny check and fmt
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-27 23:40:05 -07:00
Jim Bugwadia
a905a61581 fix deny rules
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-27 14:28:55 -07:00
Kumar Mallikarjuna
6a81bb7cc3
Escape references (#2433)
* Escape references

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Additional tests

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-09-27 11:44:56 -07:00
Jim Bugwadia
536b64bed1 fix tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-26 21:15:13 -07:00
Jim Bugwadia
67660647d9 update tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-26 18:30:53 -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
NoSkillGirl
f9c789967c added test cases
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-09-23 15:01:34 +05:30
Kumar Mallikarjuna
0616429267
JMESPath: Arithmetic Operators (#2416)
Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-09-22 14:40:45 -07:00
NoSkillGirl
799ae0f80d added test cases
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-09-22 14:33:59 +05:30
NoSkillGirl
d6e977a34d updated logic for key in resources
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-09-22 01:51:57 +05:30
NoSkillGirl
aba3bad8fc adding logic for checking key in resources
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-09-21 20:15:09 +05:30
NoSkillGirl
4a5d4a2bac debugging
Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-09-21 12:12:34 +05:30
Jim Bugwadia
23af42dc92
allow alternate image repositories (#2393)
* allow alternate image repositories

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

* generate CRD YAMLs

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-09-16 16:11:38 -07:00
Max Goncharenko
a0ff8bbd0b
Implement global anchor (#2311)
* implement global anchor for patch strategic merge

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* fixed unit tests for mutation global anchor

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* added global anchor in validation

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* fix some global anchor issues found during testing

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* run go tidy

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fixed tests

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fixed some tests

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* finish implementing global anchor

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* WIP: lower global anchor strictness

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* Revert "WIP: lower global anchor strictness"

This reverts commit 08e176a042.

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* global anchor for mutation

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-09-13 08:59:28 -07:00
Kumar Mallikarjuna
f6933bb439
Block scalars for value files (#2380)
* Block scalars for value files

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Handle non-block values

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>

* Unit tests for block scalars

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-09-13 16:33:30 +05:30
Max Goncharenko
c2e298a1f6
Substitute vars in map keys (#2344)
* substitute vars in map keys

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* add test for 2316 issue case

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-09-10 14:08:47 -07:00
Max Goncharenko
7e258bf54b
add new test; remove unnecessary anchors (#2217)
* add new test; remove unnecessary anchors

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* added several test to e2e

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* remove unused variable

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* added comment to expected result

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-09-09 08:55:20 -07:00
Vyankatesh Kudtarkar
39ce730814
Merge branch 'main' into GVK_Format 2021-09-09 09:00:37 +05:30
Max Goncharenko
2a375fa1b5
Remove contains function (#2346)
* remove contains function

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* added test for contains issue case

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-09-08 12:33:41 -07:00
Vyankatesh Kudtarkar
28cceb9229 add unit test cases 2021-09-03 10:42:43 +05:30
Vyankatesh Kudtarkar
601fb711e5 fix unit test issue 2021-09-03 10:32:09 +05:30
Vyankatesh Kudtarkar
6821800273 Merge branch 'GVK_Format' of https://github.com/vyankyGH/kyverno into GVK_Format 2021-09-02 12:40:46 +05:30
Vyankatesh Kudtarkar
2ee32214f9 Dynamic process of GVK 2021-09-02 12:40:40 +05:30
Bricktop
fbab9abd43
Add test case for non zero index patches with patchesJson6902 (#2339)
* Clean up formatting in mutate test file

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>

* Add test for non-zero index numbers for patchesJson6902

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>

* Align more with sample

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-09-01 17:50:37 -07:00
Bricktop
80c29ae20d
Clean up formatting in mutate test file (#2338)
Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-08-31 12:44:36 -07:00
Max Goncharenko
ab24da9707
Added 2241 test case (#2255)
* added 2241 test case

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* update the log level for not resolved variables

Signed-off-by: Max Goncharenko <kacejot@fex.net>
2021-08-20 14:44:19 -07:00
Bricktop
a93240c436
Fix precondition logic for mutating policies (#2271)
* Add test for mutation with precondition

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>

* Fix mistake which prevented correct variable substitution

Signed-off-by: Marcel Mueller <marcel.mueller1@rwth-aachen.de>
2021-08-17 14:43:21 -07:00
treydock
8204028009
Add DurationOperator to handle duration comparison operations (#2214)
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
2021-07-30 13:11:52 -07:00
Max Goncharenko
922840b344
added deep copy for rule; changed rule deep copy logic (#2216)
* added deep copy for rule; changed rule deep copy logic

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fixed linter error

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-07-30 12:07:01 -07:00
Arsh Sharma
97eaa7e854
adding any/all under match and exclude blocks (#2130)
* intial commit

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* update types

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* updated all type

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* extract to single struct

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* updated match resource description function

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* minor test working

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* match resources test is working

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* exclude resources test is working

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* changed double negetive in logic

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* yamls updated and added validation and cache loops

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* match exclude working but need to fix matchExcludeConflict function

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* restored doMatchAndExcludeConflict function

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* rewrote the matchExcludeConflictFunction

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* finalizing completed till utils_test.go

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* ready for review complete

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* update yamls

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* one more merge conflict solved

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* regenerates YAMLs

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* possible fix for failing tests

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* removed duplicate any/all logic and added a test, (rest refacotring is in progress)

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* cache test is working

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* improved cache test and it is working

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* added check for mutate and generate policies too

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* cleaned doesResourceMatchConditionBlock logic but validation still has code from attempt to combine the all block

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* reverted validate.go to older logic

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* removed commented code

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* removed extra comments

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
2021-07-28 12:59:53 -07:00
Max Goncharenko
903963c26d
add special variable substitution logic for preconditions (#1930)
* add special variable substitution logic for preconditions

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* handle NotFoundVariable error in proper way

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* remove excess log; fix grammar

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* removed isPrecondition flag; added test case for empty deny string; fixed related issue

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fix test case

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fix go lint

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fix tests

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-07-28 09:54:50 -07:00
Pooja Singh
88d1617390
Resolving variables from the resource passed | CLI (#2180)
* added logic for adding resources in context

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* small fix

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* returning error if request.object is passed from cmd

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* reterning error if request.object is passed from value file

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* removing comments

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* small fix

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* handling context for delete operation

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* small fix for test command

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-07-23 11:32:48 -07:00
Max Goncharenko
4c7ca97eac
Patch strategic merge preprocessing: implement anchor handling (#2156)
* finished walkMap

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* added validation to the patchStrategicMerge

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* finished fixing tests

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fixed part of old tests

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* patchStrategicMerge anchor preprocessing is finished

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fix #1915 and #1896

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* fix lint errors

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* removed debug logs

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* added failing test

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* Fix unnecessary deletion

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-07-23 10:53:37 -07:00
Shuting Zhao
882c826c7d fix linter issue
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-07-22 14:37:09 -07:00
Shuting Zhao
e3ba38b165 update JSON context with patched resource for chained mutate rules
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-07-22 14:23:03 -07:00
Jim Bugwadia
e4a311211b fmt and improve error messages
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-07-20 20:28:11 -07:00
Jim Bugwadia
30567be782 check for changes
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-07-20 09:36:12 -07:00
Max Goncharenko
0fdd349849
Changed error to info for NotFoundError in jsonContext (#2140)
* changed error to info for NotFoundError in jsonContext

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>

* raise log level for NotFoundError in jsonContext

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-07-14 14:50:28 -07:00
Jim Bugwadia
13caaed8b7
Feature/cosign (#2078)
* add image verification

* inline policy list

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

* cosign version and dependencies updates

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

* add registry initialization

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

* add build tag to exclude k8schain for cloud providers

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

* add build tag to exclude k8schain for cloud providers

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

* generate deep copy and other fixtures

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

* fix deep copy issues

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

* mutate images to add digest

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

* add certificates to Kyverno container for HTTPS lookups

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

* align flag syntax

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

* update docs

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

* update dependencies

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

* update dependencies

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

* patch image with digest and fix checks

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

* hardcode image for demos

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

* add default registry (docker.io) before calling reference.Parse

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

* fix definition

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

* increase webhook timeout

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

* fix args

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

* run gofmt

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

* rename for clarity

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

* fix HasImageVerify check

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

* align make test commands

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

* align make test commands

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

* align make test commands

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

* fix linter error

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

* format

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

* handle API conflict and retry

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

* format

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

* fix reviewdog issues

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

* fix make for unit tests

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

* improve error message

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

* fix durations

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

* handle errors in tests

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

* print policy name

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

* update tests

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

* add retries and duration to error log

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

* fix time check in tests

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

* round creation times in test

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

* fix retry loop

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

* remove timing check for policy creation

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

* fix e2e error - policy not found

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

* update string comparison method

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

* fix test Generate_Namespace_Label_Actions

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

* add debug info for e2e tests

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

* fix error

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

* fix generate bug

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

* fix format

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

* add check for update operations

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

* increase time for deleteing a resource

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

* fix check

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

Co-authored-by: Shuting Zhao <shutting06@gmail.com>
2021-07-09 18:01:46 -07:00
shuting
6afe86c54e
Apply pod's rules if the owner is not k8s pod-controllers (#2107)
* apply pod's rules if the owner is not k8s pod-controllers

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

* add unit tests

Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-07-09 14:44:38 +05:30
Vineeth Reddy
eeb4e4ff0f
turn preconditions error to info log (#1926)
* turn preconditions error to info log

Signed-off-by: vineethvanga18 <reddy.8@iitj.ac.in>

* minor change

Signed-off-by: vineethvanga18 <reddy.8@iitj.ac.in>

* further changes

Signed-off-by: vineethvanga18 <reddy.8@iitj.ac.in>

* resolve conflicts

Signed-off-by: vineethvanga18 <reddy.8@iitj.ac.in>

* add precondition flag

Signed-off-by: vineethvanga18 <reddy.8@iitj.ac.in>

* NotFoundError -> Info

Signed-off-by: vineethvanga18 <reddy.8@iitj.ac.in>
2021-07-07 17:37:44 +05:30
Max Goncharenko
fdaa73b175
Forbid variables in match/exclude/patchesJson6902.path sections (#1940)
* forbid variables in match/exclude/patchesJson6902.path sections

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* fix e2e test

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* edits related to the PR comments

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-07-02 19:17:40 +05:30
Max Goncharenko
6d0ad5598e
Jmespath notfound error (#1907)
* return err, if variable path could not be resolved

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* fixed {{@}} behavior

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* fix json merge logic

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* add e2e tests for Flux use case

Signed-off-by: Maxim Goncharenko <goncharenko.maxim@apriorit.com>
2021-07-01 22:56: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
Arsh Sharma
fbc80cdfae
adding support for multiple names in match and exclude blocks (#2010)
* add names in rd struct

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* added checking logic

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* updated yamls

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* wip: fix empty set problem

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* working with exclude

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* fixing name and names

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* added error if both name and names are specified

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* added tests

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* changed empty set logic, fixed whitespaces and comments

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>

* fix match and exclude bug

Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
2021-06-28 22:31:22 -07:00
treydock
3b1fd912cb
Move log to debug for wildcard pattern matching (#2064)
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
2021-06-23 16:48:09 -07:00
Arsh Sharma
7e9be24d90
updating minio verison (#1956) 2021-06-09 19:16:26 -07:00
RinkiyaKeDad
29c6e901ab added test, removed comment
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
2021-06-03 11:16:50 +05:30
RinkiyaKeDad
e94479717c fixed spacing problem in operators
Signed-off-by: RinkiyaKeDad <arshsharma461@gmail.com>
2021-06-02 12:16:54 +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
Max Goncharenko
158b58f819
Fix {{@}} behavior (#1908)
* fixed {{@}} behavior

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* removed white space from test

Signed-off-by: Max Goncharenko <kacejot@fex.net>
2021-05-13 12:27:45 -07:00
shuting
62dfab7f96
Removes check for strategicMergePatch in forceMutate (#1898)
* Pass by value in policy cache

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

* Removes check for strategicMergePatch in forceMutate

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

* Removes failed test

Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-05-07 18:07:41 -07:00
Pooja Singh
c0be318788
Merge pull request #1866 from treydock/test-error-handling
Improved error handling for test command
2021-05-05 16:05:02 +05:30
Thoro
e80d18e692
Add function label_match, to use matchLabel in JMESPath, usage: label_match(labels_from_network_policy, labels_from pod) bool, Remove validation for JMESPath (#1862)
Signed-off-by: Thomas Rosenstein <thomas@thoro.at>
2021-05-04 09:28:30 -07:00
Trey Dockendorf
beabeddb81 Fix reviewdog failure
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
2021-05-04 11:14:07 -04:00
Trey Dockendorf
d7886bddc9 Fix tests with variables to use Mock store
Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>
2021-05-03 19:54:19 -04:00
Vyankatesh Kudtarkar
a0193e13e5
test cases for match/exclude GVK (#1851)
* Fix Dev setup

* add test_cases for GVK

Co-authored-by: vyankatesh <vyankatesh@neualto.com>
2021-04-29 10:58:17 -07:00
Pooja Singh
1e4c950104
Feature/1515 - handle configmap and api variable cli (#1789)
* added store package

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* added changes to handle api and configmap variables in cli

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* removed comments

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* refactoring code

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* added test case for mutation

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* added test case for validation

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>

* code improvement

Signed-off-by: NoSkillGirl <singhpooja240393@gmail.com>
2021-04-29 10:09:44 -07:00
Max Goncharenko
0776b438d3
Support operators (>=, <, etc ...) on list values (#1838)
Signed-off-by: Max Goncharenko <kacejot@fex.net>
2021-04-28 13:31:55 -07:00
Max Goncharenko
9da2d44ee1
Fix #1737: forceMutate does not handle StrategicMerge patchesJson6902 (#1775)
* Fix #1737: forceMutate does not handle StrategicMerge patchesJson6902

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* go fmt

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* updated PR due to the comments

Signed-off-by: Max Goncharenko <kacejot@fex.net>
2021-04-28 13:12:44 -07:00
Max Goncharenko
6a0305674a
JMESPath custom functions (#1772)
* JMESPath: Support regex expressions

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* JMESPath: Add string functions

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* Removed {{$}} variable handling logic

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* Name all functions in snake case; Update error message; Fix {{@}} behavior

Signed-off-by: Max Goncharenko <kacejot@fex.net>
2021-04-16 16:17:00 -07:00
shuting
f515bc5dbf
skip rule application if referred path not exist (#1806)
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-04-15 17:33:34 -07:00
shuting
081244a102
Fix array variables substitution (#1800)
* fix array variables substitution

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

* Add ability to marshal complex vars to string

Signed-off-by: Max Goncharenko <kacejot@fex.net>

* Added tests for variable substitution

Signed-off-by: Max Goncharenko <kacejot@fex.net>

Co-authored-by: Max Goncharenko <kacejot@fex.net>
2021-04-14 13:09:00 -07:00
Max Goncharenko
8050c4e77b
moved variable substitution to higher level to avoid unhandled cases (#1785)
Signed-off-by: Max Goncharenko <kacejot@fex.net>
2021-04-13 11:44:43 -07:00
Max Goncharenko
01004e1db0
Fix #1754 Invalid variable validation (#1770)
Signed-off-by: Max Goncharenko <kacejot@fex.net>
2021-04-06 10:56:06 -07:00
Jim Bugwadia
3cffc3654a
Merge pull request #1762 from realshuting/1757_default_image_info
Set default image registry and tag if not present
2021-04-01 13:40:13 -07:00
Shuting Zhao
1cf8efd472 set default image registry and tag if not present
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-04-01 09:50:34 -07:00
Shuting Zhao
cab81eadda operate on the copy of configmap data
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-03-31 15:22:25 -07:00
Shuting Zhao
4d01f76797 - fix variable validation; - update log level
Signed-off-by: Shuting Zhao <shutting06@gmail.com>
2021-03-31 13:24:36 -07:00
Jim Bugwadia
f29f6b0369 add comment
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-03-26 10:47:59 -07:00
Jim Bugwadia
908950c47a address comments
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-03-25 21:27:16 -07:00
Jim Bugwadia
72cdbafbae fix tests
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-03-25 18:11:32 -07:00
Jim Bugwadia
8d03f8c59e merge main
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-03-25 18:00:02 -07:00
Jim Bugwadia
6dff9e0ab9 merge and resolve conflicts
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-03-25 16:43:12 -07:00
Jim Bugwadia
4d70013e22
Merge pull request #1724 from MarcelMue/fix-apipath-validation
Make validateAPICall work with special characters in variables
2021-03-24 22:28:09 -07:00