* 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>
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>
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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* 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>
* fixed {{@}} behavior
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* removed white space from test
Signed-off-by: Max Goncharenko <kacejot@fex.net>
* 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>
* 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>