mirror of
https://github.com/tencentmusic/cube-studio.git
synced 2025-02-17 14:40:28 +08:00
133 lines
3.6 KiB
YAML
Executable File
133 lines
3.6 KiB
YAML
Executable File
|
|
---
|
|
# Source: redis/templates/redis-slave-deployment.yaml
|
|
|
|
apiVersion: extensions/v1beta1
|
|
kind: Deployment
|
|
metadata:
|
|
name: redis-slave
|
|
namespace: cloudai-2
|
|
labels:
|
|
app: redis
|
|
chart: redis-6.4.5
|
|
release: "redis"
|
|
heritage: "Tiller"
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
release: "redis"
|
|
role: slave
|
|
app: redis
|
|
template:
|
|
metadata:
|
|
labels:
|
|
release: "redis"
|
|
chart: redis-6.4.5
|
|
role: slave
|
|
app: redis
|
|
spec:
|
|
affinity:
|
|
nodeAffinity:
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
nodeSelectorTerms:
|
|
- matchExpressions:
|
|
- key: aicloud
|
|
operator: In
|
|
values:
|
|
- "true"
|
|
podAntiAffinity: # 尽量将pod分布在不同的主机
|
|
preferredDuringSchedulingIgnoredDuringExecution:
|
|
- weight: 1
|
|
podAffinityTerm:
|
|
topologyKey: "kubernetes.io/hostname"
|
|
labelSelector:
|
|
matchLabels:
|
|
app: redis-slave
|
|
securityContext:
|
|
fsGroup: 1001
|
|
serviceAccountName: "default"
|
|
containers:
|
|
- name: redis
|
|
image: docker.io/bitnami/redis:4.0.14
|
|
imagePullPolicy: "IfNotPresent"
|
|
securityContext:
|
|
runAsUser: 1001
|
|
command:
|
|
- /bin/bash
|
|
- -c
|
|
- |
|
|
if [[ -n $REDIS_PASSWORD_FILE ]]; then
|
|
password_aux=`cat ${REDIS_PASSWORD_FILE}`
|
|
export REDIS_PASSWORD=$password_aux
|
|
fi
|
|
if [[ -n $REDIS_MASTER_PASSWORD_FILE ]]; then
|
|
password_aux=`cat ${REDIS_MASTER_PASSWORD_FILE}`
|
|
export REDIS_MASTER_PASSWORD=$password_aux
|
|
fi
|
|
ARGS=("--port" "${REDIS_PORT}")
|
|
ARGS+=("--requirepass" "${REDIS_PASSWORD}")
|
|
ARGS+=("--slaveof" "${REDIS_MASTER_HOST}" "${REDIS_MASTER_PORT_NUMBER}")
|
|
ARGS+=("--masterauth" "${REDIS_MASTER_PASSWORD}")
|
|
ARGS+=("--include" "/opt/bitnami/redis/etc/redis.conf")
|
|
ARGS+=("--include" "/opt/bitnami/redis/etc/replica.conf")
|
|
/run.sh "${ARGS[@]}"
|
|
env:
|
|
- name: REDIS_REPLICATION_MODE
|
|
value: slave
|
|
- name: REDIS_MASTER_HOST
|
|
value: redis-master
|
|
- name: REDIS_PORT
|
|
value: "6379"
|
|
- name: REDIS_MASTER_PORT_NUMBER
|
|
value: "6379"
|
|
- name: REDIS_PASSWORD
|
|
value: admin
|
|
- name: REDIS_MASTER_PASSWORD
|
|
value: admin
|
|
ports:
|
|
- name: redis
|
|
containerPort: 6379
|
|
livenessProbe:
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 10
|
|
timeoutSeconds: 5
|
|
successThreshold: 1
|
|
failureThreshold: 5
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- /health/ping_local_and_master.sh 5
|
|
readinessProbe:
|
|
initialDelaySeconds: 5
|
|
periodSeconds: 10
|
|
timeoutSeconds: 1
|
|
successThreshold: 1
|
|
failureThreshold: 5
|
|
exec:
|
|
command:
|
|
- sh
|
|
- -c
|
|
- /health/ping_local_and_master.sh 1
|
|
resources:
|
|
null
|
|
|
|
volumeMounts:
|
|
- name: health
|
|
mountPath: /health
|
|
- name: redis-data
|
|
mountPath: /data
|
|
- name: config
|
|
mountPath: /opt/bitnami/redis/etc
|
|
volumes:
|
|
- name: health
|
|
configMap:
|
|
name: redis-health
|
|
defaultMode: 0755
|
|
- name: config
|
|
configMap:
|
|
name: redis
|
|
- name: redis-data
|
|
emptyDir: {}
|