58 lines
1.2 KiB
Bash
Executable File
58 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Redis — the cluster half of the redis cabinet: cache/broker, no persistence.
|
|
# Notes: docs/notes/addons.md
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")/.."
|
|
|
|
source ./lib/config.sh
|
|
load_config
|
|
|
|
K="kubectl --context ${KUBECONTEXT}"
|
|
NS="${DATA_NAMESPACE:-data}"
|
|
|
|
$K get namespace "$NS" >/dev/null 2>&1 || $K create namespace "$NS"
|
|
|
|
echo " applying manifests"
|
|
$K apply -n "$NS" -f - >/dev/null <<YAML
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: redis
|
|
spec:
|
|
selector:
|
|
app: redis
|
|
ports:
|
|
- port: 6379
|
|
targetPort: 6379
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: redis
|
|
spec:
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: redis
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: redis
|
|
spec:
|
|
containers:
|
|
- name: redis
|
|
image: ${REDIS_IMAGE}
|
|
ports:
|
|
- containerPort: 6379
|
|
readinessProbe:
|
|
exec:
|
|
command: ["redis-cli", "ping"]
|
|
initialDelaySeconds: 3
|
|
periodSeconds: 5
|
|
YAML
|
|
|
|
echo " waiting for redis..."
|
|
$K rollout status deployment/redis -n "$NS" --timeout=180s
|
|
|
|
echo " in-cluster: redis://redis.${NS}.svc.cluster.local:6379/0"
|