Skip to content

Commit

Permalink
Update and upgrade redis configuration
Browse files Browse the repository at this point in the history
- Bring in line with the latest configuration for https://github.com/bcgov/openshift-aries-mediator-service/tree/main/openshift/templates/redis

Signed-off-by: Wade Barnes <[email protected]>
  • Loading branch information
WadeBarnes committed Mar 21, 2024
1 parent da5be89 commit 8e53c2d
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# REPLICAS=6
# IMAGE_REGISTRY=docker.io
# IMAGE_NAME=redis
# IMAGE_TAG=6.2.6-alpine
# IMAGE_TAG=7-alpine
# PVC_SIZE=512Mi
# STORAGE_CLASS=netapp-file-standard
# CPU_REQUEST=25m
# CPU_LIMIT=100m
# CPU_LIMIT=250m
# MEMORY_REQUEST=64Mi
# MEMORY_LIMIT=256Mi
TAG_NAME=dev
Expand Down
6 changes: 3 additions & 3 deletions openshift/templates/redis/redis-cluster-deploy.redis.param
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ GOSSIP_PORT=16379
REPLICAS=6
IMAGE_REGISTRY=docker.io
IMAGE_NAME=redis
IMAGE_TAG=6.2.6-alpine
IMAGE_TAG=7-alpine
PVC_SIZE=512Mi
STORAGE_CLASS=netapp-file-standard
CPU_REQUEST=25m
CPU_LIMIT=100m
CPU_REQUEST=125m
CPU_LIMIT=250m
MEMORY_REQUEST=64Mi
MEMORY_LIMIT=256Mi
TAG_NAME=dev
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# REPLICAS=6
# IMAGE_REGISTRY=docker.io
# IMAGE_NAME=redis
# IMAGE_TAG=6.2.6-alpine
# IMAGE_TAG=7-alpine
# PVC_SIZE=512Mi
# STORAGE_CLASS=netapp-file-standard
# CPU_REQUEST=25m
# CPU_LIMIT=100m
# CPU_LIMIT=250m
# MEMORY_REQUEST=64Mi
# MEMORY_LIMIT=256Mi
TAG_NAME=prod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
# REPLICAS=6
# IMAGE_REGISTRY=docker.io
# IMAGE_NAME=redis
# IMAGE_TAG=6.2.6-alpine
# IMAGE_TAG=7-alpine
# PVC_SIZE=512Mi
# STORAGE_CLASS=netapp-file-standard
# CPU_REQUEST=25m
# CPU_LIMIT=100m
# CPU_LIMIT=250m
# MEMORY_REQUEST=64Mi
# MEMORY_LIMIT=256Mi
TAG_NAME=test
Expand Down
53 changes: 43 additions & 10 deletions openshift/templates/redis/redis-cluster-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,36 @@
# - Cluster requires one time initialization.
# - TODO: Automate the cluster initialization process.
# - https://gist.github.com/jujaga/7048148a7c960d6a910ff29f33565407
# - https://github.com/bcgov/nr-get-token/wiki/Redis-Troubleshooting
# - https://github.com/bcgov/common-service-showcase/wiki/Redis-Troubleshooting

# ==================================================
# Troubleshooting
# ==================================================
# Resync the Redis Cluster
# --------------------------------------------------
# export INSTANCE=<YOURINSTANCE>
# export NAMESPACE=<YOURNAMESPACE>
# oc get pods -n $NAMESPACE -l statefulset=redis-$INSTANCE -o jsonpath='{range.items[*]}{.status.podIP} 6379 {end}' | xargs -n2 oc exec -n $NAMESPACE -i redis-$INSTANCE-0 -- redis-cli -c CLUSTER MEET
# --------------------------------------------------
# Redis Cluster Info
# --------------------------------------------------
# oc exec -n $NAMESPACE -i redis-$INSTANCE-0 -- redis-cli -c CLUSTER INFO
# --------------------------------------------------
# Redis Cluster Nodes
# --------------------------------------------------
# oc exec -n $NAMESPACE -i redis-$INSTANCE-0 -- redis-cli -c CLUSTER NODES
# ==================================================

# TODO List:
# - Automate the cluster initialization process, as listed above.
# - Automate the cluster initialization process:
# export INSTANCE=<YOURINSTANCE>
# export NAMESPACE=<YOURNAMESPACE>
# oc exec -n $NAMESPACE -it redis-$INSTANCE-0 -- redis-cli -a $(oc get secret -n $NAMESPACE redis-$INSTANCE -o jsonpath='{.data.password}' | base64 -d) --cluster create --cluster-replicas 1 $(oc get pods -n $NAMESPACE -l statefulset=redis-$INSTANCE -o jsonpath='{range.items[*]}{.status.podIP}:6379 {end}')
#
# - Decouple the image from the DC.
# - Manage the image in the tools project with deployment environment tags.

---
apiVersion: v1
apiVersion: template.openshift.io/v1
kind: Template
metadata:
annotations:
Expand Down Expand Up @@ -92,7 +113,7 @@ objects:
exit 1
fi
echo Updating my IP to $POD_IP in $CLUSTER_CONFIG
sed -i.bak -e /myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/$POD_IP/ $CLUSTER_CONFIG
sed -i.bak -e "/myself/ s/[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}/$POD_IP/" $CLUSTER_CONFIG
fi
exec $@
Expand Down Expand Up @@ -137,6 +158,18 @@ objects:
role: ${ROLE}
statefulset: ${NAME}${INSTANCE_DELIMITER}${INSTANCE}
spec:
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
values:
- ${NAME}${INSTANCE_DELIMITER}${INSTANCE}
operator: In
topologyKey: kubernetes.io/hostname
containers:
- name: redis
image: ${IMAGE_REGISTRY}/${IMAGE_NAME}:${IMAGE_TAG}
Expand Down Expand Up @@ -312,7 +345,7 @@ parameters:
description: Redis Image Tag
displayName: Image Tag
required: true
value: 6.2.6-alpine
value: 7-alpine

- name: PVC_SIZE
description: The size of the persistent volume to create.
Expand Down Expand Up @@ -347,12 +380,12 @@ parameters:
value: 256Mi

- name: TAG_NAME
description:
displayName:
description:
displayName:
required: true
value: dev
- name: NAMESPACE_NAME
description:
displayName:
description:
displayName:
required: true
value: e79518

0 comments on commit 8e53c2d

Please sign in to comment.