Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Add replication to chainsaw setup #730

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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-replication-setup
spec:
steps:
- try:
- apply:
file: replication.yaml
- assert:
file: ready-sts.yaml
- assert:
file: ready-svc.yaml
- assert:
file: ready-pvc.yaml

Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-replication-redis-replication-0
labels:
app: redis-replication
redis_setup_type: replication
role: replication
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
phase: Bound
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-replication-redis-replication-1
labels:
app: redis-replication
redis_setup_type: replication
role: replication
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
phase: Bound
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: redis-replication-redis-replication-2
labels:
app: redis-replication
redis_setup_type: replication
role: replication
status:
accessModes:
- ReadWriteOnce
capacity:
storage: 1Gi
phase: Bound
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: apps/v1
kind: StatefulSet
metadata:
annotations:
redis.opstreelabs.in: "true"
redis.opstreelabs.instance: redis-replication
labels:
app: redis-replication
redis_setup_type: replication
role: replication
name: redis-replication
ownerReferences:
- apiVersion: redis.redis.opstreelabs.in/v1beta2
controller: true
kind: RedisReplication
name: redis-replication
status:
readyReplicas: 3
replicas: 3
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/port: "9121"
prometheus.io/scrape: "true"
redis.opstreelabs.in: "true"
redis.opstreelabs.instance: redis-replication
labels:
app: redis-replication
redis_setup_type: replication
role: replication
name: redis-replication
ownerReferences:
- apiVersion: redis.redis.opstreelabs.in/v1beta2
controller: true
kind: RedisReplication
name: redis-replication
spec:
ports:
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis-replication
redis_setup_type: replication
role: replication
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/port: "9121"
prometheus.io/scrape: "true"
redis.opstreelabs.in: "true"
redis.opstreelabs.instance: redis-replication
labels:
app: redis-replication
redis_setup_type: replication
role: replication
name: redis-replication-additional
ownerReferences:
- apiVersion: redis.redis.opstreelabs.in/v1beta2
controller: true
kind: RedisReplication
name: redis-replication
spec:
ports:
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis-replication
redis_setup_type: replication
role: replication
type: ClusterIP
---
apiVersion: v1
kind: Service
metadata:
annotations:
prometheus.io/port: "9121"
prometheus.io/scrape: "true"
redis.opstreelabs.in: "true"
redis.opstreelabs.instance: redis-replication
labels:
app: redis-replication
redis_setup_type: replication
role: replication
name: redis-replication-headless
ownerReferences:
- apiVersion: redis.redis.opstreelabs.in/v1beta2
controller: true
kind: RedisReplication
name: redis-replication
spec:
clusterIP: None
ports:
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis-replication
redis_setup_type: replication
role: replication
type: ClusterIP
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
apiVersion: redis.redis.opstreelabs.in/v1beta2
kind: RedisReplication
metadata:
name: redis-replication
spec:
clusterSize: 3
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
storage:
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi
Loading