1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00
Commit graph

3823 commits

Author SHA1 Message Date
dependabot[bot]
ce14eed715 sibling of 4b820557fc 2024-12-12 07:13:09 +00:00
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
Meet Soni
cf5a5b12ae
feat: add/improve error logs (#11657)
Signed-off-by: Meet Soni <meetsoni3017@gmail.com>
2024-11-25 13:37:43 +00:00
Charles-Edouard Brétéché
be4705faa3
fix: use deleteOptions in cleanup controller (#11662)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-11-25 16:18:58 +05:30
Ammar Yasser
d61f87e0f9
Context vars with labelselector (#11608)
* refactor: Treat all of the target spec as a single object while replacing variables

Serialize it into a map string interface then back to a target seletor before returning

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

* test: Add scenario for variables in the label selector test

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

* Fix: Capitalize error message

Co-authored-by: shuting <shuting@nirmata.com>
Signed-off-by: Ammar Yasser <aerosound161@gmail.com>

* Fix: Adjust error message specification to mention target rather than selector

Co-authored-by: shuting <shuting@nirmata.com>
Signed-off-by: Ammar Yasser <aerosound161@gmail.com>

* fix: Pass the target selector only during variable replacement

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

---------

Signed-off-by: aerosouund <aerosound161@gmail.com>
Signed-off-by: Ammar Yasser <aerosound161@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-11-20 10:36:55 +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
Shivam Kumar
30d475aaae
Passed the deleteOptions to the DeleteResource client (#11484)
* Passed the deleteOptions to the DeleteResource client

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

* fix:minor change in the DeleteResource client

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

---------

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-11-19 09:26:17 +00:00
Frederic M
5e79e5044a
fix(background-controller): reduce logging for URs (#11616)
Signed-off-by: Frederic Mereu <frederic.mereu@gaming1.com>
2024-11-18 13:22:26 +00:00
Vishal Choudhary
c1f8b2ed96
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>
2024-11-15 09:37:31 +00:00
Vishal Choudhary
bf83f37984
fix: add a check for nil rule response (#11591) 2024-11-14 15:13:23 +00:00
Tomas Aschan
07f5e9be08
Add missing error check (#11587)
Signed-off-by: Tomas Aschan <tomasl@spotify.com>
2024-11-14 13:37:53 +00: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
shuting
244dbe19cf
fix: update explicit webhook based on the policy type (#11580)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2024-11-13 21:09:36 +05:30
Davanum Srinivas
d76107c2c9
Set the UserAgent in client-go based calls to kube-apiserver (#11569)
Signed-off-by: Davanum Srinivas <davanum@gmail.com>
2024-11-12 09:34:32 +00:00
Ayush Chandekar
e64a5ff647
Add SHA1 and MD5 hash functions to JMESPath (#11564)
Signed-off-by: ayu-ch <ayu.chandekar@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-11-12 08:53:44 +00:00
Utsab Sapkota
7501ec8f57
toggle for autogen version (#11535)
* toggle for autogen version

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

* Updated toggle for autogenv2

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

---------

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>
2024-11-08 11:12:24 +00:00
shuting
a26f588b86
fix: panic for nil rule response when processing old object (#11550)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2024-11-07 09:48:33 +00:00
shuting
6b99fb0653
fix: add 'immutable fields in the policy validation msg for FluxCD' (#11549)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2024-11-07 08:54:33 +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
Vishal Choudhary
7c6f0e7d59
fix: remove logic that uses annotation to skip image verification (#11529)
* fix: add safety check for verify image annotation change

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

* fix: test

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

* fix: remove logic that uses annotation to skip image verification

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

* fix: remove test

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

---------

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-11-06 17:29: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
Mohd Kamaal
fdef54d796
set the defautl namespace for policy (#11505)
Signed-off-by: Kamaal <mohdkamaal2019@gmail.com>
Signed-off-by: Kamaal <kamaal@macs-MacBook-Air.local>
Co-authored-by: Kamaal <kamaal@macs-MacBook-Air.local>
Co-authored-by: shuting <shuting@nirmata.com>
2024-11-05 10:59:20 +00:00
Utsab Sapkota
982b3fdcdc
Autogenv2 rule evaluation logic (#11434)
* Autogenv2 rule evaluation logic

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

* Fixed lint error

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

* resolve: comments

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

* Updated resource reference in extractPodSpec

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

---------

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>
2024-11-05 09:14:24 +00:00
Fleezesd
6b87d70b39
chore: change controller rated limiting queue (#11509)
Signed-off-by: Fleezesd <1253576349@qq.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-11-04 13:48:58 +00:00
Mariam Fahmy
5106d5227b
fix: use webhook object instead of a list (#11516)
* fix: use webhook object instead of a list

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

* chore: add changelog

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

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2024-11-04 10:19:35 +00:00
Mariam Fahmy
646267b229
fix: add celPreconditions in autogen rules (#11503) 2024-10-31 14:12:22 +00:00
Mariam Fahmy
2ff41d10ca
fix: add emitWarning field in v2beta1 (#11489)
* fix: add emitWarning field in v2beta1

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

* fix: add artificathub changes

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

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2024-10-30 15:17:59 +00:00
Vishal Choudhary
89e3f61897
feat: skip azure keychain based login for mcr registry (#11480)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-10-29 11:07:47 +00:00
Shivam Kumar
1bc76f6d7f
Introduced the DeletionPropagationPolicy field in CleanupPolicy and C… (#11368)
* Introduced the DeletionPropagationPolicy field in CleanupPolicy and ClusterCleanupPolicy

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

* Add DeletionPropagation field to API versions and implement handling in controller.go for improved cleanup functionality

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

* removed the type for DeletionPrpagationPolicy

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

* Add DeletionPropagationPolicy to CleanupPolicy

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

* Updated DeletionPropagationPolicy in different api versions

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

* Removed the string type declaration from the DeletionPropagationPolicy

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

* Reverted the changes

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

* Added the DeletionPropagation to the cleanup/controller.go

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

* Fixed minor bugs

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

* Fixed the verify-codegen error

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

* Revert "Fixed the verify-codegen error"

This reverts commit 05428bd99b187b93086dc403e674f06f8eeb5a40.

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

* Changed the field's type string to pointer

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

* Fixing the linter issue

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

* changing the v1 to metav1 in the controller.go

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

* Resolved linter problem

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

* fix: codegen

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

* Refactor DeletionPropagationPolicy to use a pointer type

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

* Fixed linter

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

* Refactor String type to pointer in controller.go

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

* fixing Linter

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

* Make DeletionPropagationPolicy optional in validation

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

* fix: Update validation for DeletionPropagationPolicy in CleanupPolicySpec

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

* Refactored deletion policy handling

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

* Resolved linter

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

* Updated logic to set deletion options based on user-provided deletion policy.

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

* Removed default deletion policy assignment in the deletion logic

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

* Fix: removed default deletion policy in the deletion logic

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

* Fixing minor issues

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

* Fix: Linter

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

* fix: propagation policy

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

* codegen

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

---------

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-22 13:04:01 +02:00
Mariam Fahmy
cbfeb32b1a
fix[breaking]: disable exceptions by default (#11426)
* fix[breaking]: disable exceptions by default

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

* fix chainsaw tests

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

* fix: add warning in helm chart for exceptions

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

---------

Signed-off-by: Mariam Fahmy <mariam.fahmy@nirmata.com>
2024-10-22 06:07:11 +00:00
Vishal Choudhary
4e3f297da2
fix: update match logic for old object validation (#11427)
* fix: update match logic for old object validation

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

* fix: linter

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

* fix: failing test due to user info

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

* fix: debug logs

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-21 14:10:06 +00:00
Charles-Edouard Brétéché
3580034fa1
feat: improve webhooks rules generation (#11419)
* feat: improve webhooks rules generation

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

* iterate per rule

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

* reduce rules

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

* rework default operations

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

* consider subresource

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

* aggregate operations

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

* sort rules

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

* ephemeralcontainers

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

* operations

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

* aggregation

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

* operations type

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

* generate rules

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

* nits

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

* generate

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

* all operations

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

* collector changes

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

* account for exclusions

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>

* fix exclusions when no operations specified

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>
Co-authored-by: shuting <shuting@nirmata.com>
2024-10-21 12:56:21 +00:00
Vishal Choudhary
e3b74f1384
feat: add options to configure resync period for informers in helm chart (#11420)
* feat: add options to configure resync period for informers in helm chart

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

* fix: codegen

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

---------

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-10-17 15:23:17 +08:00
Charles-Edouard Brétéché
a5e082303d
refactor: introduce autogen interface (#11418)
* refactor: introduce autogen interface

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

* fix linter

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-16 15:24:37 +02: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
Charles-Edouard Brétéché
4d1683d167
refactor: move autogen v1 and v2 packages (#11416)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-16 08:51:38 +00:00
Charles-Edouard Brétéché
884a6389c6
fix: use autogen v2 in exceptions controller (#11397)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-16 07:41:20 +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
Utsab Sapkota
c44b532d73
Added GetNames and GetKinds function (#11327)
* Added GetNames and GetKinds function

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

* fix: updated func GetAutogenRuleNames

Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>

* fix: exception controller

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

* fix: autogen status

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

---------

Signed-off-by: utsab818 <utsabsapkota4231@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-14 14:49:20 +02:00
Vishal Choudhary
ec546e6fb4
feat: add helm configuration for reporting in different rules (#11376)
* feat: add helm configuration for reporting in different rules (forgot signoff)

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

* fix: linter and tests

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

* feat: rename reporting.imageVerification

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

---------

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-10-11 09:42:29 +00:00
Ammar Yasser
c56c60c136
Reports controller circuit breaker (#11329)
* chore: Fix spelling issue in breaker logging

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

* feat: Introduce circuit breaking in background report scanning

Add the breaker as a field of the background controller and use it in the storeReport method which handles report creation

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

* feat: Add required flags and instantiation for the circuit breaker in the background reports controller

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

* fix: Add flag for max background reports in the reports controller

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

* chore: Update flag description to use ephemeralreports instead of background reports

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

* chore: Use a less verbose description for the flag

Co-authored-by: shuting <shuting@nirmata.com>
Signed-off-by: Ammar Yasser <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: Jim Bugwadia <jim@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2024-10-11 07:34:41 +00:00
Khaled Emara
8bf704edc5
feat(cache): use shallow copy instead of deep copy (#11378)
Signed-off-by: Khaled Emara <khaled.emara@nirmata.com>
2024-10-10 13:32:38 +03:00
Vishal Choudhary
21fd92e3e4
feat: add --backgroundReports flag to disable mutateexisting and generate reporting (#11361)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-10-09 10:43:59 +00:00
Jim Bugwadia
2289720ba0
add support for shallow substitution (#11058)
* add support for shallow substitution

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

* linter issue

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

* exclude EphemeralReport and ClusterEphemeralReport

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

* update codegen

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

---------

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-08 19:43:04 +00:00
Pradeep Lakshmi Narasimha
373f942ea9
fix: Allow images to be pulled from insecure registry when allowInsecureRegistry flag is set to true (#10934) (#11243)
* fix: Allow images to be pulled from insecure registry when allowInsecureRegistry flag is set to true (#10934)

Signed-off-by: Pradeep Lakshmi Narasimha <pradeep.vaishnav4@gmail.com>

* Update pkg/registryclient/client.go

Signed-off-by: Vishal Choudhary <vishal.chdhry.work@gmail.com>

---------

Signed-off-by: Pradeep Lakshmi Narasimha <pradeep.vaishnav4@gmail.com>
Signed-off-by: Vishal Choudhary <vishal.chdhry.work@gmail.com>
Co-authored-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: Vishal Choudhary <vishal.chdhry.work@gmail.com>
2024-10-07 15:29:12 +00:00
Charles-Edouard Brétéché
bd3a6f066b
chore: use ptr package (#11346)
* chore: use ptr package

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

* nit

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-07 14:10:20 +00:00
Shivam Kumar
9f5e75a2b5
Test/ttl cleanup deletion policy (#11277)
* Added propagationPolicy to TTL controller for resource deletion

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

* Added per-resource deletion policy with optional global default

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

* Fix: Added nil check for annotations to prevent runtime errors

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

* Fix: Moved logic for retrieving propagation policy from annotations to a dedicated function

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

* Fix: Resolve merge conflict in controller.go and update propagation policy handling
- Added missing gvr field from main branch
- Improved annotation naming as per team discussion
- Moved propagation policy logic closer to usage

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

* Simplified propagation policy logic

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

* Add unit tests for controller.go

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

* Removed the test file for controller.go and fixed the lint error

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

* test: add unit tests for deletion propagation policy in TTL-based cleanup

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

* Resolved conflicts

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

* Resolved conflicts

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

* Resolved merge conflict

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

* Fix:Updated the unit tests

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

* Fix: Removed the method receiver from determinePropagationPolicy as it does not require access to the controller struct

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

* Fix: Fixed the formatting issue

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

* Fix: removed the switch statement inside the test case

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

* Updated the controller.go

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

* Resolved the formatting issue

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

* Fixing the deleted resource label in controller.go

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

* Fixed the linter issue

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

---------

Signed-off-by: ShivamJha2436 <shivamkumar87148@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-07 13:44:55 +00:00
Vishal Choudhary
53922941d6
fix: isolate report creation context for mutate in admission (#11304)
Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
2024-10-07 13:17:35 +00:00
Utsab Sapkota
a5858cbb64
Updated autogenv2 package (#11212)
Signed-off-by: utsab818 <utsabsapkota4231@gmail.com>
2024-10-04 08:58:13 +00:00
Vishal Choudhary
fe49e97fba
feat: add reporting to mutate and generate rules (#11265)
* feat: add reports to standard mutatation

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

* feat: add warnings for permissions

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

* fix: remove unnecessary fields

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

* feat: add reporting to generate and mutate existing

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

* feat: add reporting to generate and mutate existing

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

* fix: codegen and add generate tests

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

* fix: linter

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

* fix: e2e matrix

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

* fix: cleanup

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

---------

Signed-off-by: Vishal Choudhary <vishal.choudhary@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2024-10-02 12:05:05 +00:00