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

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>
This commit is contained in:
Charles-Edouard Brétéché 2022-11-10 10:36:08 +01:00 committed by GitHub
parent 14e6aa4bba
commit 72dee76c06
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
38 changed files with 209 additions and 196 deletions

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- crd.yaml
assert:
- crd-ready.yaml

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- policy.yaml
assert:
- policy-ready.yaml

View file

@ -1,9 +1,6 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
namespace: tekton-test
spec:
steps:
- name: cosign
image: ghcr.io/sigstore/cosign/cosign@sha256:33a6a55d2f1354bc989b791974cf4ee00a900ab9e4e54b393962321758eee3c6
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- task.yaml
assert:
- task.yaml

View file

@ -1,7 +0,0 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
namespace: tekton-test
annotations:
kyverno.io/verify-images: '{"ghcr.io/sigstore/cosign/cosign@sha256:33a6a55d2f1354bc989b791974cf4ee00a900ab9e4e54b393962321758eee3c6":true}'

View file

@ -1,4 +0,0 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl delete -f 01-manifests.yaml,02-task.yaml --force --wait=true --ignore-not-found=true

View file

@ -0,0 +1,4 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev

View file

@ -0,0 +1,24 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev
spec:
group: tekton.dev
preserveUnknownFields: false
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
names:
kind: Task
plural: tasks
categories:
- tekton
- tekton-pipelines
scope: Namespaced

View file

@ -1,33 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
name: tekton-test
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev
spec:
group: tekton.dev
preserveUnknownFields: false
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
names:
kind: Task
plural: tasks
categories:
- tekton
- tekton-pipelines
scope: Namespaced
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
@ -60,4 +30,4 @@ spec:
subject: "https://github.com/*"
rekor:
url: https://rekor.sigstore.dev
required: true
required: true

View file

@ -0,0 +1,8 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
spec:
steps:
- name: cosign
image: ghcr.io/sigstore/cosign/cosign@sha256:33a6a55d2f1354bc989b791974cf4ee00a900ab9e4e54b393962321758eee3c6

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- crd.yaml
assert:
- crd-ready.yaml

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- policy.yaml
assert:
- policy-ready.yaml

View file

@ -2,4 +2,3 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
namespace: tekton-test

View file

@ -1,4 +0,0 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl delete -f 01-manifests.yaml --force --wait=true --ignore-not-found=true

View file

@ -2,7 +2,6 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
namespace: tekton-test
spec:
steps:
- name: ubuntu-example

View file

@ -0,0 +1,4 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev

View file

@ -0,0 +1,24 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev
spec:
group: tekton.dev
preserveUnknownFields: false
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
names:
kind: Task
plural: tasks
categories:
- tekton
- tekton-pipelines
scope: Namespaced

View file

@ -1,33 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
name: tekton-test
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev
spec:
group: tekton.dev
preserveUnknownFields: false
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
names:
kind: Task
plural: tasks
categories:
- tekton
- tekton-pipelines
scope: Namespaced
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- crd.yaml
assert:
- crd-ready.yaml

View file

@ -1,54 +0,0 @@
apiVersion: v1
kind: Namespace
metadata:
name: tekton-test
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev
spec:
group: tekton.dev
preserveUnknownFields: false
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
names:
kind: Task
plural: tasks
categories:
- tekton
- tekton-pipelines
scope: Namespaced
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: tasks-no-extractor
spec:
validationFailureAction: enforce
rules:
- name: verify-images
match:
any:
- resources:
kinds:
- tekton.dev/v1beta1/Task
preconditions:
- key: "{{request.operation}}"
operator: NotEquals
value: DELETE
verifyImages:
- image: "*"
key: |-
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8nXRh950IZbRj8Ra/N9sbqOPZrfM
5/KAQN0/KjHcorm/J5yctVd7iEcnessRQjU917hmKO6JWVGHpDguIyakZA==
-----END PUBLIC KEY-----

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- policy.yaml
assert:
- policy-ready.yaml

View file

@ -1,9 +1,6 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
namespace: tekton-test
spec:
steps:
- name: ubuntu-example
image: ubuntu:bionic
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- task.yaml
assert:
- task.yaml

View file

@ -1,4 +0,0 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl delete -f 01-manifests.yaml,02-task.yaml --force --wait=true --ignore-not-found=true

View file

@ -0,0 +1,4 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev

View file

@ -0,0 +1,24 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev
spec:
group: tekton.dev
preserveUnknownFields: false
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
names:
kind: Task
plural: tasks
categories:
- tekton
- tekton-pipelines
scope: Namespaced

View file

@ -0,0 +1,24 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: tasks-no-extractor
spec:
validationFailureAction: enforce
rules:
- name: verify-images
match:
any:
- resources:
kinds:
- tekton.dev/v1beta1/Task
preconditions:
- key: "{{request.operation}}"
operator: NotEquals
value: DELETE
verifyImages:
- image: "*"
key: |-
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8nXRh950IZbRj8Ra/N9sbqOPZrfM
5/KAQN0/KjHcorm/J5yctVd7iEcnessRQjU917hmKO6JWVGHpDguIyakZA==
-----END PUBLIC KEY-----

View file

@ -2,4 +2,7 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
namespace: tekton-test
spec:
steps:
- name: ubuntu-example
image: ubuntu:bionic

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- crd.yaml
assert:
- crd-ready.yaml

View file

@ -0,0 +1,6 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- policy.yaml
assert:
- policy-ready.yaml

View file

@ -1,5 +0,0 @@
apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
namespace: tekton-test

View file

@ -1,4 +0,0 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
commands:
- command: kubectl delete -f 01-manifests.yaml --force --wait=true --ignore-not-found=true

View file

@ -2,7 +2,6 @@ apiVersion: tekton.dev/v1beta1
kind: Task
metadata:
name: example-task-name
namespace: tekton-test
spec:
steps:
- name: ubuntu-example

View file

@ -0,0 +1,4 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev

View file

@ -0,0 +1,24 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev
spec:
group: tekton.dev
preserveUnknownFields: false
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
names:
kind: Task
plural: tasks
categories:
- tekton
- tekton-pipelines
scope: Namespaced

View file

@ -1,33 +1,3 @@
apiVersion: v1
kind: Namespace
metadata:
name: tekton-test
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: tasks.tekton.dev
spec:
group: tekton.dev
preserveUnknownFields: false
versions:
- name: v1beta1
served: true
storage: true
schema:
openAPIV3Schema:
type: object
x-kubernetes-preserve-unknown-fields: true
subresources:
status: {}
names:
kind: Task
plural: tasks
categories:
- tekton
- tekton-pipelines
scope: Namespaced
---
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
@ -55,4 +25,3 @@ spec:
MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE8nXRh950IZbRj8Ra/N9sbqOPZrfM
5/KAQN0/KjHcorm/J5yctVd7iEcnessRQjU917hmKO6JWVGHpDguIyakZA==
-----END PUBLIC KEY-----
---