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

594 commits

Author SHA1 Message Date
shuting
a61dac613b
add a kuttl test cpol-data-sync-to-nosync-delete-rule (#6529)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-10 12:55:33 +00:00
shuting
4572eab750
fix: apply generate existing when a new rule is added (#6472)
* trigger generate existing when a new rule is added

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

* add a kuttl test

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

* refactor

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

* ignore existing rule updates

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

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-06 15:40:49 +00:00
shuting
ea306d6d7f
rename generateExistingOnPolicyUpdate to generateExisting (#6470)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-03 12:05:53 +01:00
shuting
0b359d07db
rename GenerateExistingOnPolicyUpdate to GenerateExisting (#6321)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-03 09:34:55 +00:00
shuting
264eaec049
fix: remove timestamp checks for the clone rule (#6439)
* remove timestamp checks

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

* add kuttl tests

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

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-03-01 15:49:05 +00:00
shuting
86fc31f63b
feat: add validations for generate immutable fields (#6328)
* add validations for generate immutable fields

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

* fix

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

* chore(deps): bump github.com/onsi/gomega from 1.26.0 to 1.27.0 (#6334)

Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.26.0 to 1.27.0.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.26.0...v1.27.0)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* Jmespath typo fix (#6342)

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

* chore(deps): bump golang.org/x/net from 0.6.0 to 0.7.0 (#6341)

Bumps [golang.org/x/net](https://github.com/golang/net) from 0.6.0 to 0.7.0.
- [Release notes](https://github.com/golang/net/releases)
- [Commits](https://github.com/golang/net/compare/v0.6.0...v0.7.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* chore(deps): bump zgosalvez/github-actions-ensure-sha-pinned-actions (#6348)

Bumps [zgosalvez/github-actions-ensure-sha-pinned-actions](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions) from 2.0.5 to 2.1.0.
- [Release notes](https://github.com/zgosalvez/github-actions-ensure-sha-pinned-actions/releases)
- [Commits](bd2868d14a...b9ddf6a515)

---
updated-dependencies:
- dependency-name: zgosalvez/github-actions-ensure-sha-pinned-actions
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* chore(deps): bump github.com/onsi/gomega from 1.27.0 to 1.27.1 (#6347)

Bumps [github.com/onsi/gomega](https://github.com/onsi/gomega) from 1.27.0 to 1.27.1.
- [Release notes](https://github.com/onsi/gomega/releases)
- [Changelog](https://github.com/onsi/gomega/blob/master/CHANGELOG.md)
- [Commits](https://github.com/onsi/gomega/compare/v1.27.0...v1.27.1)

---
updated-dependencies:
- dependency-name: github.com/onsi/gomega
  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>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: dump admission response (#6349)

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

* fix: use labels.Everything in userinfo clusterroles matching (#6351)

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

* update k8s.gcr.io to registry.k8s.io (#6340)

Signed-off-by: Rayan Das <rayandas91@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* Notary v2 (#6011)

* fix make debug-deploy

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

* improve log messages

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

* initial update

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

* initial update

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

* update registry credentials handling order

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

* comment out ACR helper - breaks anonymous image pull

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

* merge main and refactor verifiers

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

* fix opt init

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

* remove local address

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

* update to NotaryV2 RC

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

* fix fmt

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

* update deps

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

* format imports

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

* remove env and no-op statement

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

* fix merge issues

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

* fix linter issue

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

* remove unused field

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

* make fmt

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

* renable ACR credential helper

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

* Update .vscode/launch.json

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

---------

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: shuting <shutting06@gmail.com>

* chore(deps): bump fluxcd/flux2 from 0.39.0 to 0.40.0 (#6362)

Bumps [fluxcd/flux2](https://github.com/fluxcd/flux2) from 0.39.0 to 0.40.0.
- [Release notes](https://github.com/fluxcd/flux2/releases)
- [Changelog](https://github.com/fluxcd/flux2/blob/main/.goreleaser.yml)
- [Commits](978cc0c5b8...2cac6ce281)

---
updated-dependencies:
- dependency-name: fluxcd/flux2
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

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

* oldObject translation solved in autogen (#6305)

* OldObject translation solved in autogen

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

* CronJob fixed in autogen

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

* tests added

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>

---------

Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: logger key value in wrong order (#6365)

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

* fix: missing metrics for policies in audit mode (#6363)

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

* chore(deps): bump github.com/notaryproject/notation-go (#6361)

Bumps [github.com/notaryproject/notation-go](https://github.com/notaryproject/notation-go) from 1.0.0-rc.1 to 1.0.0-rc.3.
- [Release notes](https://github.com/notaryproject/notation-go/releases)
- [Commits](https://github.com/notaryproject/notation-go/compare/v1.0.0-rc.1...v1.0.0-rc.3)

---
updated-dependencies:
- dependency-name: github.com/notaryproject/notation-go
  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: role matching from authentication infos (#6358)

* fix: role matching from authentication infos

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

* more 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>

* fix: delete certificate secret if type is not TLS (#6368)

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

* refactor: user/groups exclusions (#6357)

* refactor: user/groups exclusions

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

* wildcard

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

* fix

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

---------

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

* add labels to downstream and source resources (#6322)

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

* update generate validation checks

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

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Rayan Das <rayandas91@gmail.com>
Signed-off-by: Jim Bugwadia <jim@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Abhishek Kumar <76171953+octonawish-akcodes@users.noreply.github.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Rayan Das <rayandas91@gmail.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2023-03-01 06:52:20 +00:00
shuting
0c91e87bbb
fix: delete downstream for a generate rule removal, with data and sync (#6393)
* remove policy handler for updates

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

* remove policy update handler from the ur controller

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

* rework cleanup downstream on policy deletion

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

* fix downstream deletion on data rule removal

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

* add kuttl test for clusterpolicy

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

* linter fix

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

* add kuttl test for policy

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

* update api docs

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

* add delays

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

* fix name assertion

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

* delete downstream when deletes the clone source

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

* add kuttl test pol-clone-sync-delete-source

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

* linter fixes

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

* add kuttl test pol-clone-sync-delete-downstream

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

* add kuttl test pol-data-sync-modify-rule

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

* fix panic

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

* fix panic

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

* fix labels

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

* fix policy assertions

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

* fix annotation missing names

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

* rename policy

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

* remove dead code

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

* create unique namespaces

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

* create more unique namespaces

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

* fix assertion

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

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-03-01 03:48:18 +00:00
Charles-Edouard Brétéché
5585ed5e9d
chore: add cascading kuttl test (#6425)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-28 15:27:27 +00:00
Charles-Edouard Brétéché
8e123bc2ce
chore: split kuttl tests (#6423)
* fix: makefile build/kind targets and add target to save built images to files

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

* try in ci

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

* prepare for kuttl

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

* load

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

* install

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

* makefile

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

* makefile

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

* chore: split kuttl tests

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

* config

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

* more test suites

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

* config

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

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-02-28 15:33:46 +01:00
Charles-Edouard Brétéché
33a07f3c80
fix: cascading mutations (#6411)
* fix: cascading mutations

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

* remove explicit AddResource call

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

* update resource in context

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

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-27 18:33:07 +01:00
Chip Zoller
bc7b73401e
More kuttl standard generate tests (#6332)
* add test cpol-data-sync-delete-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test cpol-data-sync-modify-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* rename to be more descriptive

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test pol-data-sync-delete-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* cleanup test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test cpol-data-nosync-delete-rule

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test cpol-data-nosync-delete-policy

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* fix formatting

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add Kyverno kuttl specific snippets to BEST_PRACTICES

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add reminder note

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test cpol-data-nosync-modify-rule

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test cpol-data-nosync-modify-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test pol-data-nosync-create-policy-invalid

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test pol-data-sync-delete-policy

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* separate files

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test pol-data-nosync-delete-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test pol-data-nosync-delete-rule

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test pol-data-nosync-delete-policy

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* fix description

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* fix description

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test pol-data-nosync-modify-rule

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test pol-data-nosync-modify-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test existing-basic-create-data

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test existing-basic-create-preconditions-data

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add basic clone multiple test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add delays

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

* add generate permissions

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

* reorder source and ClusterPolicy, cleanup removal, README update

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add test for cascading-mutation

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* Change creation order, remove cleanup

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* increase sleep

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* remove unused test files

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* remove networkpolicies from perms

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add networkpolicies back

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* clarify readme

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

---------

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-02-27 14:39:18 +00:00
Charles-Edouard Brétéché
fb3a90c703
refactor: remove MutateResourceWithImageInfo (#6397)
* refactor: remove new resource from policy context

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

* fallback

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

* test something else

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

* fix test

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

* fix test

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

* fix test

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

* fix

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

* fix

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

* fix kuttl test

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

* fix cli tests

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

* clean

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

* changelog

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

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-27 13:45:00 +00:00
shuting
ccfcce83da
add kuttl test pol-clone-sync-modify-source (#6407)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-27 11:51:21 +00:00
Charles-Edouard Brétéché
3331b13561
feat: add view aggregated cluster role support (#6350)
* feat: add view aggregated cluster role support

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

* release note

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

* fix kuttl

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>
Co-authored-by: treydock <tdockendorf@osc.edu>
2023-02-25 20:57:56 +01:00
shuting
3653130806
feat: add the kuttl test for Policy (Namespaced) with generate rule, data, and sync (#6387)
* add the test

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

* update readme

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

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-24 21:59:17 +00:00
shuting
d3c2cd23fa
add kuttl tests (#6336)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-24 14:59:55 +00:00
shuting
07b350166f
feat: add kuttl test for namespaced generate policy, with clone and sync (#6386)
* add a kuttl test

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

* fix policy type

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

* fix policy type

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

* fix policy type

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

* rename files

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

* rename files

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

* rename files

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

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-24 11:36:19 +00:00
Abhishek Kumar
f4e9d9ab0e
Update README.md (#6389)
Signed-off-by: Abhishek Kumar <abhishek22512@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-02-24 10:07:26 +00:00
shuting
d5684f6794
add labels to downstream and source resources (#6322)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-22 10:49:09 +00:00
Batuhan Apaydın
41b24fb769
move from k8s.gcr.io to registry.k8s.io (#6263)
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
2023-02-09 00:09:15 +08:00
Brian Dunnigan
d33e616d69
#6055 Add JMESPath support to imageExtractors (#6183)
Signed-off-by: Brian Dunnigan <bdunnigan@clarityinnovates.com>
Co-authored-by: bdunnigan <bdunnigan@clarityinnovates.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-02-08 11:54:59 +00:00
Charles-Edouard Brétéché
cfd4501dcc
test: add a couple pattern unit tests (#6252)
* test: add a couple pattern unit tests

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

* more

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

* more

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

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-02-08 11:17:42 +00:00
shuting
6b3be9ada1
feat: enable leader election for the background controller (#6237)
* enable leader election for the background controller

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

* update api docs

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

* fix

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

* fix

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

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-07 14:44:51 +01:00
yinka
60cf8afff9
spec.background field implementation for PolicyExceptions (#6127)
* spec.background field implementation for PolicyExceptions

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* generated files

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* add kuttl test

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* set background to false

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* checks for variables

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* check if aggregate is nil

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* reject variables in polex

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* update

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* Update pkg/validation/exception/validate.go

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

* updates

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* change error

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* remove file

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* fix

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* fix lint error

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

---------

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: shuting <shutting06@gmail.com>
2023-02-06 15:45:31 +00:00
cleverhu
04cd2a2cfb
add kuttl test for allnotin (#5700)
Signed-off-by: cleverhu <shouping.hu@daocloud.io>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2023-02-06 09:39:23 +00:00
Charles-Edouard Brétéché
6934c66a71
refactor: add more functionnalities to engine interface (#6212)
* refactor: add more functionnalities to engine interface

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

* exclude mechanism

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

* fix

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

* polex

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

* fix kuttl 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>
2023-02-06 13:49:47 +08:00
shuting
d03ad5deb1
fix ns selector (#6216)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-03 15:22:11 +00:00
shuting
c8edf1ab32
fix: admission review variables for DELETE operations (#6197)
* build trigger from the stored admission request payload

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

* add a kuttl test

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

---------

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-02-02 14:46:53 +00:00
shuting
e8146e786e
fix: namespaceSelector for background policies (#6188) 2023-02-02 08:56:00 +00:00
Charles-Edouard Brétéché
47b4a177dd
chore: improve a couple kuttl tests (#6079)
* chore: improve a couple kuttl tests

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

* more

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

* more

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

* readme

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

* Update test/conformance/kuttl/cleanup/validation/cron-format/README.md

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

---------

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-30 14:11:06 +00:00
Charles-Edouard Brétéché
d36336d499
refactor: helm rbac component (#6096)
* refactor: helm labels management

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

* labels

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

* labels

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

* labels

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

* readme

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

* refactor: helm rbac component

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

* fix kuttl test

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-26 22:40:12 +00:00
Charles-Edouard Brétéché
39d5ceb00c
refactor: event package (#6124)
* refactor: event package

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

* fix

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

* more

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

* kuttl tests

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

* Update pkg/event/source.go

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-26 21:19:02 +00:00
Charles-Edouard Brétéché
6545f64ce1
refactor: helm labels management (#6073)
* refactor: helm labels management

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

* labels

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

* labels

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

* labels

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

* readme

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

* fix test

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: Jim Bugwadia <jim@nirmata.com>
2023-01-24 20:41:24 +00:00
Charles-Edouard Brétéché
c933da999f
refactor: helm tests (#6074)
* refactor: helm tests

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

* fix

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

* test other components

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

* values

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

* resources

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

* image

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

* fix

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>

* annotations

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

* annotations

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

* delete

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-23 08:31:22 -05:00
Charles-Edouard Brétéché
ad4c4da690
feat: remove generate request CRD (#6043)
* feat: remove generate request CRD

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

* changelog

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

* fix

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-19 19:39:05 +08:00
shuting
36abeaecf9
fix: ns labels matching (#6020)
* fix ns labels matching

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

* add kuttl tests

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

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-01-18 11:26:34 +00:00
yinka
fcf27bb035
fix: change inrange operator regexs (#5962)
* fix inrange operator regexs

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* add support for + sign

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* add support for leftEndpoint + sign

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* update regexs

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* add range operator tests in client code

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* extract range values

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* add cases

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* add test

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* fix test

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* add cli test

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* clean up code

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* fix lint error

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* fix kuttl test

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

* regex nits

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

* fix

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

* fix

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

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-16 16:23:36 +01:00
Vyom Yadav
c2dfd1d130
fix: policy match Kind case-senstive (#6008)
Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>
2023-01-16 16:01:05 +08:00
Charles-Edouard Brétéché
07264a3f3f
fix: policy exceptions not working in background mode (#5980)
* fix: policy exceptions not working in background mode

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

* kuttl tests

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

* fix kuttl test

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

* Update test/conformance/kuttl/reports/admission/exception/README.md

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

* Update test/conformance/kuttl/reports/background/exception/README.md

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
Co-authored-by: shuting <shutting06@gmail.com>
2023-01-13 10:58:02 +00:00
shuting
68fb237d25
fix imageRef matching (#5956)
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-01-10 09:44:31 +00:00
Charles-Edouard Brétéché
76b716da4e
fix: cleanup policies with user infos in match/exclude should be rejected (#5943)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-09 21:00:35 +08:00
Charles-Edouard Brétéché
2c172b151c
test: add kuttl test for policy exception (#5935) 2023-01-09 10:52:16 +08:00
shuting
c24e25fb56
fix cleanup var 'target.*' (#5888)
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-01-05 14:38:23 +00:00
shuting
e9f338df58
add kuttl assert file (#5870)
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-01-05 08:16:16 -05:00
Vyom Yadav
9d2deb0568
fix: Add subresources support to policy exceptions (#5839)
Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2023-01-05 06:23:44 +00:00
shuting
f59f17c05c
fix mutate targets variable (#5862)
Signed-off-by: ShutingZhao <shuting@nirmata.com>

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2023-01-04 12:35:46 +01:00
Charles-Edouard Brétéché
aaab55a036
feat: improve background scan reports enqueue logic (#5810)
* feat: improve background scan reports enqueue logic

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

* delay

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

* delay

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

* aggregation delay

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

* kuttl

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

* kuttl timeout

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

* delay

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

* kuttl timeout

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2023-01-03 13:51:37 +00:00
Charles-Edouard Brétéché
601541c147
chore: switch to kyverno/kuttl (#5504)
* chore: swith to kyverno/kuttl

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

* fix

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

* fix

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

* pin version

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

* fix

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-12-28 05:40:07 +00:00
shuting
6dfcac53f2
chore: remove e2e tests (#5742)
* remove e2e tests

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

* fix litmuschaos test

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

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-12-21 17:12:08 +01:00
Charles-Edouard Brétéché
41fd4fb252
refactor: supress usage of kustomize in build (#5691)
* refactor: supress usage of kustomize in build (part 1)

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

* fix

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

* fix

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

* fix

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

* e2e

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

* e2e

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

* e2e

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

* fix

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

* fix

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

* clean

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

* fix

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

* fix

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

* fix

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

* fix

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

* fix

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

* labels

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

* fix

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

* simplify templating flags

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

* fix

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

* fix

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

* fix

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

* fix

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

* fix

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

* fix

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-12-19 16:26:07 +01:00
shuting
69739f3778
feat: add kuttl tests for #5704 (#5707)
* add kuttl tests for #5704

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

* address comments

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

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-12-16 14:18:48 +00:00
Marc Brugger
a80ee683c1
fix: allow policies from stdin in apply again (#5668)
Signed-off-by: bakito <github@bakito.ch>

Signed-off-by: bakito <github@bakito.ch>
Co-authored-by: shuting <shuting@nirmata.com>
2022-12-16 13:50:15 +00:00
Vyom Yadav
99d988e98c
feat: add support for subresources to validating and mutating policies (#4916)
* feat: add support for subresources to validating and mutating policies

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

* Add CLI test cases with subresources for validating policies

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

* Fix existing e2e tests for validating policies and remove tests migrated to kuttl

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

* Add kuttl e2e tests for validating policies with subresources

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

* Add kuttl e2e tests for mutating policies with subresources

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

* Add kuttl e2e tests for validating policy by-pass by manipulating preconditions

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>

Signed-off-by: Vyom-Yadav <jackhammervyom@gmail.com>
2022-12-10 00:45:23 +08:00
Charles-Edouard Brétéché
87ce4b85de
feat: introduce v2alpha1 (#5625)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-12-08 11:45:47 +00:00
ansalamdaniel
9c4f05e883
Fix: handling unexpected global-anchor-variable for the apply command (#5590)
Signed-off-by: ansalamdaniel <ansalam.daniel@infracloud.io>

Signed-off-by: ansalamdaniel <ansalam.daniel@infracloud.io>
2022-12-07 16:05:05 +08:00
shuting
ef06833613
feat: support attestations with multiple signatures (#5409)
* add new attribute ".verifyImages.attestations.attestors"

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

* Update CRDs

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

* support multiple subjects for attestations

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

* - fix entries check; - refactors code

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

* fix linter

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

* - allow both attestors and attestations; - make attestations.attestor optional

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

* fix panic

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

* fix tests

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

* add kuttl tests

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

* fix tests

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

* fix tests

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

* fix tests

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

* remove the invalid test

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

* fix empty attestor

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

* add cleanup steps

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

* Update api/kyverno/v1/image_verification_types.go

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

* update codegen

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

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-12-01 22:09:44 +00:00
Chip Zoller
21da0f335e
Migrate all mutate e2e tests to kuttl and expand (#5491)
* add jmespath-logic test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add simple-conditional test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add variables-in-keys test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add patchesjson6902-simple

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add foreach-patchStrategicMerge-preconditions test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add patchStrategicMerge-global test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add patchStrategicMerge-global-addifnotpresent test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add patchesJson6902-replace test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* adjust "basic" mutate existing test to prep for e2e migrations

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add basic-create test (mutate existing)

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add basic-delete test (mutate existing)

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add basic-create-policy test (mutate existing)

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add basic-create-patchesJson6902 test (mutate existing)

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* change name to avoid deletion race

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-11-29 08:40:57 +00:00
Chip Zoller
ff9328809b
Migrate validate e2e tests to kuttl tests (#5483)
* add global-anchor test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add trusted-images test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add yaml-signing test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add x509-decode test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-11-28 14:04:21 +00:00
ansalamdaniel
2ba4def87c
Fix: handled skip rule processing in anyPattern field (#5191)
Signed-off-by: ansalamdaniel <ansalam.daniel@infracloud.io>
2022-11-28 08:01:51 -05:00
Rodrigo Fior Kuntzer
08447c108f
fix: fix mutating the "/metadata/serverAddress" section of a keda.s/v1alpha1/ScaledObject object (#5374)
* fix: fix mutating the "/metadata/serverAddress" section of a keda.sh/v1alpha1/ScaledObject object

Signed-off-by: Rodrigo Fior Kuntzer <rodrigo@miro.com>

* fix: update test policy

Signed-off-by: Rodrigo Fior Kuntzer <rodrigo@miro.com>

Signed-off-by: Rodrigo Fior Kuntzer <rodrigo@miro.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-11-28 09:55:42 +00:00
Prateek Pandey
42221a93e4
fix: add clone check before validating namespace policy (#5459)
fix: add clone check before validate clone namespace

- fix data policy validation
- add kuttl tests to validate the behaviour

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-11-25 12:49:22 +05:30
shuting
93eaead565
fix: mutate existing policy does not get applied when background=false (#5439)
* fix mutate existing policies when background=false

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

* add the kuttl test

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

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-11-23 08:16:06 +00:00
Vyankatesh Kudtarkar
dc0a07e5d8
Handle Match resources kind (#5421)
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-11-22 01:20:24 +00:00
Chip Zoller
c708f4a881
Add most basic kuttl tests for generate rules, clone and sync (#5413)
- add pol-clone-nosync-create and pol-clone-nosync-invalid tests
- add pol-clone-nosync-delete-downstream
- add pol-clone-nosync-modify-downstream
- add pol-clone-nosync-delete-source
- add pol-clone-nosync-modify-source
- add pol-clone-nosync-delete-rule
- add pol-clone-nosync-delete-policy
- add cpol-clone-sync-delete-rule
- add cpol-clone-sync-delete-policy
- add (but disabled) cpol-clone-sync-modify-source
- fix and move back cpol-clone-sync-modify-source
- add cpol-clone-sync-delete-source
- add cpol-clone-sync-modify-downstream
- add pol-clone-sync-invalid
- add pol-clone-sync-delete-rule
- add pol-clone-sync-delete-policy
- introduce pre-test sleep for Namespace deletion

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: Prateek Pandey <prateek.pandey@nirmata.com>
2022-11-21 16:30:25 +05:30
Pratik Shah
dccb1f692a
Fixed issue-3709: Image verify rule gives error for non-existing configmap (#5272)
Signed-off-by: Pratik Shah <pratik@infracloud.io>

Signed-off-by: Pratik Shah <pratik@infracloud.io>
2022-11-18 08:27:34 +00:00
Chip Zoller
e749e6a8e5
Complete all basic kuttl tests for generate rules, clone and no-sync (#5400)
* add pol-clone-nosync-create and pol-clone-nosync-invalid tests

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add pol-clone-nosync-delete-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add pol-clone-nosync-modify-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add pol-clone-nosync-delete-source

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add pol-clone-nosync-modify-source

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add pol-clone-nosync-delete-rule

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add pol-clone-nosync-delete-policy

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-11-17 21:56:20 +01:00
Vyankatesh Kudtarkar
83a84c9d47
[Bug]: Fix wildcard any/all issue (#5387)
* Fix wildcard for any/all match/excude kinds

* remove non required test

* add kuttl test

* Revert "add kuttl test"

This reverts commit d2245bc248.

* add kuttl test

* fix test
2022-11-17 14:07:03 +00:00
Chip Zoller
987e6d1cf6
Fix incorrect step ID reference (#5388)
- remove unnecessary test files
- fix incorrect step ID reference

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
2022-11-17 18:48:01 +05:30
Chip Zoller
6fe8a4ae07
Add more kuttl generate test cases (#5364)
* fix digest variable

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* update description of cpol-clone-nosync-delete-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add cpol-clone-nosync-delete-rule

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add cpol-clone-nosync-delete-policy

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add cpol-clone-nosync-modify-source

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add cpol-clone-nosync-delete-source

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add cpol-clone-nosync-modify-downstream

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-11-17 10:38:43 +00:00
Nikhil Sharma
0fb45ed53a
feat: add CleanupPolicy validation code to CleanupPolicyHandler (#5338)
* add validation code for cleanupPolicyHandler

Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>

* update

Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>

* fix

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

* register kuttl tests for cleanup policy

Signed-off-by: Nikhil Sharma <nikhilsharma230303@gmail.com>

Signed-off-by: Nikhil Sharma <nikhilsharma230303@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>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-11-16 13:11:33 +00:00
Charles-Edouard Brétéché
c37e9d4625
test: simplify autogen kuttl tests (#5343)
* test: simplify autogen kuttl tests

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

* rename

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-15 20:27:29 +00:00
Riko Kudo
f5aa68eb55
add test cases for yaml verification feature (#5326)
* add test cases for yaml verification feature

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* update policies to use the new schema version

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

Signed-off-by: Riko Kudo <rurikudo@ibm.com>
Co-authored-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-11-15 08:27:58 -05:00
Prateek Pandey
9b2331fedc
refactor: optimise and use kuttl TestStep with tests (#5328)
* refactor: use kuttl teststep with tests

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

* optimize kuttl generate test

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-11-15 07:32:11 -05:00
Charles-Edouard Brétéché
775ee71a06
test: add rbac kuttl test (#5337)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-15 10:15:59 +00:00
Charles-Edouard Brétéché
7eeb23d1a9
test: add test to check expected webhooks are created (#5330)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-14 13:27:41 +00:00
Charles-Edouard Brétéché
ce21ac50b3
feat: add replicaset and replicationcontroller to autogen (#4975)
* fix: missing autogen rules in status

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

* feat: add replicaset and replicationcontroller to autogen

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

* merge main

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

* fix tests

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

* fix tests

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

* fix

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-11-14 10:18:45 +00:00
Prateek Pandey
2b4ff1ef6d
fix: synchronize source resource update to clone list resource (#5317)
* fix: synchronize source resource update to clone list target resource

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

* add kuttl test to verify the clone list synchronized behavior

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

* refactor functions parameters

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

* fix the kuttl test description and behavior README

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

* Use entire content to compare

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-11-11 19:30:54 +00:00
Tobias Dahlberg
97a2b9a9a3
test: add kuttl tests for jmespath special chars (#5310)
* Adds tests for fixes in #4767

Signed-off-by: Tobias Dahlberg <tobias.dahlberg@sinch.com>

Signed-off-by: Tobias Dahlberg <tobias.dahlberg@sinch.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-11-11 09:45:23 +00:00
Charles-Edouard Brétéché
fcca45b1cf
fix: send notification when stoping watching resource in reports system (#5298)
* fix: send notification when stoping watching resource in reports system

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

* add kuttl test

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

* rework

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

* readme

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-10 17:01:56 +00:00
Chip Zoller
67f7d7af24
Update kuttl test scaffolding (#5303)
* add test instructions

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* update scaffolding

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-11-10 14:25:51 +00:00
Prateek Pandey
d86faa5832
tests: add kuttl tests for multiple clone generate (#5280)
* tests: add kuttl tests for multiple clone generate

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

* bump kuttl version v1.13.1

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

* fix review comments

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

* remove cleanup of image-verify tests

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-11-10 13:05:39 +00:00
Prateek Pandey
ef421a33ed
fix: allow delete of clone target resource with synchronize false (#5161)
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-11-10 17:13:24 +05:30
Charles-Edouard Brétéché
72dee76c06
fix: image extractor kuttl tests (#5293)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-10 09:36:08 +00:00
Charles-Edouard Brétéché
14e6aa4bba
fix: check policy is ready in kuttl tests (#5286)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-10 09:43:51 +01:00
Charles-Edouard Brétéché
37948f179e
fix: kuttl test external-service (#5287)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-09 18:53:48 -05:00
Chip Zoller
f5c7c68bac
add test instructions (#5271)
Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
2022-11-08 15:52:42 +00:00
Charles-Edouard Brétéché
0baf496659
chore: add kuttl autogen tests (#5253)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-08 15:05:49 +00:00
Charles-Edouard Brétéché
78fb926862
fix: add missing test suite to kuttl (#5268)
* fix: add missing test suite to kuttl

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

* fix path

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

* readme

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-08 15:27:49 +01:00
Charles-Edouard Brétéché
b71c0004d0
fix: account for error rules in mutation webhook (#5264)
* fix: account for error rules in mutation webhook

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

* add test

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

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-08 12:36:13 +01:00
Charles-Edouard Brétéché
f471f5c4e0
chore: remove old conformance tests files (#5260)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-11-07 23:07:32 +00:00
Chip Zoller
9f842fe626
Kuttl updates (#5257)
* add remainder of e2e verifyImages tests

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add tests

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add external-metrics test case and scaffolding

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* update scaffolding

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add keyed-basic test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add migrated e2e test for gen role and rolebinding

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add clone-role-and-rolebinding from e2e

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* remove timeout param from kuttl-test.yaml

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add tests for external-metrics Policy fix

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* update test path

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* update README

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-11-07 21:35:11 +00:00
Charles-Edouard Brétéché
1899938f05
chore: use conditions in kuttl tests to check ready policies (#5252)
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>
2022-11-07 18:34:29 +00:00
Chip Zoller
d9480c268d
More kuttl tests (#5238)
* add remainder of e2e verifyImages tests

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add tests

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add external-metrics test case and scaffolding

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* update scaffolding

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add keyed-basic test

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add migrated e2e test for gen role and rolebinding

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add clone-role-and-rolebinding from e2e

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* remove timeout param from kuttl-test.yaml

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* add tests for external-metrics Policy fix

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-11-07 17:23:19 +00:00
Chip Zoller
745482a0e4
add remainder of e2e verifyImages tests (#5229)
Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
2022-11-04 11:58:24 -04:00
Chip Zoller
da18305015
add kuttl tests (#5204)
- add kuttl tests
- try rekor: {url: "https://rekor.sigstore.dev"}
- add rekor{} object to last two policies

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
2022-11-04 14:00:31 +00:00
Vyankatesh Kudtarkar
7137ccaa28
fix 5151 issue (#5170) 2022-10-31 19:15:02 +08:00
Charles-Edouard Brétéché
3a8d26e17d
fix: conformance tests (#5118)
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
2022-10-21 21:00:18 +00:00
Chip Zoller
4a41ba910b
clean conformance (#5089)
* clean conformance

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

* adjust names

Signed-off-by: Chip Zoller <chipzoller@gmail.com>

Signed-off-by: Chip Zoller <chipzoller@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-10-21 17:38:13 +00:00
Charles-Edouard Brétéché
5a496ca212
refactor: simplify variables regex (#5075)
* feat: add simple conformance tests

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

* gh action

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

* separate workflow

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

* fix the bug

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

* fix cli test

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

* improvements

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

* improvements

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

* fixes

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

* fix

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

* fix: variables regex

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

* fix

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

* fix

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

* fix

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

* fix 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>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-10-21 11:51:14 +08:00
Prateek Pandey
2078f0dfd2
fix: allow delete of target resource with synchronize false (#5081)
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>

Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-10-20 19:41:57 +00:00
Charles-Edouard Brétéché
35491d248e
test: add best practices policies in conformance tests (#5082)
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: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-10-20 16:05:11 +00:00
Charles-Edouard Brétéché
ad2cbd3b33
feat: add simple conformance tests (#5073)
* feat: add simple conformance tests
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-10-20 12:17:33 +00:00
Pratik Shah
caab013a86
Fixed issue-4530: Added separate attestor type for secrets and KMS (#4733)
Signed-off-by: Pratik Shah <pratik@infracloud.io>

Signed-off-by: Vyankatesh <vyankateshkd@gmail.com>
2022-10-14 09:40:46 +00:00
Pratik Shah
8a0083105d
Added support to specify key signature algorithm in verifyImages (#4855)
Signed-off-by: Pratik Shah <pratik@infracloud.io>

Signed-off-by: Pratik Shah <pratik@infracloud.io>
2022-10-14 05:39:57 +00:00
Sachin Maurya
bec5632344
e2e test for mutate policy (#3383)
Signed-off-by: slayer321 <sachin.maurya7666@gmail.com>

Signed-off-by: slayer321 <sachin.maurya7666@gmail.com>
2022-10-08 10:57:41 -04:00
yinka
688b4fb8e3
add package logger in files (#4766)
* add package logger in files

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* add package logger to initContainer and other files

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>

* helm docs

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* helm default values

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* release notes

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Signed-off-by: damilola olayinka <holayinkajr@gmail.com>
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-10-02 19:45:03 +00:00
Abhinav Sinha
a1182859ad
Added x509_decode JMESPath function (#4664)
* Added `x509_decode` JMESPath function

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Use `crypto/x509` stdlib

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Return result as `map[string]interface{}`

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Made minor fixes

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Fixed error with unmarshalling decoded certificate

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Added e2e test for decoding X.509 certs

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Reverted to using `smallstep/zcrypto` for X.509

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Minor fix

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Addressed reviews

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

* Removed redundant dependency on `pkg/errors`

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>

Signed-off-by: Abhinav Sinha <abhinav@nirmata.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-09-28 18:15:39 +00:00
shuting
34c6920129
Support PSa integration by controlName only (#4710)
* Remove "restrictedField" and "values" from podSecurity.exclude

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

* Remove commented code

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

* Add unit tests for restricted_runAsNonRoot

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

* Add baseline unit tests

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

* Add unit tests for restricted controls

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

* Removes PSa tests at the engine level

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

* - Update API docs; - Add unit tests for wildcard images

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

* Remove autogen conversion for PSa policies

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

* copy pod with DeepCopy()

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

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-09-28 10:03:53 +00:00
Prateek Pandey
9cc1e6b2b3
fix: handle auth permission for cloneList validation (#4684)
Signed-off-by: prateekpandey14 <prateek.pandey@nirmata.com>
2022-09-26 13:23:00 +05:30
Charles-Edouard Brétéché
4d7e1281de
fix: namespaced policy not validated in engine (#4653)
* fix: namespaced policy not validated in engine

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix test

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: Prateek Pandey <prateek.pandey@nirmata.com>
2022-09-26 12:47:37 +08:00
Prateek Pandey
1cacd0173d
feat: allow cloning multiple resource from a namespace (#4384) 2022-09-08 04:47:09 +00:00
ToLToL
1b9a2fca21
Extend Pod Security Admission (#4364)
* init commit for pss

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

* add test for Volume Type control

* add test for App Armor control except ExemptProfile. Fix PSS profile check in EvaluatePSS()

* remove unused code, still a JMESPATH problem with app armor ExemptProfile()

* test for Host Process / Host Namespaces controls

* test for Privileged containers controls

* test for HostPathVolume control

* test for HostPorts control

* test for HostPorts control

* test for SELinux control

* test for Proc mount type control

* Set to baseline

* test for Seccomp control

* test for Sysctl control

* test for Privilege escalation control

* test for Run as non root control

* test for Restricted Seccomp control

* Add problems to address

* add solutions to problems

* Add validate rule for PSA

* api.Version --> string. latest by default

* Exclude all values for a restrictedField

* add tests for kyverno engine

* code to be used to match kyverno rule's namespace

* Refacto pkg/pss

* fix multiple problems: not matching containers, add contains methods, select the right container when we have the same exclude.RestrictedField for multiple containers:

* EvaluatePod

* Use EvaluatePod in kyverno engine

* Set pod instead of container in context to use full Jmespath. e.g.: securityContext.capabilities.add --> spec.containers[*].securityContext.capabilities.add

* Check if PSSCheckResult matched at least one exclude value

* add tests for engine

* fix engine validation test

* config

* update go.mod and go.sum

* crds

* Check validate value: add PodSecurity

* exclude all restrictedFields when we only specify the controlName

* ExemptProfile(): check if exclud.RestrictedField matches at least one restrictedField.path

* handle containers, initContainers, ephemeralContainers when we only specify the controlName (all restrictedFields are excluded)

* refacto pks/pss/evaluate.go and add pkg/engine/validation_test.go

* add all controls with containers in restrictedFields as comments

* add tests for capabilities and privileged containers and fix some errors

* add tests for host ports control

* add tests for proc mount control

* add tests for privilege escalation control

* add tests for capabilities control

* remove comments

* new algo

* refacto algo, working. Add test for hostProcess control

* remove unused code

* fix getPodWithNotMatchingContainers(), add tests for host namespaces control

* refacto ExemptProfile()

* get values for a specific container. add test for SELinuxOptions control

* fix allowedValues for SELinuxOptions

* add tests for seccompProfile_baseline control

* refacto checkContainers(), add test for seccomp control

* add test for running as non root control

* add some tests for runAsUser control, have to update current PSA version

* add sysctls control

* add allowed values for restrictedVolumes control

* add some tests for appArmor, volume types controls

* add tests for volume types control

* add tests for hostPath volume control

* finish merge conflicts and add tests for runAsUser

* update charts and crds

* exclude.images optional

* change volume types control exclude values

* add appAmor control

* fix: did not match any exclude value for pod-level restrictedFields

* create autogen for validate.PodSecurity

* clean code, remove logs

* fix sonatype lift errors

* fix sonatype lift errors: duplication

* fix crash in pkg/policy/validate/ tests and unmarshall errors for pkg/engine tests

* beginning of autogen implement for validate.exclude

* Autogen for validation.PodSecurity

* working autogen with simple tests

* change validate.PodSecurity failure response format

* make codegen

* fix lint errors, remove debug prints

* fix tags

* fix tags

* fix crash when deleting pods matching validate.podSecurity rule. Only check validatePodSecurity() when it's not a delete request

* Changes requested

* Changes requested 2

* Changes requested 3

* Changes requested 4

* Changes requested and make codegen

* fix host namespaces control

* fix lint

* fix codegen error

* update docs/crd/v1/index.html

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

* fix path

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

* update crd schema

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

* update charts/kyverno/templates/crds.yaml

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

Signed-off-by: ShutingZhao <shuting@nirmata.com>
Co-authored-by: ShutingZhao <shuting@nirmata.com>
2022-08-31 09:16:31 +00:00
Riko Kudo
5f5cda9fee
Yaml signing and verification (#4235)
* enable YAML verification using k8s-manifest-sigstore

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

comment out role and rolebinding for dryrun

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update k8s-manifest-sigstore version

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix pubkey setting

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix pubkey setting

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix log message

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

change default value of dryrun option

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update crd

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

support gpg signature

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* upgrade manifest sigstore version and support multi sigs

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix validate.manifest rule

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update crd and add small fix

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix manifest verify policy

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

set cosign experimental env when keyless verification

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* improve default ignoreFields

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* fix manifest verify policy

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix manifest verify policy

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix manifest verify policy

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* add unit-test for k8smanifest

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update install yaml

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* update k8s-manifest-sigstore version and support one or more signatures

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

add unit-test for k8smanifest multi-signature

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix verifyManifest result message

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix verifyManifest result message

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* fix manifest verify policy and move dryrun rbac to dryrun dir

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* update k8s-manifest-sigstore version

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update k8s-manifest-sigstore version

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update k8s-manifest-sigstore version and resolve conflict

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

enable YAML verification using k8s-manifest-sigstore

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

comment out role and rolebinding for dryrun

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix pubkey setting

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix pubkey setting

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update crd

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

upgrade manifest sigstore version and support multi sigs

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix validate.manifest rule

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update crd and add small fix

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix manifest verify policy

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

update k8s-manifest-sigstore version and support one or more signatures

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix verifyManifest result message

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix verifyManifest result message

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

fix manifest verify policy and move dryrun rbac to dryrun dir

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

add small fix

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* remove generic name

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* fix sonatype-lift issue and unit-test error

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* fix gofumpt error

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>

* update manifest rule to use attestor

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* remove unused value

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* resolve conflict

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix install.yaml

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix to set COSIGN_EXPERIMENTAL env variable when keyless verification

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix misspell

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* enable kyverno cli in validate.manifests rule (#3)

* enable kyverno cli in validate.manifests rule

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* update k8s-manifest-sigstore version and improve error handling for better result output

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* update crds and deepcopy

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* update unit test

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* update k8s-manifest-sigstore version

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* change to use spec.rules.exclude.subjects instead of skipUsers (#4)

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* update k8s-manifest-sigstore version

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix yaml signing sigstore (#5)

* update k8s-manifest-sigstore version

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* add a comment for dryrun option field

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* enable to include ClusterPolicy/Policy in match resource

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix log style and env variable settings

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* simplify manifest verify func

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix func name

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix sonatype warning

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix default ignoreFields

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix yaml signing sigstore rbac (#6)

* fix dryrun rbac to have minimal permissions

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix lint error

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix unit-test error

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix gofumpt error

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* fix log style

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* updated CRD documentation

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* resolve go.mod conflicts

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

* updated helm stuff

Signed-off-by: Riko Kudo <rurikudo@ibm.com>

Signed-off-by: Ruriko Kudo <rurikudo@ibm.com>
Signed-off-by: Riko Kudo <rurikudo@ibm.com>
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-08-30 10:14:54 -07:00
Charles-Edouard Brétéché
4864be14f1
fix: make ldflags optional in .ko.yaml (#4419)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-08-26 13:40:27 +00:00
Charles-Edouard Brétéché
144985ee5a
chore: fix golangcilint timeout (#4388)
* chore: fix golangcilint timeout

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix commit sha

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* add .gitattributes

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-08-24 21:08:24 +08:00
vivek kumar sahu
17052436cb
Treat normal and precondition variable equally (#4217)
* When  the value of the variables not present will assigned as nil

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

* Added cli test cases

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

* fixed failing test cases

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

* remove extra line

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-08-18 04:34:36 +00:00
vivek kumar sahu
c95bb74992
Context vars substitution in CLI (#4290)
* context variables substitution will be independent of sequence

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

* Added test cases

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-08-09 05:48:57 +00:00
vivek kumar sahu
f6c131cfcc
precondition failure will skip rule independent of audit or enforce mode (#4163)
* precondition fails will skip rule independent of audit or enforce mode

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

* Added cli-test cases

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

* small fix

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-07-14 09:35:27 +05:30
vivek kumar sahu
a37901425f
return helpful error message on invalid patched resources. (#4129)
Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-07-06 13:24:28 +05:30
Charles-Edouard Brétéché
24e96884c5
refactor: finish refactoring generate e2e tests (#4090)
* refactor: generate e2e GeneratePolicyDeletionforCloneTests

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* refactor: generate e2e test GenerateNetworkPolicyOnNamespaceWithoutLabelTests

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* chore: cleanup

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* finish refactoring tests

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* refactor: is not found

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* refactor expectations part 1

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: repeat update on conflict

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-07-05 23:34:09 +08:00
Charles-Edouard Brétéché
27e5772986
fix: add more verify images e2e test for bool fields (#4172)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-06-30 21:36:28 +02:00
Tathagata Paul
16f8620993
added resource lists for test cli (#4082)
Signed-off-by: Tathagata Paul <tathagatapaul7@gmail.com>
2022-06-20 06:38:13 +00:00
Charles-Edouard Brétéché
e1db7c9814
feat: add e2e framework and verify image new test (#4094)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-06-09 21:58:07 +08:00
Charles-Edouard Brétéché
e3c39f1da1
refactor: generate e2e GeneratePolicyDeletionforCloneTests (#4071)
* refactor: generate e2e GeneratePolicyDeletionforCloneTests

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: unit test

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* chore: remove resourceExpectation type

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-06-07 23:35:44 +08:00
Charles-Edouard Brétéché
0b7b2458eb
refactor: generate e2e tests (#4068)
* refactor: use t.Cleanup in e2e tests

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* refactor: generate e2e tests

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* helpers

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-06-03 21:08:27 +02:00
Charles-Edouard Brétéché
fe3c12628c
refactor: use t.Cleanup in e2e tests (#4067)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Co-authored-by: Prateek Pandey <prateek.pandey@nirmata.com>
2022-06-03 19:08:33 +05:30
Vyankatesh Kudtarkar
18ae9c7d6d
fix policy typo (#4039) 2022-05-31 06:28:02 +00:00
Shubham Nazare
165c5d9fc3
feat: Extend CLI to cover generate policies (#3456)
- Change in namespace for test-generate example
- Change cloneResource to cloneSourceResource
- Add support for namespaced Policy and fix log messages
- Add test-generate in Makefile and an example of namespaced Policy
- Fix namespaced policy issue and add comments
- Refactor according to new generate controller
- Add json tag to GeneratedResource field of RuleResponse struct

Signed-off-by: Shubham Nazare <shubham4443@gmail.com>

Co-authored-by: Prateek Pandey <prateek.pandey@nirmata.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-05-25 14:26:22 +00:00
vivek kumar sahu
fbbe57f5e1
Request operation value by default to CREATE (#3894)
* set  by default  request.operation to CREATE

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

* Added test cases

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-05-25 13:59:53 +00:00
Charles-Edouard Brétéché
1936d86623
fix: move ur controller filtering in reconciler (#3964)
* fix: move ur controller filtering in reconciler

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: mark ur retry on conflict

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: test data

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: add filter back in update ur handler

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: added some logs about attempts and increased backoff

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: reconciliation logic

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: Test_Generate_Synchronize_Flag

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

* fix: small nits

Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-20 00:06:56 +08:00
Charles-Edouard Brétéché
0099ef54ad
chore: enable gofmt and gofumpt linters (#3931)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-17 06:19:03 +00:00
Dhaval Shah
fce35b91d2
[Bugbash] Kceu22 bugbash/fix staticcheck warnings (#3917)
* cleanup: error string formating

Fixes Staticcheck ST1005
KubeCon EU 2022 BugBash

Signed-off-by: Dhaval Shah <30974879+dhavalgshah@users.noreply.github.com>

* cleanup: merge var declaration with assignment

Fixes staticcheck S1021

Kubecon EU 2022 Bugbash

Signed-off-by: Dhaval Shah <30974879+dhavalgshah@users.noreply.github.com>

* cleanup normalize yoda condition to simple compare

fixes staticcheck ST1017

Signed-off-by: Dhaval Shah <30974879+dhavalgshah@users.noreply.github.com>

* cleanup: remove extraneous err param on executeTest

err is not used anywhere except to throw Fatal inside execureTest()
fix staticcheck SA4009

Signed-off-by: Dhaval Shah <30974879+dhavalgshah@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
Signed-off-by: Dhaval Shah <30974879+dhavalgshah@users.noreply.github.com>

* fix: match validation error message to actual errors

Signed-off-by: Dhaval Shah <30974879+dhavalgshah@users.noreply.github.com>

* cleanup: more of normalize validation error messages

Signed-off-by: Dhaval Shah <30974879+dhavalgshah@users.noreply.github.com>

* cleanup: additional error message formatting fixes

Signed-off-by: Dhaval Shah <30974879+dhavalgshah@users.noreply.github.com>

Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-05-14 22:04:35 +01:00
Vyankatesh Kudtarkar
31928c9507
Fix subject match selector issue in cli (#3887)
* Fix subject match selector issue in cli

* remove space

* code refactoring
2022-05-11 15:21:13 +00:00
Charles-Edouard Brétéché
747f4128ef
chore: enable noctx linter (#3888)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-11 17:34:40 +05:30
Charles-Edouard Brétéché
f508e9a0b8
chore: add unconvert linter (#3867)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-05-10 20:28:45 +01:00
Charles-Edouard Brétéché
97e5e64fd4
chore: enable whitespace linter (#3864)
Signed-off-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>

Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-05-10 17:01:29 +00:00
Jim Bugwadia
bc07943c81
handle subresources (#3841)
* handle subresources

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

* make fmt

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

* fix logger name

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

* fix webhook and logs

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

* make fmt

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

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-05-09 18:50:50 -07:00
Sambhav Kothari
2dc54e5c1b
Allow variables of any kind to be defined (#3828)
Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-05-07 20:30:11 +00:00
Afzal Ansari
3845225db1
refactor: imported pkg redeclared and a few other unused func (#3827)
* Removes paths redeclared

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

* fixes v1 redeclared

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

* fixes mergeSucceededResults func never used

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

* fixes func unused

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

* refactors unused func

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

* refactors unused func

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

* refactors getNamespacesForRule unused

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

* refactors policyNamespace unused

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

* refactors replacing loop with ...

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

* refactors func buildPolicyLabel unused

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

* removes unused func

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

* removes unused comment

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

Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-05-07 16:44:57 +00:00
Moritz Johner
4d2ec26c90
CLI should respect scored annotation for warnings (#3821)
Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-05-07 13:33:50 +00:00
Sambhav Kothari
c3604c1170
Add an object_from_lists function (#3824) 2022-05-07 12:05:04 +00:00
Sambhav Kothari
e55bf0bf6f
Relax JMESPath variable validation (#3826) 2022-05-07 16:40:53 +05:30
shuting
b4f2b63f53
Load mutate.targets via dclient (#3797)
* Load mutate.targets via dclient

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

* Do not fail on namespace cleanup for e2e generate

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

* Fix wildcard name listing for a certain namespace

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

* Rename onPolicyUpdate to mutateExistingOnPolicyUpdate

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

* Enable "mutateExistingOnPolicyUpdate" on policy events

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

Co-authored-by: Prateek Pandey <prateek.pandey@nirmata.com>
2022-05-06 05:46:36 +00:00
Jim Bugwadia
db3502656d
Cert attestor (#3809)
* add certificates attestor

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

* handle duplicate images; use container name as key

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

* use OldObject for modify requests

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

* use unique image names

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

* merge main

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

* create a single annotation patch across rules and images

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

* fmt and change annotation key name

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

* fix linter issues

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

* split certs from keys

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

* make fmt

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

* fix test

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

* add Rekor and fix tests

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

* fix tests

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

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-05-05 21:57:20 -07:00
shuting
8a9a98d8b5
Add handler to UR.status (#3791)
* - Add "handler" to "ur.status"
- Mark / Unmark handler upon UR reconciliation

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

* Add field onPolicyUpdate

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

* Update API docs

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

* Add delay in generate e2e tests

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

* Remove duplicate logic for cleaning up the cloned resource

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-05-05 16:26:27 +05:30
Sambhav Kothari
6e48fdf4ce
Fix issue with image registry when decoding OCI descriptors with out of spec keys (#3799) 2022-05-04 13:38:56 -04:00
gsweene2
af51ceb4ff
Add JMESPath Function items (#3777)
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
Co-authored-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-05-04 10:33:24 +00:00
Vyankatesh Kudtarkar
fca068d0f6
Fix Cli test for image verification (#3760)
* fix Cli test for image verification
2022-05-04 04:11:59 +00:00
Sambhav Kothari
0a5f004047
Allow non-object type elements for foreach rules (#3763)
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-05-02 16:39:37 +00:00
Jim Bugwadia
3cb620499e
Remove YAML multiline support in CM values (#3721)
* remove YAML multiline support in CM values

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

* remove unused code

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

* fix test

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

Co-authored-by: shuting <shuting@nirmata.com>
2022-05-02 08:57:35 +01:00
Sambhav Kothari
655e2a74d7
Add tests for required checks for image verify (#3755) 2022-05-01 18:00:44 -07:00
Sambhav Kothari
8342d86a9e
Retry policy creation to avoid flaky CRD readiness (#3752)
Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-05-01 22:42:14 +00:00
Sambhav Kothari
dd0f6baa7d
Enable tests in makefile (#3699) 2022-05-01 14:20:22 -07:00
shuting
a4815f77c4
Convert GenerateRequest to UpdateRequest for backward compatibility (#3730)
- Remove GenerateRequest Informer
 - Rename GenerateRequest to UpdateRequest in logs and vars
 - Fix initContainer leader election
 - Convert GenerateRequest to UpdateRequest in initContainer
 - Remove unused methods
 - Add printer column ruleType to UR


Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-04-29 16:35:49 +05:30
shuting
e248308cb3
Create UR for both mutate and generate policies (#3717)
* remove mutateExisting field

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

* update policy controller to create UR for generate

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

* remove debug log

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

* - Update api docs
- Ignore e2e tests cleanup failure

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

* Add back index to helm template

Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-04-29 11:01:02 +05:30
shuting
b740e84f06
add e2e tests for mutate existing policies (#3703)
Signed-off-by: ShutingZhao <shuting@nirmata.com>
2022-04-27 21:44:52 +02:00
Jim Bugwadia
ab5171cee5
Verify digest (#3679)
* add verifyDigest to check all tags are converted to digests

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

* add required to check for image verification annotation

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

* make fmt

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

* generate CRD

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

* adding imageverify true/false patch

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

* patch addition logic

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

* image verify CLI tests

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

* fix tests

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

* fixes and unit tests

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

* fix digest mutate

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

* fmt

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

* make codegen

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

* fix policy cache

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

Co-authored-by: anushkamittal20 <anumittal4641@gmail.com>
2022-04-27 15:09:52 +00:00
Sambhav Kothari
9d13e89697
Enable verifyImages and CLI registry tests (#3684)
Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-04-27 17:29:54 +08:00
shuting
d5f6167e56
Fix flaky e2e tests for generate policies (#3681)
* fix flaky generate e2e tests

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

* enable validate, verifyimage e2e tests

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

* set policy names different within a single test

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

* do not delete cloned resource when sync generate policy is deleted

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

* replace grLister by urLister

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

* re-queue pending URs only to fix clone policy deletion

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

* remove duplicate import

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

Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
Co-authored-by: Charles-Edouard Brétéché <charled.breteche@gmail.com>
2022-04-26 19:18:24 +00:00
Sambhav Kothari
25badfe4fb
Fix regression in wildcard matches in In/AnyIn operators (#3686)
Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-04-26 18:03:05 +00:00
Vyankatesh Kudtarkar
79be6379b2
fix test cli CI failures from main (#3682) 2022-04-26 20:00:46 +08:00
Vyankatesh Kudtarkar
56c90fd087
Support context variables when using foreach CLI (#3637)
* Support context variables when using foreach CLI

* add testcases
2022-04-25 16:36:31 +00:00
Ioannis Bouloumpasis
a205bc3e2e
fix: webhooks are not configured correctly (#3660)
* Fix webhook rules equality when internal is empty

The current implementation of the 'webhookRulesEqual' didn't check for
the corner case were both the internal representation and the API have
length of one, but the internal representation has 1 rule with no
selectors.
In this case the 'webhookRulesEqual' should return false, as the 2
configurations are not the same.

Signed-off-by: Ioannis Bouloumpasis <buluba@arrikto.com>

* Fix tests

Add a small time delay when checking if a Policy is ready in tests to
ensure that the Policy is actually ready.

Signed-off-by: Ioannis Bouloumpasis <buluba@arrikto.com>
2022-04-25 15:19:39 +00:00
Sambhav Kothari
44b5bf0b57
Allow definition of inline variables in context (#3658)
Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-04-25 19:06:07 +08:00
Sambhav Kothari
ec4e4ba452
Add support for custom image extractors (#3596)
Signed-off-by: Sambhav Kothari <skothari44@bloomberg.net>
2022-04-14 09:08:30 -07:00
Tathagata Paul
10cf0f2344
add support for roles, cluster roles and subjects (#3188)
* add support for roles, cluster roles and subjects in kyverno cli

Signed-off-by: Tathagata Paul <tathagatapaul7@gmail.com>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
Co-authored-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-04-12 04:00:49 +00:00
Vyankatesh Kudtarkar
e268be9e88
support for deprecated API's (#3439)
* support for deprecated API's

* add testcase

* update condition

* fix logic
2022-03-22 18:25:35 +00:00
Aidan Delaney
4ec3b36f7f
Remove support for test.yaml (#3442)
kyverno-test.yaml is now the only supported test file name

Signed-off-by: Aidan Delaney <adelaney21@bloomberg.net>
2022-03-22 14:09:08 +05:30
Sambhav Kothari
6498425937
Add a registry flag to allow direct access to container registries in the CLI (#3396)
* Add a registry flag to allow direct access to container registries in the CLI

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-03-16 09:56:47 +05:30
Vyankatesh Kudtarkar
68093cd44c
Cli Apply command support Dir as resources (#3391)
* apply command support dir as resources

* fix issue
2022-03-15 16:00:59 +08:00
vivek kumar sahu
c456b541af
e2e test for mutate global anchor Policy (#2574)
* Added e2e test for mutate-global-anchor-policy

Signed-off-by: vivek kumar sahu <vivekkumarsahu650@gmail.com>

* Updated config.go for mutate globar anchor policy

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

* Added resources for mutate global anchor policy

Signed-off-by: viveksahu26 <vivekkumarsahu650@gmail.com>

Co-authored-by: shuting <shuting@nirmata.com>
2022-03-14 09:15:06 +00:00
Vyankatesh Kudtarkar
148a892277
Fix any_all wildcard issue (#3352) 2022-03-08 12:59:33 +00:00
Sambhav Kothari
e9e96e7b1c
Run E2E tests on all supported k8s versions (#3256) 2022-02-23 15:52:08 +00:00
Vyankatesh Kudtarkar
e8bf16a00b
Fix label mutation while updating the secret (#3273)
* Fix label mutation while updating the secret

* Update util.go

* fix converter issue

* code indentation
2022-02-22 19:49:03 +08:00
Vyankatesh Kudtarkar
04e5f50cde
fix mutate wildcard issue (#3193)
Co-authored-by: shuting <shuting@nirmata.com>
2022-02-18 10:32:10 +00:00
Vyankatesh Kudtarkar
0a5aad39cf
Fix foreach validations precondition issue (#3228)
* fix foreach validations precondition issue

* added test-cases
2022-02-18 09:11:41 +00:00
Tathagata Paul
b91ff5a7f2
Bug fix: negation of string kernel version caused Cluster Policy to fail (#3229)
* fixed bug where negation of kernel version caused cpolr to fail

Signed-off-by: Tathagata Paul <tathagatapaul7@gmail.com>

* small fix in function validateString

Signed-off-by: Tathagata Paul <tathagatapaul7@gmail.com>

* Added necessary tests

Signed-off-by: Tathagata Paul <tathagatapaul7@gmail.com>

Added one more test

Signed-off-by: Tathagata Paul <tathagatapaul7@gmail.com>

* Add more tests and added a policy to the test folder

Signed-off-by: Tathagata Paul <tathagatapaul7@gmail.com>

* added policy for test cli

Signed-off-by: Tathagata Paul <tathagatapaul7@gmail.com>

Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-02-17 09:33:30 +05:30
Afzal Ansari
fc658da1e3
Added e2e test for JSON patch mutate policy (#2966)
* Adds e2e test for JSON patch mutate policy

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

* modifies the config to use the optimal version of that policy

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

* Fixes the lint issuue

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

* modifies test to pass

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

* adds changes to resources

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

Co-authored-by: shuting <shutting06@gmail.com>
Co-authored-by: shuting <shuting@nirmata.com>
2022-02-10 05:18:26 +00:00
vivek kumar sahu
0293368504
fixing bug to handle two different types of rules (#2954)
* fixing bug for the info variable

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-02-09 10:33:54 +00:00
Vyankatesh Kudtarkar
b3f702ba8d
test-cases for wildcard match label selector (#3165) 2022-02-04 03:45:40 +00:00
Vyankatesh Kudtarkar
373f421b07
Fix panic for provides a set to the key of a precondition and deny condition (#3162) 2022-02-03 14:46:58 +00:00
Sambhav Kothari
98284114f5
Relax rule context validation to follow JMESPath grammar (#3129)
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-01-31 18:23:59 +00:00
Sambhav Kothari
2b1e7189b1
Fix variable substitution when curly braces are used in jmespath (#3133)
* Fix variable substitution when inline jmespath objects are defined

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

* Add additional test cases which use brackets

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-01-31 17:11:19 +00:00
Jim Bugwadia
06e93fec46
apply patches cumulatively (#3083)
* apply patches cumulatively

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

* handle skipped rules

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

* add test files

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2022-01-25 09:00:18 +00:00
treydock
cd4650eb5a
Fix CLI test/apply when any/all use namespaceSelector (#3050)
* Fix CLI test/apply when any/all use namespaceSelector
Fixes #3047

Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>

* gofmt fix

Signed-off-by: Trey Dockendorf <tdockendorf@osc.edu>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-01-25 08:06:17 +00:00
Jim Bugwadia
bb06901119
fix mutate preprocessing for anchors (#3052)
* fix mutate preprocessing for anchors

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

* make fmt

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

Co-authored-by: shuting <shutting06@gmail.com>
2022-01-23 13:54:22 +00:00
Anushka Mittal
df4d7ae26c
Broken exclude any all (#2990)
* added check for any/all

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

* minor corrections

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

* corrected return check for rbac info

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

* added cli test

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

Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-01-20 08:29:16 +00:00
Liu Shaohui
25722366f0
Fix: namespace quota policy failed to be applied for two resources named ResourceQuota with different APIVersions (#2612)
Signed-off-by: Shaohui Liu <liushaohui@xiaomi.com>

Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-01-20 12:48:52 +05:30
Vyankatesh Kudtarkar
c2de92d8c6
Support mutation of variables in validate.deny (#2947)
* Support mutation of variables in validate.deny

* remove comment

* fix e2e test
2022-01-18 10:53:30 +00:00
Sambhav Kothari
f5e00ee034
Add a parse_yaml function (#2999)
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

Co-authored-by: shuting <shutting06@gmail.com>
2022-01-17 13:41:08 +00:00
Sambhav Kothari
1af9e48b0d
Add image data to validate image configs (#2946)
* Add image data to validate image configs

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

* Add tests for image context

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

* Add e2e test cases for image size policy

Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-01-17 04:06:44 +00:00
Sambhav Kothari
f42092208f
Fix variable substitution for foreach preconditions (#2993)
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>

Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-01-16 05:33:34 +00:00
Sambhav Kothari
0c11af2d9a
Fix autogen issue with cronjob generator and foreach pod generator (#2989)
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-01-15 12:28:28 -08:00
Tathagata Paul
1f3e625b99
Renamed test.yaml to kyverno-test.yaml (#2898)
Signed-off-by: 4molybdenum2 <tathagatapaul7@gmail.com>

Co-authored-by: Jim Bugwadia <jim@nirmata.com>
2022-01-14 08:45:59 +00:00
Sambhav Kothari
baf4fa335b
Remove spurious prints and fix line endings (#2963)
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-01-11 14:15:26 +00:00
Sambhav Kothari
6b9798f76f
Add parse_json function the decode json strings (#2941)
Signed-off-by: Sambhav Kothari <sambhavs.email@gmail.com>
2022-01-10 13:42:02 -08:00
Jim Bugwadia
a9fef256c7
updates for foreach and mutate (#2891)
* updates for foreach and mutate

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

* allow tests to pass on Windows

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

* fix tests

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

* fix linter check

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

* add elementIndex variable

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

* fmt

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

* fix jsonResult usage

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

* add mutate validation and fix error in validate.foreach

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

* format

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

* update message

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

* do not skip validation for all array entries when one is skipped

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

* add foreach tests

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

* fix fmt

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

* fix format errors

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

* remove unused declarations

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

* revert namespaceWithLabelYaml

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

* fix mutate of element list

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

* update CRDs

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

* Update api/kyverno/v1/policy_types.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update pkg/engine/forceMutate.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update pkg/engine/forceMutate.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update pkg/engine/forceMutate.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update pkg/engine/mutation.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update pkg/engine/mutation.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update pkg/engine/mutation.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update pkg/engine/validate/validate.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update pkg/engine/validate/validate.go

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update test/cli/test/custom-functions/policy.yaml

Co-authored-by: Steven E. Harris <seh@panix.com>

* Update test/cli/test/foreach/policies.yaml

Co-authored-by: Steven E. Harris <seh@panix.com>

* accept review comments and format

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

* add comments to strategicMergePatch buffer

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

* load context and evaluate preconditions foreach element

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

* add test for foreach mutate context and precondition

* precondition testcase

* address review comments

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

* update message

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

* format

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

Co-authored-by: Steven E. Harris <seh@panix.com>
Co-authored-by: Vyankatesh Kudtarkar <vyankateshkd@gmail.com>
2022-01-05 09:36:33 +08:00
Jim Bugwadia
b17e76493e
tighten and clarify Kyverno roles and permissions (#2799)
* update roles and rolebindings

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

* revert label and fix perms

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

* update role

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

* restrict role

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

* fix whitespace

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

* fix tests and roles

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

* update tests

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

* fix tests

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

* remove ingress extensions/v1beta1

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

* fix chart

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

* fix role

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

* tighten and clarify Kyverno roles and permissions

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

* fake commit to trigger workflows

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

* revert tests and update test role

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

* add newlines

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

* remove update role

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

* make fmt

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

* remove invalid param

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

* cleanup roles in Helm templates

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

* remove `mutate` cluster role binding

Signed-off-by: Jim Bugwadia <jim@nirmata.com>
2021-12-10 04:34:06 +00:00
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