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

747 commits

Author SHA1 Message Date
Danny__Wei
beeec06c7f
Add path_canonicalize custom JMESPath function (#2787)
* Add path_canonicalize custom JMESPath function

Signed-off-by: weiwei.danny <weiwei.danny@bytedance.com>

* Add CLI test for the custom path_canonicalize function

Signed-off-by: weiwei.danny <weiwei.danny@bytedance.com>

* remove the extra parameter

Signed-off-by: weiwei.danny <weiwei.danny@bytedance.com>

Co-authored-by: weiwei.danny <weiwei.danny@bytedance.com>
2021-12-06 12:10:34 +01:00
Sebastian Widmer
4c251bcffd
Add pattern_match custom JMESPath function analogous to regex_match (#2717)
* Add `pattern_match` custom JMESPath function analogous to `regex_match`

Signed-off-by: Sebastian Widmer <sebastian.widmer@vshn.net>

* Add CLI test for the custom `pattern_match` function

Signed-off-by: Sebastian Widmer <sebastian.widmer@vshn.net>
2021-11-30 00:13:07 +08:00
Jim Bugwadia
3c9430d2fc
handle missing predicate type (#2743)
* handle missing predicate type

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

* update github.com/docker/cli package for vulnerabilities

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

* fix go.mod vulnerabilities

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-11-22 10:49:21 -08:00
Kumar Mallikarjuna
7f95bee23c
Added time_since() custom JMESPath function (#2680)
* Added time_since() custom JMESPath function

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

* Remove time.Layout (not supported in Go 1.16)

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

* Modify time_since() for 3 arguments

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

* Add tests for functions_test.go

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

* Timestamp literals and tabulated tests

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

* Remove layout map and default to RFC3339

Signed-off-by: Kumar Mallikarjuna <kumarmallikarjuna1@gmail.com>
2021-11-17 21:17:17 +01:00
Anushka Mittal
94395ac243
Wildcard values (#2692)
* wildcard-support

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

* Added unit tests

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

* improvements in anyin and allin

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
2021-11-15 15:02:46 +01:00
Anushka Mittal
497514fd94
Fixes in new operators (#2704)
* fixes in operators to in many-to-one comparison

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

* corrected allnotin

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

* correction for duplicates

Signed-off-by: anushkamittal20 <anumittal4641@gmail.com>
2021-11-12 11:15:16 +01:00
Jim Bugwadia
50cb1859c3
add keyless verification (#2677)
* add keyless verification

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

* run make fmt

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

* fix linter warning

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

* wrap error with details

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-11-04 23:26:22 -07:00
Jim Bugwadia
5c16ee738a
redo variable validation (#2647)
* redo variable validation

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

* handle quotes for JMESPath - escaping

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

* fix tests and linter issues

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

* fix fmt

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-11-03 11:16:55 -07:00
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