11version: '2'
22
33services:
4- redis-server :
4+ redis:
55 image: ${ REDIS_VERSION}
66 environment:
77 REDIS_PASSWORD: '${ REDIS_PASSWORD} '
@@ -12,17 +12,20 @@ services:
1212 io.rancher.scheduler.affinity:host_label: ${ REDIS_SERVER_HOST_LABEL}
1313 { {- end} }
1414 io.rancher.container.pull_image: always
15- io.rancher.sidekicks: redis-server- config
15+ io.rancher.sidekicks: redis-config{ {- if ne .Values.REDIS_VOLUME_PATH " " } }, redis-data { {- end } }
1616 io.rancher.scheduler.affinity:container_label_ne: io.rancher.stack_service.name=$${ stack_name} /$${ service_name}
1717 io.rancher.container.hostname_override: container_name
1818 volumes_from:
19- - redis-server-config
19+ - redis-config
20+ { {- if ne .Values.REDIS_VOLUME_PATH " " } }
21+ - redis-data
22+ { {- end} }
2023 entrypoint: /opt/redis/scripts/server-entrypoint.sh
2124 command:
2225 - "redis-server"
2326 - "/usr/local/etc/redis/redis.conf"
2427
25- redis- sentinel:
28+ sentinel:
2629 image: ${ REDIS_VERSION}
2730 environment:
2831 REDIS_PASSWORD: '${ REDIS_PASSWORD} '
@@ -36,17 +39,20 @@ services:
3639 { {- if ne .Values.REDIS_SENTINEL_HOST_LABEL " " } }
3740 io.rancher.scheduler.affinity:host_label: ${ REDIS_SENTINEL_HOST_LABEL}
3841 { {- end} }
39- io.rancher.sidekicks: redis- sentinel-config
42+ io.rancher.sidekicks: sentinel-config{ {- if ne .Values.SENTINEL_VOLUME_PATH " " } }, sentinel-data { {- end } }
4043 io.rancher.container.hostname_override: container_name
4144 volumes_from:
42- - redis-sentinel-config
45+ - sentinel-config
46+ { {- if ne .Values.SENTINEL_VOLUME_PATH " " } }
47+ - sentinel-data
48+ { {- end} }
4349 entrypoint: /opt/redis/scripts/sentinel-entrypoint.sh
4450 command:
4551 - "redis-server"
4652 - "/usr/local/etc/redis/sentinel.conf"
4753 - "--sentinel"
4854
49- haproxy :
55+ redis-lb :
5056 image: rancher/lb-service-haproxy:v0.7.9
5157 ports:
5258 - ${ REDIS_HAPROXY_PORT} :6379/tcp
@@ -57,7 +63,7 @@ services:
5763 io.rancher.container.agent.role: environmentAdmin
5864 io.rancher.container.create_agent: 'true'
5965
60- redis-server- config:
66+ redis-config:
6167 image: lgatica/redis-config
6268 environment:
6369 REDIS_PASSWORD: '${ REDIS_PASSWORD} '
@@ -66,12 +72,16 @@ services:
6672 volumes:
6773 - /usr/local/etc/redis
6874 - /opt/redis/scripts
69- - redis-server:/data
7075 labels:
76+ { {- if ne .Values.REDIS_SERVER_HOST_LABEL " " } }
77+ io.rancher.scheduler.affinity:host_label: ${ REDIS_SERVER_HOST_LABEL}
78+ { {- end} }
7179 io.rancher.container.pull_image: always
7280 io.rancher.container.hostname_override: container_name
7381 io.rancher.container.start_once: 'true'
74- redis-sentinel-config:
82+ entrypoint: /bin/true
83+
84+ sentinel-config:
7585 image: lgatica/redis-config
7686 environment:
7787 REDIS_PASSWORD: '${ REDIS_PASSWORD} '
@@ -80,27 +90,39 @@ services:
8090 volumes:
8191 - /usr/local/etc/redis
8292 - /opt/redis/scripts
83- - redis-sentinel:/data
8493 labels:
94+ { {- if ne .Values.REDIS_SENTINEL_HOST_LABEL " " } }
95+ io.rancher.scheduler.affinity:host_label: ${ REDIS_SENTINEL_HOST_LABEL}
96+ { {- end} }
8597 io.rancher.container.pull_image: always
8698 io.rancher.container.hostname_override: container_name
8799 io.rancher.container.start_once: 'true'
100+ entrypoint: /bin/true
88101
89- { {- if or (.Values.REDIS_VOLUME_NAME) (.Values.SENTINEL_VOLUME_NAME)} }
90- volumes:
91- { {- if .Values.REDIS_VOLUME_NAME} }
92- { {.Values.REDIS_VOLUME_NAME} }:
93- external: true
94- { {- if .Values.STORAGE_DRIVER} }
95- driver: { {.Values.STORAGE_DRIVER} }
96- { {- end} }
102+ { {- if .Values.REDIS_VOLUME_PATH} }
103+ redis-data:
104+ image: busybox
105+ labels:
106+ { {- if ne .Values.REDIS_SERVER_HOST_LABEL " " } }
107+ io.rancher.scheduler.affinity:host_label: ${ REDIS_SERVER_HOST_LABEL}
108+ { {- end} }
109+ io.rancher.container.hostname_override: container_name
110+ io.rancher.container.start_once: 'true'
111+ volumes:
112+ - { {.Values.REDIS_VOLUME_PATH} }:/data
113+ entrypoint: /bin/true
97114 { {- end} }
98115
99- { {- if .Values.SENTINEL_VOLUME_NAME} }
100- { {.Values.SENTINEL_VOLUME_NAME} }:
101- external: true
102- { {- if .Values.STORAGE_DRIVER} }
103- driver: { {.Values.STORAGE_DRIVER} }
104- { {- end} }
116+ { {- if .Values.SENTINEL_VOLUME_PATH} }
117+ sentinel-data:
118+ image: busybox
119+ labels:
120+ { {- if ne .Values.REDIS_SENTINEL_HOST_LABEL " " } }
121+ io.rancher.scheduler.affinity:host_label: ${ REDIS_SENTINEL_HOST_LABEL}
122+ { {- end} }
123+ io.rancher.container.hostname_override: container_name
124+ io.rancher.container.start_once: 'true'
125+ volumes:
126+ - { {.Values.SENTINEL_VOLUME_PATH} }:/data
127+ entrypoint: /bin/true
105128 { {- end} }
106- { {- end } }
0 commit comments