-
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Chainsaw Action in CI (#722)
* add chainsaw action Signed-off-by: Shubham Gupta <[email protected]> * update Signed-off-by: Shubham Gupta <[email protected]> * fix Ci Signed-off-by: Shubham Gupta <[email protected]> * Add release Signed-off-by: Shubham Gupta <[email protected]> * Ci Signed-off-by: Shubham Gupta <[email protected]> * remove build Signed-off-by: Shubham Gupta <[email protected]> * test version Signed-off-by: Shubham Gupta <[email protected]> * try with 0.0.8 Signed-off-by: Shubham Gupta <[email protected]> * try with v0.0.9 Signed-off-by: Shubham Gupta <[email protected]> * bump Signed-off-by: Shubham Gupta <[email protected]> * try with v0.0.4 Signed-off-by: Shubham Gupta <[email protected]> * add : Setup Signed-off-by: Shubham Gupta <[email protected]> * only setup Signed-off-by: Shubham Gupta <[email protected]> * fix name Signed-off-by: Shubham Gupta <[email protected]> * fix Signed-off-by: Shubham Gupta <[email protected]> * increase timeout Signed-off-by: Shubham Gupta <[email protected]> * more time Signed-off-by: Shubham Gupta <[email protected]> * bump timeout Signed-off-by: Shubham Gupta <[email protected]> * Add teardown Signed-off-by: Shubham Gupta <[email protected]> * fix Signed-off-by: Shubham Gupta <[email protected]> * fix delete Signed-off-by: Shubham Gupta <[email protected]> * file Signed-off-by: Shubham Gupta <[email protected]> --------- Signed-off-by: Shubham Gupta <[email protected]>
- Loading branch information
1 parent
48add7e
commit 1e22658
Showing
14 changed files
with
1,052 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: E2E chainsaw tests | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- master | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
test: | ||
name: ${{ matrix.testpath }} | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
testpath: | ||
- ./tests/e2e-chainsaw/v1beta2/teardown/ | ||
- ./tests/e2e-chainsaw/v1beta2/setup/ | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Build Dockerfile | ||
run: docker build . --file Dockerfile --tag redis-operator:e2e | ||
|
||
- name: Install chainsaw | ||
uses: kyverno/chainsaw/.github/actions/[email protected] | ||
with: | ||
release: v0.0.9 | ||
|
||
- name: Check install | ||
run: chainsaw version | ||
|
||
- name: Install kubectl | ||
run: | | ||
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl" | ||
chmod +x kubectl | ||
sudo mv kubectl /usr/local/bin/ | ||
- name: Create k8s Kind Cluster | ||
uses: helm/[email protected] | ||
with: | ||
config: tests/_config/kind-config.yaml | ||
cluster_name: kind | ||
|
||
- name: Load Docker image into Kind | ||
run: | | ||
kubectl cluster-info --context kind-kind | ||
kind load docker-image redis-operator:e2e --name kind | ||
- name: Install Redis Operator | ||
run: | | ||
make deploy IMG=redis-operator:e2e | ||
- name: Wait for Redis Operator to be ready | ||
run: | | ||
kubectl wait --for=condition=available --timeout=300s deployment/redis-operator-redis-operator -n redis-operator-system | ||
- name: Run chainsaw test | ||
run: chainsaw test --test-dir ${{ matrix.testpath }} --config tests/_config/chainsaw-configuration.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,14 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json | ||
|
||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Configuration | ||
metadata: | ||
name: chainsaw-configuration | ||
spec: | ||
parallel: 1 | ||
delayBeforeCleanup: 10s | ||
timeouts: | ||
apply: 100s | ||
delete: 100s | ||
assert: 900s | ||
error: 900s |
19 changes: 19 additions & 0 deletions
19
tests/e2e-chainsaw/v1beta2/setup/redis-cluster/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,19 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
|
||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: redis-cluster-setup | ||
spec: | ||
steps: | ||
- try: | ||
- apply: | ||
file: cluster.yaml | ||
- assert: | ||
file: ready-cluster.yaml | ||
- assert: | ||
file: ready-sts.yaml | ||
- assert: | ||
file: ready-svc.yaml | ||
- assert: | ||
file: ready-pvc.yaml |
47 changes: 47 additions & 0 deletions
47
tests/e2e-chainsaw/v1beta2/setup/redis-cluster/cluster.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,47 @@ | ||
apiVersion: redis.redis.opstreelabs.in/v1beta2 | ||
kind: RedisCluster | ||
metadata: | ||
name: redis-cluster-v1beta2 | ||
spec: | ||
clusterSize: 3 | ||
clusterVersion: v7 | ||
persistenceEnabled: true | ||
podSecurityContext: | ||
runAsUser: 1000 | ||
fsGroup: 1000 | ||
kubernetesConfig: | ||
image: quay.io/opstree/redis:latest | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: 101m | ||
memory: 128Mi | ||
limits: | ||
cpu: 101m | ||
memory: 128Mi | ||
redisExporter: | ||
enabled: true | ||
image: quay.io/opstree/redis-exporter:v1.44.0 | ||
imagePullPolicy: Always | ||
resources: | ||
requests: | ||
cpu: 100m | ||
memory: 128Mi | ||
limits: | ||
cpu: 100m | ||
memory: 128Mi | ||
storage: | ||
volumeClaimTemplate: | ||
spec: | ||
# storageClassName: standard | ||
accessModes: ["ReadWriteOnce"] | ||
resources: | ||
requests: | ||
storage: 1Gi | ||
nodeConfVolume: true | ||
nodeConfVolumeClaimTemplate: | ||
spec: | ||
accessModes: ["ReadWriteOnce"] | ||
resources: | ||
requests: | ||
storage: 1Gi |
7 changes: 7 additions & 0 deletions
7
tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-cluster.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,7 @@ | ||
apiVersion: redis.redis.opstreelabs.in/v1beta2 | ||
kind: RedisCluster | ||
metadata: | ||
name: redis-cluster-v1beta2 | ||
status: | ||
readyFollowerReplicas: 3 | ||
readyLeaderReplicas: 3 |
181 changes: 181 additions & 0 deletions
181
tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-pvc.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,181 @@ | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-leader-0 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-leader-1 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-leader-2 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-follower-0 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-follower-1 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: node-conf-redis-cluster-v1beta2-follower-2 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
|
||
--- | ||
|
||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: redis-cluster-v1beta2-leader-redis-cluster-v1beta2-leader-0 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: redis-cluster-v1beta2-leader-redis-cluster-v1beta2-leader-1 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: redis-cluster-v1beta2-leader-redis-cluster-v1beta2-leader-2 | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: redis-cluster-v1beta2-follower-redis-cluster-v1beta2-follower-0 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: redis-cluster-v1beta2-follower-redis-cluster-v1beta2-follower-1 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound | ||
--- | ||
apiVersion: v1 | ||
kind: PersistentVolumeClaim | ||
metadata: | ||
name: redis-cluster-v1beta2-follower-redis-cluster-v1beta2-follower-2 | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
accessModes: | ||
- ReadWriteOnce | ||
capacity: | ||
storage: 1Gi | ||
phase: Bound |
25 changes: 25 additions & 0 deletions
25
tests/e2e-chainsaw/v1beta2/setup/redis-cluster/ready-sts.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,25 @@ | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: redis-cluster-v1beta2-leader | ||
labels: | ||
app: redis-cluster-v1beta2-leader | ||
redis_setup_type: cluster | ||
role: leader | ||
status: | ||
replicas: 3 | ||
readyReplicas: 3 | ||
|
||
--- | ||
|
||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: redis-cluster-v1beta2-follower | ||
labels: | ||
app: redis-cluster-v1beta2-follower | ||
redis_setup_type: cluster | ||
role: follower | ||
status: | ||
replicas: 3 | ||
readyReplicas: 3 |
Oops, something went wrong.