1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2025-03-06 16:06:56 +00:00
Commit graph

907 commits

Author SHA1 Message Date
刘旭
8b4f222860
fix(gctx): fix gctx projection cache (#12226)
Signed-off-by: liuxu <liuxu623@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2025-02-27 08:23:23 +00:00
Mariam Fahmy
6359fd4a1a
feat: generate VAPs from VPs (#12222)
* feat: generate VAPs from VPs

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix codegen

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* fix chainsaw tests

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-25 20:27:29 +08:00
Mariam Fahmy
bbe2b838af
chore: add resource manifests in autogen tests (#12205)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-19 13:59:07 +00:00
Frank Jogeleit
fef88ab433
Validating policy audit annotations (#12115)
* feat: return single result from validating policy evaluation

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>

* feat: support audit annotations for validating policies

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>

* fix error message

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>

* feat: return single result from validating policy evaluation

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>

* feat: support audit annotations for validating policies

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>

* fix error message

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>

* fix testcase

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>

* rebase with main

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>

---------

Signed-off-by: Frank Jogeleit <frank.jogeleit@web.de>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-02-19 13:10:01 +00:00
Mariam Fahmy
e01e57355a
fix: modify celexception flake test (#12192)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-19 10:51:37 +00:00
Mariam Fahmy
76751b96b3
feat: support celexceptions in the CLI apply command (#12182)
* feat: support celexceptions in the CLI

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* feat: add unit tests

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-19 08:38:44 +00:00
Khaled Emara
2b28538bd3
feat(gctx): add jmespath caching through projections (#11833)
feat(gctx): move ready check to runtime

Signed-off-by: Khaled Emara <khaled.emara@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2025-02-18 15:51:14 +00:00
Mariam Fahmy
0625302c3d
fix: modify the client URL for finegrained validatingpolicies (#12171)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2025-02-14 21:35:41 +08:00
Mariam Fahmy
829ab94b11
fix CEL autogen (#12165)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-14 09:45:10 +00:00
shuting
ce2c27c2d2
fix: sort autogen resources list (#12162)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2025-02-13 12:49:39 +00:00
shuting
7ef2764365
feat: aggregate vpol.status.conditions (#12133)
* feat: add vpol status controller

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* chore: update ready API struct

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix: printer coloum

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix: update status cmp func

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* feat: support status.RBACPermissionsGranted

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2025-02-12 11:04:18 +00:00
shuting
813b80d3d9
fix: update match conditions for autogen rules (#12146)
* fix: update match conditions for autogen rules

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* fix: autogen match condition prefix

Signed-off-by: ShutingZhao <shuting@nirmata.com>

* chore: merge main

Signed-off-by: ShutingZhao <shuting@nirmata.com>

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: shuting <shuting@nirmata.com>
2025-02-12 08:34:19 +00:00
Mariam Fahmy
7d5750a717
chore: move celexceptions to the new group (#12143)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-11 19:05:22 +02:00
Mariam Fahmy
f012241a82
feat: add cel-autogen chainsaw tests (#12135)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2025-02-10 22:30:12 +00:00
Mariam Fahmy
a4c10f6bb4
feat: compile and evaluate polex's match conditions (#12113)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-06 15:30:59 +02:00
Mariam Fahmy
04efe351a7
chore: remove polex match constraints (#12103)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-05 17:56:58 +00:00
Mariam Fahmy
970c255765
feat: validate CELPolicyExceptions (#12083)
* feat: validate CELPolicyExceptions

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

* chore: add cel-policy-exceptions tests in the CI

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-02-05 15:01:11 +00:00
Charles-Edouard Brétéché
8fc6e78c16
feat: add validating policies to reports aggregation (#12096)
* feat: add validating policies to reports aggregation

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* chainsaw test

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* unit tests

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-02-05 13:21:28 +00:00
Charles-Edouard Brétéché
c78ab6654c
tests: add chainsaw test for image data loading (#12077)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-02-04 09:22:43 +00:00
Charles-Edouard Brétéché
b908b1037a
feat: consider validation actions (#12072)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-02-04 06:29:40 +02:00
Charles-Edouard Brétéché
e55a90cc4b
feat: implement match conditions failure policy (#12071)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-02-04 00:04:26 +02:00
Charles-Edouard Brétéché
884a77a044
feat: add context provider in admission handling (#12070)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-02-03 19:11:31 +02:00
Charles-Edouard Brétéché
0c5b74b122
chore: add validating policies chainsaw tests (#12062)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-02-03 20:53:57 +08:00
Mariam Fahmy
4c950dcb32
feat: use v1 of ValidatingAdmissionPolicies (#12050)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-01-31 14:21:43 +00:00
Charles-Edouard Brétéché
5b2d44afc7
fix: test typo (#12016)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-01-28 09:50:15 +00:00
Charles-Edouard Brétéché
620ddd80d1
test: add more cli vp tests (#12006)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-01-27 17:17:08 +08:00
Charles-Edouard Brétéché
6535cb763d
fix: cli schema generation (#11959)
* fix: cli schema generation

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* fix: cli schema generation

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-01-20 22:00:41 +08:00
Charles-Edouard Brétéché
5cc408dddb
feat: use policy provider (#11947)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2025-01-20 09:43:05 +00:00
abhashsolanki18
d2e6759115
fix:[Bug] [CLI] CEL scanning a namespace yaml object makes Kyverno crash (#11834)
* fix:[Bug] [CLI] CEL scanning a namespace yaml object makes Kyverno crash

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>

* Fix nil pointer dereference in namespace handling for ValidatingAdmissionPolicy.

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>

* added test for namespace resource

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>

* fixed test

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>

* fixed test

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>

* fixed test, combined binding and policy

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>

---------

Signed-off-by: abhashsolanki18 <abhashsolanki18@gmail.com>
2025-01-16 13:39:24 +00:00
Mariam Fahmy
2016f82600
chore: use v1 of VAPs in the tests (#11929)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2025-01-15 14:08:35 +00:00
Charles-Edouard Brétéché
823661e4af
fix: sorting in fix test command (#11869) 2025-01-08 13:30:15 +00:00
Vishal Choudhary
f51a49fcaf
fix: update chainsaw test apply timeout to 30s (#11794)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-12-20 09:59:42 +00:00
Ammar Yasser
739e6a21c4
Mutate existing CLI support (#11453)
* feat: Add flags for target resources and add fake client initialization

Signed-off-by: aerosouund <aerosound161@gmail.com>

* feat: Add fake discovery client and cluster bool in the policy processor

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Use the full mutation engine policy response in the engine response

Signed-off-by: aerosouund <aerosound161@gmail.com>

* feat: Extract mutated targets from the policy responses and print them out

Signed-off-by: aerosouund <aerosound161@gmail.com>

* feat: Add TargetResources field in the cli test schema

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Generate CLI crds

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: modify checkResult to take an arbitrary actual resource and resource name

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: change getAndCompareResource to take a resource name and cascade it to GetResourceFromPath

Signed-off-by: aerosouund <aerosound161@gmail.com>

* test: Create a simple test to test mutate existing in the CLI

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Allow GetResourceFromPath to select a resource with a name from a multi resource yaml

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Modify the runTest command to return the TestResponse type

- Create a fake client, load the target resources in it and use it in the PolicyProcessor.
- Create the TestResponse which contains Trigger and Target fields, each is a map of gvk/name to the responses corresponding to that resource.

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Rewrite output.go to use the TestResponse type

- Check for both target and trigger
- Create logic for appending the resource array in case no resources are passed
- Move row creation logic into a separate method to avoid code duplication
- Extract the proper target resource based on rule type
- Create a function to extract mutated target from the engine response

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Move tests to the correct folder

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Use apiVersion/Kind/Name as the key in the test responses

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Use the apiVersion/Kind/name key schema in checking results and fix invalid resource name checking for generate policies

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Use better variable names for rows

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Account for Generate resources being an array

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Use generated resource name in checking the results and printing output

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Uncomment checks printing

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Remove bug in engine response creation

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Move the generate logic into an else block

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Fix namespace fetching bug in cel validator

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Use pointer to int in the test counter

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Remove redundant method

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Skip resources not being found in the manifests

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Create another field in the engine to denote if this is a cluster engine or an offline engine

Simply checking for the client being nil is no longer enough because for cli operations the client will be a fake client
A pointer to bool is chosen because callers who don't necessarily know what to pass should be able to pass nil

Signed-off-by: ammar <ammar.yasser@vodafone.com>

* fix: Add extra argument in fake client initiation

Signed-off-by: ammar <ammar.yasser@vodafone.com>

* fix: add extra argument in fuzz test

Signed-off-by: ammar <ammar.yasser@vodafone.com>

* fix: Add extra arg

Signed-off-by: ammar <ammar.yasser@vodafone.com>

* fix: Handle resources specified as ns/name as this schema will be deprecated in favor of apiVersion/Kind/Name

Signed-off-by: ammar <ammar.yasser@vodafone.com>

* fix: Fix linter complaints

Signed-off-by: ammar <ammar.yasser@vodafone.com>

* fix: Use comma separation as array separators as kubernetes names don't support commas

To avoid undefined array length on splitting on /
using commas will result in a fixed length since all resources will have an apiVersion, kind, namespace and name

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Change resource array type to an array of any instead of array of string

To support the use of a string or a TestResourceSpec

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Expect the resource array to be an array of string or array of TestResourceSpec

Assert that an array element is either of these types and match the resources in both cases according to the element type
Expect that the key in responses is now separated by commas instead of slashes

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Expect that the resource array is now of type array of any and modify tests that use it

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Skip response check if the policy name isnt whats in the result

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Match the name if its specified as ns/name

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Fix linter complaint

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Run codegen

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Create CLI CRDs

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Run codegen

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Fix linter complaints

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Cleanup invalid code used in FixTest to adapt it to the schema changes

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Check if resource is nil before extracting

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: use the loadResources method to open targets in a directory

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Account for target resources with the same name but different namespaces

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Add CLI test for mutate existing with the same name

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Infer resource name and namespace from the actual resource and account for resources with the same name and namespace but different kinds

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: remove extra line

Signed-off-by: aerosouund <aerosound161@gmail.com>

* feat: Add printing mutate existing resources to the output or to a file

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Minor fixes

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: fix linter complaint

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: codegen

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Revert result back to error

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Use io discard to not print resources in the test command

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Update vague comments and remove outdated ones

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Integrate mutate existing changes with diff generation

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Move resource key generation into a function

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Add a mutate existing test that fails

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: fix linter complaint

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Remove redundant comment

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Fix array of any assignment in cli test

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Dont check duplicate strings for field that is an array of any

Signed-off-by: aerosouund <aerosound161@gmail.com>

* bug: Fix appending to the wrong array

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: run fix tests

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Run fix tests

Signed-off-by: aerosouund <aerosound161@gmail.com>

---------

Signed-off-by: aerosouund <aerosound161@gmail.com>
Signed-off-by: ammar <ammar.yasser@vodafone.com>
Signed-off-by: Ammar Yasser <aerosound161@gmail.com>
Co-authored-by: ammar <ammar.yasser@vodafone.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-12-19 07:42:54 +00:00
Mohd Kamaal
e771896541
distributed labels in group, version, and resource so it doesn't exceed (#11620)
* change label to hash if exceed 63 limit char

Signed-off-by: Mohd Kamaal <mohdkamaal2019@gmail.com>

* Distribute GVR labels into 'group', 'version', and 'resource' to avoid exceeding character limits

Signed-off-by: Mohd Kamaal <mohdkamaal2019@gmail.com>

---------

Signed-off-by: Mohd Kamaal <mohdkamaal2019@gmail.com>
Co-authored-by: Kamaal <kamaal@macs-MacBook-Air.local>
Co-authored-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-12-16 10:36:34 +05:30
Vishal Choudhary
174534b518
fix: properly verify precondition in old object validation (#11644)
* fix: properly verify precondition in old object validation

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

* fix: tests

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

* fix: assert bug

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

* fix: properly update the values

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

---------

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-12-04 06:32:12 +00:00
Vishal Choudhary
ec658b7abf
fix: api call chainsaw tests (#11682)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-12-02 15:46:37 +00:00
Mariam Fahmy
f36d5410ea
fix: check the patchedResources in kyverno-test (#11686)
Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2024-12-02 12:59:12 +00:00
Nishanth Reddy
95baeaa4e9
fix: return nil error when trigger resource not found for a subresouces (#11594)
* fix: return nil error when trigger resource not found for a subresource kind

Signed-off-by: Nishanth Reddy <nishanth.reddy@doordash.com>

* chore(deps): bump codecov/codecov-action from 4.6.0 to 5.0.0 (#11597)

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 4.6.0 to 5.0.0.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md)
- [Commits](b9fd7d16f6...968872560f)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* chore(deps): bump sigs.k8s.io/structured-merge-diff/v4 (#11596)

Bumps [sigs.k8s.io/structured-merge-diff/v4](https://github.com/kubernetes-sigs/structured-merge-diff) from 4.4.1 to 4.4.3.
- [Release notes](https://github.com/kubernetes-sigs/structured-merge-diff/releases)
- [Changelog](https://github.com/kubernetes-sigs/structured-merge-diff/blob/master/RELEASE.md)
- [Commits](https://github.com/kubernetes-sigs/structured-merge-diff/compare/v4.4.1...v4.4.3)

---
updated-dependencies:
- dependency-name: sigs.k8s.io/structured-merge-diff/v4
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* fix: use generate name for background scan reports (#11586)

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>

* chore(deps): bump github/codeql-action from 3.27.3 to 3.27.4 (#11598)

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3.27.3 to 3.27.4.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](396bb3e453...ea9e4e3799)

---
updated-dependencies:
- dependency-name: github/codeql-action
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* feat(ci): test upgrade conformance (#11498)

Signed-off-by: Khaled Emara <khaled.emara@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>

* add chainsaw tests

* add kubectl-evict to githubpath

* add readme

---------

Signed-off-by: Nishanth Reddy <nishanth.reddy@doordash.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Khaled Emara <khaled.emara@nirmata.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Khaled Emara <khaled.emara@nirmata.com>
2024-11-20 15:41:06 +08:00
Netanel Kadosh
cef7be1fdc
feat: Add Manifest Index to ImageRegistry context (#9883)
* feat: Add Manifest Index to ImageRegistry context

Signed-off-by: Netanel Kadosh <kadoshnetanel@gmail.com>

* test: adding manifest list tests

Signed-off-by: Netanel Kadosh <kadoshnetanel@gmail.com>

---------

Signed-off-by: Netanel Kadosh <kadoshnetanel@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-11-14 08:10:25 +00:00
Vishal Choudhary
b35aaab898
fix: match failure action case insensitively for validating old object (#11486)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-11-07 00:10:56 +08:00
Khaled Emara
f07007f864
fix(validate): custom match conditions errors (#11461)
* fix(validate): custom match conditions errors

Signed-off-by: Khaled Emara <khaled.emara@nirmata.com>

* test(webhook): failing match conditions

---------

Signed-off-by: Khaled Emara <khaled.emara@nirmata.com>
Co-authored-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2024-11-05 11:59:09 +00:00
Mariam Fahmy
646267b229
fix: add celPreconditions in autogen rules (#11503) 2024-10-31 14:12:22 +00:00
Vishal Choudhary
34dc0e52a2
fix: use digest instead of tag for custom-sigstore-tuf conformance test (#11492)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-10-30 14:42:20 +00:00
Khaled Emara
0b6d053545
feat(ci): enhance load testing (#11429)
Signed-off-by: Khaled Emara <khaled.emara@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-10-18 10:20:12 +00:00
Ammar Yasser
9a8e35d787
Selector with mutate target (#11208)
* feature: Add LabelSelector as a field of resource spec to allow fetching by labels

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Generate CRDs

Signed-off-by: aerosouund <aerosound161@gmail.com>

* feat: Add the capability to fetch with label selector

- Add the label selector as a parameter to GetResources of the engine api client and the dclient.
- Use the label selector with list options in the dclient.
- convert a metav1.LabelSelector to a labels.Selector before fetching to be able to convert it to a string to be used with ListOptions.

Signed-off-by: aerosouund <aerosound161@gmail.com>

* feat: Pass label selector to the GetResources method

Signed-off-by: aerosouund <aerosound161@gmail.com>

* feat: Return the resource selector when resolving spec

Signed-off-by: aerosouund <aerosound161@gmail.com>

* fix: Instantiate the fake client schema using the passed gvrToListKind map and by inferring schema from passed resources

All tests that use List will fail because the fake client doesn't infer the schema from the passed resources.
gvrToListKind can't be fully deprecated as some parts of kyverno use the fake client without passing resources to it (resource generation). And so both approaches have to be supported.

References:
- https://github.com/kubernetes/client-go/issues/983
- 46c1ad3baa

Signed-off-by: aerosouund <aerosound161@gmail.com>

* test: Add labelSelector unit test to mutate existing test.

- Remove the unwanted call to GetResource.
- Pass an empty map of GVR to string to the fake client constructor.

Signed-off-by: aerosouund <aerosound161@gmail.com>

* test: Add chainsaw test

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Run codegen

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Generate helm CRDs

Signed-off-by: aerosouund <aerosound161@gmail.com>

* refactor: Put the LabelSelector in a separate struct

Many types use the ResourceSpec struct and not all of them support label selectors.
This removes the field into a separate schema dedicated to target selection called TargetSelector.
It has the ResourceSpec and the selector.

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Run codegen after modifying selector comment

Signed-off-by: aerosouund <aerosound161@gmail.com>

* chore: Run codegen

Signed-off-by: aerosouund <aerosound161@gmail.com>

---------

Signed-off-by: aerosouund <aerosound161@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-10-16 11:17:08 +00:00
Vishal Choudhary
a7dd02a6d1
feat: update engine response.generatedResources to support multiple resource (#11398)
* fix: manually add generated_resources property

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

* fix: update engine response

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

* fix: nil check before deferences

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

* fix: outdated errors

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

* fix: linter

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>

---------

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-10-15 14:59:18 +08:00
Charles-Edouard Brétéché
6dc328fb0c
chore: add delay after policy gets ready (#11344)
* chore: add delay after policy gets ready

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* Update test/conformance/chainsaw/_step-templates/policy-ready.yaml

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-14 11:39:43 +00:00
Shivam Kumar
1114f0af36
Added chainsaw test for the ttl based cleanup poliy (#11328)
* Added chainsaw test for the ttl based cleanup poliy

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>

* Updated the ttl/propagation-policy chainsaw test structure

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>

* Enhanced the chainsaw tests for the ttl/propagation-policy

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>

* orphan

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* Update test/conformance/chainsaw/ttl/propagation-policy/orphan/chainsaw-test.yaml

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

* Improved chainsaw tests for foreground and background propagation policies

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>

* Fix background policy test: assert pod is deleted after job removal

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>

* Fix: changed pod-deleted-assert.yaml to pod-assert.yaml in the foreground

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>

* Change assert to error check for pod deletion in foreground test

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>

* Removed the pod-deleted-assert.yaml file

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>

---------

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-07 19:25:33 +00:00
Vishal Choudhary
00fd6d47f8
fix: transfer image verify iamges to kyverno (#11340)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2024-10-07 15:56:12 +00:00
Charles-Edouard Brétéché
4abdbff74a
chore: use more chainsaw step templates (#11324)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-07 11:44:33 +00:00