aboutsummaryrefslogtreecommitdiff
path: root/docker
diff options
context:
space:
mode:
authorMichal Arbet <michal.arbet@ultimum.io>2022-05-06 18:00:08 +0200
committerRadosław Piliszek <radoslaw.piliszek@gmail.com>2022-05-18 09:35:50 +0000
commit9040d4f5271912f94635e495d65463956ac9ab75 (patch)
treeb51eb1e6014efdd5fc1301bdca2bf234c5aab70a /docker
parent0e3b29c5fdfccd80a8951f38f015103359d24783 (diff)
downloadkolla-9040d4f5271912f94635e495d65463956ac9ab75.tar.gz
kolla-9040d4f5271912f94635e495d65463956ac9ab75.zip
Fix redis-sentinel containers always reporting changed
The CONFIG REWRITE command rewrites the redis.conf file the server was started with, applying the minimal changes needed to make it reflect the configuration currently used by the server, which may be different compared to the original one because of the use of the CONFIG SET command. https://redis.io/commands/config-rewrite/ Because of above behaviour it's needed to hack kolla's CMD. Without this hack container's /usr/local/bin/kolla_set_configs --check is always reporting changed state even if config is not changed. Therefore redis containers are always restarted by kolla-ansible. This patch is fixing this. Change-Id: I8245b9e753fa4175dacfa679a078f63876b0d327 Partial-Bug: #1967664
Diffstat (limited to 'docker')
-rw-r--r--docker/redis/redis-sentinel/Dockerfile.j23
-rw-r--r--docker/redis/redis-sentinel/extend_start.sh32
2 files changed, 35 insertions, 0 deletions
diff --git a/docker/redis/redis-sentinel/Dockerfile.j2 b/docker/redis/redis-sentinel/Dockerfile.j2
index d98e687db..40ec887f2 100644
--- a/docker/redis/redis-sentinel/Dockerfile.j2
+++ b/docker/redis/redis-sentinel/Dockerfile.j2
@@ -14,6 +14,9 @@ LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build
{% endif %}
{{ macros.install_packages(redis_sentinel_packages | customizable("packages")) }}
+COPY extend_start.sh /usr/local/bin/kolla_extend_start
+RUN chmod 644 /usr/local/bin/kolla_extend_start
+
{% block redis_sentinel_footer %}{% endblock %}
{% block footer %}{% endblock %}
diff --git a/docker/redis/redis-sentinel/extend_start.sh b/docker/redis/redis-sentinel/extend_start.sh
new file mode 100644
index 000000000..9044f3990
--- /dev/null
+++ b/docker/redis/redis-sentinel/extend_start.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+if [[ ! -d "/var/log/kolla/redis" ]]; then
+ mkdir -p /var/log/kolla/redis
+fi
+
+if [[ $(stat -c %a /var/log/kolla/redis) != "755" ]]; then
+ chmod 755 /var/log/kolla/redis
+fi
+
+# The CONFIG REWRITE command rewrites the redis.conf
+# file the server was started with, applying the minimal
+# changes needed to make it reflect the configuration
+# currently used by the server, which may be different
+# compared to the original one because of the use of
+# the CONFIG SET command.
+#
+# https://redis.io/commands/config-rewrite/
+#
+# Because of above behaviour it's needed to
+# hack kolla's CMD.
+#
+# Without this hack
+# /usr/local/bin/kolla_set_configs --check
+# is always reporting changed.
+#
+# Therefore redis-sentinel is always restarted
+# even if configuration is not changed from
+# kolla-ansible side.
+if [ ! -z "${REDIS_CONF}" ] && [ ! -z ${REDIS_GEN_CONF} ]; then
+ cp ${REDIS_CONF} ${REDIS_GEN_CONF}
+fi