forked from kyverno/kyverno
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(mutate): don't eagerly process img-ver (kyverno#10703)
* feat(mutate): don't eagerly process img-ver Signed-off-by: Khaled Emara <[email protected]> * test(mutate): add mutate with img-ver test Signed-off-by: Khaled Emara <[email protected]> --------- Signed-off-by: Khaled Emara <[email protected]> Co-authored-by: Vishal Choudhary <[email protected]> Co-authored-by: shuting <[email protected]>
- Loading branch information
1 parent
65a43d2
commit bbb1d61
Showing
10 changed files
with
153 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...onformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
## Description | ||
|
||
This test performs a simple verification of an image using a public key specified directly in the policy as well as mutate the image before the verification. | ||
|
||
## Expected Behavior | ||
|
||
Pod creation should pass as the mutated image has been signed by the public key specified in the policy. | ||
|
||
## Reference Issue(s) | ||
|
||
N/A |
27 changes: 27 additions & 0 deletions
27
...conformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/chainsaw-test.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
creationTimestamp: null | ||
name: with-mutation | ||
spec: | ||
timeouts: | ||
delete: 2m | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: ns.yaml | ||
- apply: | ||
file: mut-cpol.yaml | ||
- assert: | ||
file: mut-cpol-assert.yaml | ||
- apply: | ||
file: img-cpol.yaml | ||
- assert: | ||
file: img-cpol-assert.yaml | ||
- name: step-02 | ||
try: | ||
- apply: | ||
file: test-pod.yaml | ||
- assert: | ||
file: test-pod-assert.yaml |
9 changes: 9 additions & 0 deletions
9
...nformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/img-cpol-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: with-mutation-img | ||
status: | ||
conditions: | ||
- reason: Succeeded | ||
status: "True" | ||
type: Ready |
30 changes: 30 additions & 0 deletions
30
test/conformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/img-cpol.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: with-mutation-img | ||
spec: | ||
background: false | ||
failurePolicy: Fail | ||
rules: | ||
- match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
name: with-mutation-rule | ||
verifyImages: | ||
- attestors: | ||
- entries: | ||
- keys: | ||
publicKeys: |- | ||
-----BEGIN PUBLIC KEY----- | ||
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8nXRh950IZbRj8Ra/N9sbqOPZrfM | ||
5/KAQN0/KjHcorm/J5yctVd7iEcnessRQjU917hmKO6JWVGHpDguIyakZA== | ||
-----END PUBLIC KEY----- | ||
rekor: | ||
ignoreTlog: true | ||
url: https://rekor.sigstore.dev | ||
imageReferences: | ||
- ghcr.io/kyverno/test-verify-image:* | ||
validationFailureAction: Enforce | ||
webhookTimeoutSeconds: 30 |
9 changes: 9 additions & 0 deletions
9
...nformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/mut-cpol-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: with-mutation-mut | ||
status: | ||
conditions: | ||
- reason: Succeeded | ||
status: "True" | ||
type: Ready |
22 changes: 22 additions & 0 deletions
22
test/conformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/mut-cpol.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: kyverno.io/v1 | ||
kind: ClusterPolicy | ||
metadata: | ||
name: with-mutation-mut | ||
spec: | ||
background: false | ||
failurePolicy: Fail | ||
rules: | ||
- match: | ||
any: | ||
- resources: | ||
kinds: | ||
- Pod | ||
name: with-mutation-rule | ||
mutate: | ||
patchStrategicMerge: | ||
spec: | ||
containers: | ||
- (name): test-secret | ||
image: "ghcr.io/kyverno/test-verify-image:signed" | ||
validationFailureAction: Enforce | ||
webhookTimeoutSeconds: 30 |
4 changes: 4 additions & 0 deletions
4
test/conformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/ns.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: test-verify-images |
5 changes: 5 additions & 0 deletions
5
...nformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/test-pod-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: test-with-mutation | ||
namespace: test-verify-images |
9 changes: 9 additions & 0 deletions
9
test/conformance/chainsaw/verifyImages/clusterpolicy/standard/with-mutation/test-pod.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: test-with-mutation | ||
namespace: test-verify-images | ||
spec: | ||
containers: | ||
- image: ghcr.io/kyverno/test-verify-image:unsigned | ||
name: test-secret |