Skip to content

Commit

Permalink
chore: migrate more kuttl tests to chainsaw
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly committed Dec 4, 2023
1 parent 4a3180d commit b03c12e
Show file tree
Hide file tree
Showing 219 changed files with 1,138 additions and 744 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
# - cert-manager
# - consul
# - external-secret-operator
- flux
- istio
- karpenter
- kasten
# - flux
# - istio
# - karpenter
# - kasten
- kubecost
- kubeops
- kubevirt
Expand Down Expand Up @@ -109,10 +109,10 @@ jobs:
- cert-manager
- consul
- external-secret-operator
# - flux
# - istio
# - karpenter
# - kasten
- flux
- istio
- karpenter
- kasten
# - kubecost
# - kubeops
# - kubevirt
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
name: flux-tenant-namespace
labels:
toolkit.fluxcd.io/tenant: ftenant
toolkit.fluxcd.io/tenant: ftenant
name: flux-tenant-namespace
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: generate-flux-multi-tenant-resources
spec:
steps:
- name: step-01
try:
- apply:
file: ns.yaml
- apply:
file: cluster-role.yaml
- name: step-02
try:
- apply:
file: ../generate-flux-multi-tenant-resources.yaml
- assert:
file: policy-ready.yaml
- name: step-03
try:
- apply:
file: chainsaw-step-03-apply-1.yaml
- name: step-04
try:
- assert:
file: generatedResources.yaml
- error:
file: notGeneratedResource.yaml
5 changes: 0 additions & 5 deletions flux/generate-flux-multi-tenant-resources/01-manifests.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions flux/generate-flux-multi-tenant-resources/02-policy.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions flux/generate-flux-multi-tenant-resources/04-generated.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: kyverno.io/v1
kind: ClusterPolicy
metadata:
name: verify-flux-sources
status:
ready: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: buckets.source.toolkit.fluxcd.io
spec: {}
status:
acceptedNames:
kind: Bucket
listKind: BucketList
plural: buckets
singular: bucket
storedVersions:
- v1beta2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: gitrepositories.source.toolkit.fluxcd.io
spec: {}
status:
acceptedNames:
kind: GitRepository
listKind: GitRepositoryList
plural: gitrepositories
singular: gitrepository
storedVersions:
- v1
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: imagerepositories.image.toolkit.fluxcd.io
spec: {}
status:
acceptedNames:
kind: ImageRepository
listKind: ImageRepositoryList
plural: imagerepositories
singular: imagerepository
storedVersions:
- v1beta2
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
name: helmrepositories.source.toolkit.fluxcd.io
spec: {}
status:
acceptedNames:
kind: HelmRepository
listKind: HelmRepositoryList
plural: helmrepositories
singular: helmrepository
storedVersions:
- v1beta2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: istio-cr-authpol-ns
name: flux-system
63 changes: 63 additions & 0 deletions flux/verify-flux-sources/.chainsaw-test/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: verify-flux-sources
spec:
steps:
- name: step-01
try:
- script:
content: |
sed 's/validationFailureAction: audit/validationFailureAction: Enforce/' ../verify-flux-sources.yaml | kubectl create -f -
- assert:
file: chainsaw-step-01-assert-1.yaml
- assert:
file: chainsaw-step-01-assert-2.yaml
- assert:
file: chainsaw-step-01-assert-3.yaml
- assert:
file: chainsaw-step-01-assert-4.yaml
- assert:
file: chainsaw-step-01-assert-5.yaml
- name: step-02
try:
- apply:
file: chainsaw-step-02-apply-1.yaml
- name: step-03
try:
- apply:
expect:
- check:
($error != null): true
file: repo-bad-git.yaml
- apply:
expect:
- check:
($error != null): true
file: repo-bad-bucket.yaml
- apply:
expect:
- check:
($error != null): true
file: repo-bad-helm.yaml
- apply:
expect:
- check:
($error != null): true
file: repo-bad-image.yaml
- apply:
file: repo-good-git.yaml
- apply:
file: repo-good-bucket.yaml
- apply:
file: repo-good-helm.yaml
- apply:
file: repo-good-image.yaml
- name: step-99
try:
- delete:
ref:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
name: verify-flux-sources
File renamed without changes.
File renamed without changes.
File renamed without changes.
62 changes: 0 additions & 62 deletions flux/verify-flux-sources/01-assert.yaml

This file was deleted.

5 changes: 0 additions & 5 deletions flux/verify-flux-sources/01-enforce.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions flux/verify-flux-sources/03-manifests.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions flux/verify-flux-sources/99-delete.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: istio-test-en-ns
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: disabled
name: istio-test-dis-ns
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: istio-test-none-ns
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
foo: bar
name: istio-test-alt-ns
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: add-sidecar-injection-namespace
spec:
steps:
- name: step-01
try:
- apply:
file: ../add-sidecar-injection-namespace.yaml
- assert:
file: policy-ready.yaml
- name: step-02
try:
- apply:
file: chainsaw-step-02-apply-1.yaml
- apply:
file: chainsaw-step-02-apply-2.yaml
- apply:
file: chainsaw-step-02-apply-3.yaml
- apply:
file: chainsaw-step-02-apply-4.yaml
- name: step-03
try:
- assert:
file: patched-ns-alt.yaml
- assert:
file: patched-ns-disabled.yaml
- assert:
file: patched-ns-enabled.yaml
- assert:
file: patched-ns-none.yaml
6 changes: 0 additions & 6 deletions istio/add-sidecar-injection-namespace/01-policy.yaml

This file was deleted.

Loading

0 comments on commit b03c12e

Please sign in to comment.