Skip to content

Commit

Permalink
[Test] : add redis replication setup case (#677)
Browse files Browse the repository at this point in the history
* [Test] : add redis replication setup case

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* marking false

Signed-off-by: drivebyer <yang.wu@daocloud.io>

* fix for review

Signed-off-by: drivebyer <yang.wu@daocloud.io>

---------

Signed-off-by: drivebyer <yang.wu@daocloud.io>
  • Loading branch information
drivebyer authored Oct 23, 2023
1 parent 42dfc93 commit 5b003ae
Show file tree
Hide file tree
Showing 6 changed files with 201 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/operator-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ jobs:
- name: Run Go Tests with coverage
run: go test ./... -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
uses: codecov/codecov-action@v3
with:
file: ./coverage.txt
fail_ci_if_error: true
fail_ci_if_error: false
verbose: true

code_quality_golang_ci_lint:
Expand Down
8 changes: 8 additions & 0 deletions tests/e2e/v1beta2/setup/redis-replication/00-install.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: kuttl.dev/v1beta1
kind: TestStep
apply:
- replication.yaml
assert:
- ready-sts.yaml
- ready-pvc.yaml
- ready-svc.yaml
44 changes: 44 additions & 0 deletions tests/e2e/v1beta2/setup/redis-replication/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
19 changes: 19 additions & 0 deletions tests/e2e/v1beta2/setup/redis-replication/ready-sts.yaml
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
90 changes: 90 additions & 0 deletions tests/e2e/v1beta2/setup/redis-replication/ready-svc.yaml
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
38 changes: 38 additions & 0 deletions tests/e2e/v1beta2/setup/redis-replication/replication.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
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
redisExporter:
enabled: false
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:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi

0 comments on commit 5b003ae

Please sign in to comment.