Skip to content

Commit

Permalink
chore: migrate more kuttl tests to chainsaw (#826)
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 authored Dec 4, 2023
1 parent bd883fe commit 173186e
Show file tree
Hide file tree
Showing 235 changed files with 1,093 additions and 706 deletions.
24 changes: 12 additions & 12 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,12 @@ jobs:
# - istio
# - karpenter
# - kasten
- kubecost
- kubeops
- kubevirt
- linkerd
- nginx-ingress
- openshift
# - kubecost
# - kubeops
# - kubevirt
# - linkerd
# - nginx-ingress
# - openshift
- other/a
- other/b-d
- other/e-l
Expand Down Expand Up @@ -113,12 +113,12 @@ jobs:
- istio
- karpenter
- kasten
# - kubecost
# - kubeops
# - kubevirt
# - linkerd
# - nginx-ingress
# - openshift
- kubecost
- kubeops
- kubevirt
- linkerd
- nginx-ingress
- openshift
# - other/a
# - other/b-d
# - other/e-l
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: enable-kubecost-continuous-rightsizing
spec:
steps:
- name: step-01
try:
- apply:
file: ../enable-kubecost-continuous-rightsizing.yaml
- assert:
file: policy-ready.yaml
- name: step-02
try:
- apply:
file: ../.kyverno-test/resource.yaml
finally:
- sleep:
duration: 5s
- name: step-03
try:
- assert:
file: ../.kyverno-test/patchedResource1.yaml
- error:
file: not-patched-deploy.yaml

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kind: ClusterPolicy
metadata:
name: require-kubecost-labels
status:
ready: true
ready: true
37 changes: 37 additions & 0 deletions kubecost/require-kubecost-labels/.chainsaw-test/chainsaw-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: require-kubecost-labels
spec:
steps:
- name: step-01
try:
- script:
content: |
sed 's/validationFailureAction: Audit/validationFailureAction: Enforce/' ../require-kubecost-labels.yaml | kubectl create -f -
- assert:
file: chainsaw-step-01-assert-1.yaml
- name: step-02
try:
- apply:
file: pod-good.yaml
- apply:
file: podcontroller-good.yaml
- apply:
expect:
- check:
($error != null): true
file: pod-bad.yaml
- apply:
expect:
- check:
($error != null): true
file: podcontroller-bad.yaml
- name: step-99
try:
- delete:
ref:
apiVersion: kyverno.io/v1
kind: ClusterPolicy
name: require-kubecost-labels
5 changes: 0 additions & 5 deletions kubecost/require-kubecost-labels/01-enforce.yaml

This file was deleted.

11 changes: 0 additions & 11 deletions kubecost/require-kubecost-labels/02-manifests.yaml

This file was deleted.

6 changes: 0 additions & 6 deletions kubecost/require-kubecost-labels/99-delete.yaml

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: kubeops-cluster-ns
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: kubed
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
data:
kubeconfig: Y2x1c3RlcnM6DQotIGNsdXN0ZXI6DQogICAgY2VydGlmaWNhdGUtYXV0aG9yaXR5LWRhdGE6IFltRnlDZz09DQogICAgc2VydmVyOiBodHRwczovLzEyNy4wLjAuMToxMjM0NQ0KICBuYW1lOiBjbHVzdGVyDQpjb250ZXh0czoNCi0gY29udGV4dDoNCiAgICBjbHVzdGVyOiBjbHVzdGVyDQogICAgdXNlcjogdXNlcg0KICBuYW1lOiBjbHVzdGVyDQpjdXJyZW50LWNvbnRleHQ6IGNsdXN0ZXINCnByZWZlcmVuY2VzOiB7fQ0KdXNlcnM6DQotIG5hbWU6IHVzZXINCiAgdXNlcjoNCiAgICBjbGllbnQtY2VydGlmaWNhdGUtZGF0YTogWW1GeUNnPT0=
kind: Secret
metadata:
name: kubed
namespace: kubed
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
data:
value: Y2x1c3RlcnM6DQotIGNsdXN0ZXI6DQogICAgY2VydGlmaWNhdGUtYXV0aG9yaXR5LWRhdGE6IFptOXYNCiAgICBzZXJ2ZXI6IGh0dHBzOi8vMTI3LjAuMC4xOjY5NjkNCiAgbmFtZTogY2x1c3Rlcg0KY29udGV4dHM6DQotIGNvbnRleHQ6DQogICAgY2x1c3RlcjogY2x1c3Rlcg0KICAgIHVzZXI6IHVzZXINCiAgbmFtZTogY2x1c3Rlcg0KY3VycmVudC1jb250ZXh0OiBjbHVzdGVyDQpwcmVmZXJlbmNlczoge30NCnVzZXJzOg0KLSBuYW1lOiB1c2VyDQogIHVzZXI6DQogICAgY2xpZW50LWNlcnRpZmljYXRlLWRhdGE6IFptOXY=
kind: Secret
metadata:
name: rancher-cluster-kubeconfig
namespace: kubeops-cluster-ns
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: provisioning.cattle.io/v1
kind: Cluster
metadata:
name: rancher-cluster
namespace: kubeops-cluster-ns
spec:
rkeConfig:
machinePools:
- controlPlaneRole: true
machineConfigRef:
apiVersion: elemental.cattle.io/v1beta1
kind: MachineInventorySelectorTemplate
name: configref01
name: machine01
quantity: 1
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
apiVersion: v1
data:
value: Y2x1c3RlcnM6DQotIGNsdXN0ZXI6DQogICAgY2VydGlmaWNhdGUtYXV0aG9yaXR5LWRhdGE6IFptOXYNCiAgICBzZXJ2ZXI6IGh0dHBzOi8vMTI3LjAuMC4xOjU0MzIxDQogIG5hbWU6IGNsdXN0ZXINCmNvbnRleHRzOg0KLSBjb250ZXh0Og0KICAgIGNsdXN0ZXI6IGNsdXN0ZXINCiAgICB1c2VyOiB1c2VyDQogIG5hbWU6IGNsdXN0ZXINCmN1cnJlbnQtY29udGV4dDogY2x1c3Rlcg0KcHJlZmVyZW5jZXM6IHt9DQp1c2VyczoNCi0gbmFtZTogdXNlcg0KICB1c2VyOg0KICAgIGNsaWVudC1jZXJ0aWZpY2F0ZS1kYXRhOiBabTl2
kind: Secret
metadata:
name: sample-cluster-kubeconfig
namespace: kubeops-cluster-ns
data:
value: Y2x1c3RlcnM6DQotIGNsdXN0ZXI6DQogICAgY2VydGlmaWNhdGUtYXV0aG9yaXR5LWRhdGE6IFptOXYNCiAgICBzZXJ2ZXI6IGh0dHBzOi8vMTI3LjAuMC4xOjU0MzIxDQogIG5hbWU6IGNsdXN0ZXINCmNvbnRleHRzOg0KLSBjb250ZXh0Og0KICAgIGNsdXN0ZXI6IGNsdXN0ZXINCiAgICB1c2VyOiB1c2VyDQogIG5hbWU6IGNsdXN0ZXINCmN1cnJlbnQtY29udGV4dDogY2x1c3Rlcg0KcHJlZmVyZW5jZXM6IHt9DQp1c2VyczoNCi0gbmFtZTogdXNlcg0KICB1c2VyOg0KICAgIGNsaWVudC1jZXJ0aWZpY2F0ZS1kYXRhOiBabTl2
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: Test
metadata:
creationTimestamp: null
name: config-syncer-secret-generation-from-rancher-capi
spec:
steps:
- name: step-00
try:
- assert:
file: chainsaw-step-00-assert-1.yaml
- name: step-01
try:
- apply:
file: chainsaw-step-01-apply-1.yaml
- apply:
file: chainsaw-step-01-apply-2.yaml
- apply:
file: chainsaw-step-01-apply-3.yaml
- apply:
file: chainsaw-step-01-apply-4.yaml
- apply:
file: chainsaw-step-01-apply-5.yaml
- name: step-02
try:
- apply:
file: ../config-syncer-secret-generation-from-rancher-capi.yaml
- assert:
file: policy-ready.yaml
- assert:
file: secret-generated01.yaml
- name: step-03
try:
- apply:
file: chainsaw-step-03-apply-1.yaml
- name: step-04
try:
- apply:
file: cluster.yaml
- assert:
file: secret-generated02.yaml

This file was deleted.

This file was deleted.

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kyverno:background-controller:kubevirt-services
labels:
app.kubernetes.io/component: background-controller
app.kubernetes.io/instance: kyverno
app.kubernetes.io/part-of: kyverno
name: kyverno:background-controller:kubevirt-services
rules:
- apiGroups:
- ""
Expand All @@ -14,4 +14,4 @@ rules:
verbs:
- create
- update
- delete
- delete
29 changes: 29 additions & 0 deletions kubevirt/add-services/.chainsaw-test/chainsaw-test.yaml
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: add-services
spec:
steps:
- name: step-00
try:
- assert:
file: chainsaw-step-00-assert-1.yaml
- name: step-01
try:
- apply:
file: chainsaw-step-01-apply-1.yaml
- name: step-02
try:
- apply:
file: ../add-services.yaml
- assert:
file: policy-ready.yaml
- name: step-03
try:
- apply:
file: vmi.yaml
- name: step-04
try:
- assert:
file: generated-svc.yaml
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions kubevirt/add-services/02-policy.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions kubevirt/add-services/03-resources.yaml

This file was deleted.

4 changes: 0 additions & 4 deletions kubevirt/add-services/04-generated.yaml

This file was deleted.

Loading

0 comments on commit 173186e

Please sign in to comment.