Skip to content

Commit

Permalink
test : validate all the cr in the example dir (#684)
Browse files Browse the repository at this point in the history
* validate-example

Signed-off-by: Shubham Gupta <[email protected]>

* modify name

Signed-off-by: Shubham Gupta <[email protected]>

* fixes

Signed-off-by: Shubham Gupta <[email protected]>

* fix err

Signed-off-by: Shubham Gupta <[email protected]>

* fix

Signed-off-by: Shubham Gupta <[email protected]>

* crd

Signed-off-by: Shubham Gupta <[email protected]>

* fix examples

Signed-off-by: Shubham Gupta <[email protected]>

* fix yamls

Signed-off-by: Shubham Gupta <[email protected]>

* fix yaml

Signed-off-by: Shubham Gupta <[email protected]>

* fix lint

Signed-off-by: Shubham Gupta <[email protected]>

* fix lint

Signed-off-by: Shubham Gupta <[email protected]>

* fix lint

Signed-off-by: Shubham Gupta <[email protected]>

* fix lint

Signed-off-by: Shubham Gupta <[email protected]>

---------

Signed-off-by: Shubham Gupta <[email protected]>
  • Loading branch information
shubham-cmyk authored Oct 28, 2023
1 parent 52c67ff commit 4a857f9
Show file tree
Hide file tree
Showing 64 changed files with 472 additions and 458 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/validate-example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Validate Examples

on:
pull_request:
branches:
- master
push:
branches:
- master

jobs:
validate-examples:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install yamllint
run: sudo apt-get install -y yamllint

- name: Lint YAML files
run: yamllint --strict ./example

- 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:
cluster_name: kind

- name: Apply CRD
run: |
for crd in $(find ./config/crd/bases -type f -name '*.yaml'); do
kubectl create -f $crd
done
- name: Validate CRD Installation
run: |
CRDs=("redis" "redissentinels" "redisclusters" "redisreplications")
for crd in "${CRDs[@]}"; do
kubectl get crd $crd.redis.redis.opstreelabs.in || exit 1
done
- name: Validate CR
run: |
for example in $(find ./example -type f -name '*.yaml'); do
kubectl apply --dry-run=server -f $example
done
2 changes: 1 addition & 1 deletion example/v1beta1/additional_config/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ metadata:
data:
redis-additional.conf: |
tcp-keepalive 400
slowlog-max-len 158
slowlog-max-len 158
stream-node-max-bytes 2048
10 changes: 5 additions & 5 deletions example/v1beta1/advance_config/clusterd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ spec:
resources:
requests:
storage: 1Gi
# nodeSelector: {}
# securityContext: {}
# priorityClassName: ""
# affinity: {}
# Tolerations: []
# nodeSelector: {}
# securityContext: {}
# priorityClassName: ""
# affinity: {}
# Tolerations: []
10 changes: 5 additions & 5 deletions example/v1beta1/advance_config/standalone.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ spec:
redisExporter:
enabled: false
image: quay.io/opstree/redis-exporter:v1.44.0
# nodeSelector: {}
# securityContext: {}
# priorityClassName: ""
# affinity: {}
# Tolerations: []
# nodeSelector: {}
# securityContext: {}
# priorityClassName: ""
# affinity: {}
# Tolerations: []
2 changes: 1 addition & 1 deletion example/v1beta1/affinity/clusterd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ spec:
operator: In
values:
- redis-cluster-follower
- redis-cluster-leader
- redis-cluster-leader
topologyKey: "kubernetes.io/hostname"
storage:
volumeClaimTemplate:
Expand Down
26 changes: 0 additions & 26 deletions example/v1beta1/eks-cluster.yaml

This file was deleted.

22 changes: 10 additions & 12 deletions example/v1beta1/external_service/cluster-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,16 @@ metadata:
role: leader
name: redis-cluster-leaders
spec:
clusterIP: 10.102.152.77
ports:
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis-cluster-leader
redis_setup_type: cluster
role: leader
# type: LoadBalancer
# type: LoadBalancer
type: NodePort
---
apiVersion: v1
Expand All @@ -30,15 +29,14 @@ metadata:
role: follower
name: redis-cluster-followers
spec:
clusterIP: 10.108.109.134
ports:
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis-cluster-follower
redis_setup_type: cluster
role: follower
# type: LoadBalancer
# type: LoadBalancer
type: NodePort
10 changes: 5 additions & 5 deletions example/v1beta1/external_service/replication-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ metadata:
name: redis-replication
spec:
ports:
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis-replication
redis_setup_type: replication
role: replication
# type: LoadBalancer
# type: LoadBalancer
type: NodePort
10 changes: 5 additions & 5 deletions example/v1beta1/external_service/standalone-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ metadata:
name: redis-standalone
spec:
ports:
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
- name: redis-client
port: 6379
protocol: TCP
targetPort: 6379
selector:
app: redis-standalone
redis_setup_type: standalone
role: standalone
# type: LoadBalancer
# type: LoadBalancer
type: NodePort
6 changes: 3 additions & 3 deletions example/v1beta1/password_protected/secret.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
---
apiVersion: v1
kind: Secret
metadata:
name: redis-secret
data:
password: T3BzdHJlZUAxMjM0Cg==
type: Opaque
password: T3BzdHJlZUAxMjM0Cg==
type: Opaque
54 changes: 27 additions & 27 deletions example/v1beta1/redis-cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ spec:
redisSecret:
name: redis-secret
key: password
# imagePullSecrets:
# - name: regcred
# imagePullSecrets:
# - name: regcred
redisExporter:
enabled: false
image: quay.io/opstree/redis-exporter:v1.44.0
Expand All @@ -36,26 +36,26 @@ spec:
limits:
cpu: 100m
memory: 128Mi
# Environment Variables for Redis Exporter
# env:
# - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS
# value: "true"
# - name: UI_PROPERTIES_FILE_NAME
# valueFrom:
# configMapKeyRef:
# name: game-demo
# key: ui_properties_file_name
# - name: SECRET_USERNAME
# valueFrom:
# secretKeyRef:
# name: mysecret
# key: username
# redisLeader:
# redisConfig:
# additionalRedisConfig: redis-external-config
# redisFollower:
# redisConfig:
# additionalRedisConfig: redis-external-config
# Environment Variables for Redis Exporter
# env:
# - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS
# value: "true"
# - name: UI_PROPERTIES_FILE_NAME
# valueFrom:
# configMapKeyRef:
# name: game-demo
# key: ui_properties_file_name
# - name: SECRET_USERNAME
# valueFrom:
# secretKeyRef:
# name: mysecret
# key: username
# redisLeader:
# redisConfig:
# additionalRedisConfig: redis-external-config
# redisFollower:
# redisConfig:
# additionalRedisConfig: redis-external-config
storage:
volumeClaimTemplate:
spec:
Expand All @@ -64,8 +64,8 @@ spec:
resources:
requests:
storage: 1Gi
# nodeSelector:
# kubernetes.io/hostname: minikube
# priorityClassName:
# Affinity:
# Tolerations: []
# nodeSelector:
# kubernetes.io/hostname: minikube
# priorityClassName:
# Affinity:
# Tolerations: []
44 changes: 22 additions & 22 deletions example/v1beta1/redis-replication.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
apiVersion: redis.redis.opstreelabs.in/v1beta1
kind: RedisReplication
metadata:
name: redis-replication
name: redis-replication
spec:
clusterSize: 3
securityContext:
runAsUser: 1000
fsGroup: 1000
# redisConfig:
# additionalRedisConfig: redis-external-config
kubernetesConfig:
kubernetesConfig:
image: quay.io/opstree/redis:v7.0.5
imagePullPolicy: IfNotPresent
resources:
Expand All @@ -20,11 +20,11 @@ spec:
limits:
cpu: 101m
memory: 128Mi
# redisSecret:
# name: redis-secret
# key: password
# imagePullSecrets:
# - name: regcred
# redisSecret:
# name: redis-secret
# key: password
# imagePullSecrets:
# - name: regcred
redisExporter:
enabled: false
image: quay.io/opstree/redis-exporter:v1.44.0
Expand All @@ -36,25 +36,25 @@ spec:
limits:
cpu: 100m
memory: 128Mi
# Environment Variables for Redis Exporter
# env:
# - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS
# value: "true"
# - name: UI_PROPERTIES_FILE_NAME
# valueFrom:
# configMapKeyRef:
# name: game-demo
# key: ui_properties_file_name
# - name: SECRET_USERNAME
# valueFrom:
# secretKeyRef:
# name: mysecret
# key: username
# Environment Variables for Redis Exporter
# env:
# - name: REDIS_EXPORTER_INCL_SYSTEM_METRICS
# value: "true"
# - name: UI_PROPERTIES_FILE_NAME
# valueFrom:
# configMapKeyRef:
# name: game-demo
# key: ui_properties_file_name
# - name: SECRET_USERNAME
# valueFrom:
# secretKeyRef:
# name: mysecret
# key: username
storage:
volumeClaimTemplate:
spec:
# storageClassName: standard
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 1Gi
storage: 1Gi
6 changes: 3 additions & 3 deletions example/v1beta1/redis-sentinel.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ spec:
securityContext:
runAsUser: 1000
fsGroup: 1000
redisSentinelConfig:
redisReplicationName : redis-replication
redisSentinelConfig:
redisReplicationName: redis-replication
kubernetesConfig:
image: quay.io/opstree/redis-sentinel:v7.0.12
image: quay.io/opstree/redis-sentinel:v7.0.12
imagePullPolicy: IfNotPresent
resources:
requests:
Expand Down
Loading

0 comments on commit 4a857f9

Please sign in to comment.