Skip to content

Commit af9dfb0

Browse files
mnasiadkabbezak
authored andcommitted
Add Valkey
Change-Id: I02f3adf9825636e2b81c50543d6f95ea986019b6 Signed-off-by: Michal Nasiadka <mnasiadka@gmail.com>
1 parent 34923a3 commit af9dfb0

File tree

6 files changed

+112
-1
lines changed

6 files changed

+112
-1
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
2+
{% block labels %}
3+
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
4+
{% endblock %}
5+
6+
{% block valkey_base_header %}{% endblock %}
7+
8+
{% import "macros.j2" as macros with context %}
9+
10+
{{ macros.configure_user(name='valkey', homedir='/run/valkey') }}
11+
12+
COPY extend_start.sh /usr/local/bin/kolla_extend_start
13+
RUN chmod 644 /usr/local/bin/kolla_extend_start
14+
15+
{{ macros.kolla_patch_sources() }}
16+
17+
{% block valkey_base_footer %}{% endblock %}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
if [[ ! -d "/var/log/kolla/valkey" ]]; then
4+
mkdir -p /var/log/kolla/valkey
5+
fi
6+
7+
if [[ $(stat -c %a /var/log/kolla/valkey) != "755" ]]; then
8+
chmod 755 /var/log/kolla/valkey
9+
fi
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM {{ namespace }}/{{ image_prefix }}valkey-base:{{ tag }}
2+
{% block labels %}
3+
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
4+
{% endblock %}
5+
6+
{% block valkey_sentinel_header %}{% endblock %}
7+
8+
{% import "macros.j2" as macros with context %}
9+
10+
{% if base_package_type == 'rpm' %}
11+
{{ macros.enable_extra_repos(['epel']) }}
12+
{% set valkey_sentinel_packages = ['valkey'] %}
13+
{% elif base_package_type == 'deb' %}
14+
{% set valkey_sentinel_packages = ['valkey-sentinel'] %}
15+
{% endif %}
16+
{{ macros.install_packages(valkey_sentinel_packages | customizable("packages")) }}
17+
18+
COPY extend_start.sh /usr/local/bin/kolla_extend_start
19+
RUN chmod 644 /usr/local/bin/kolla_extend_start
20+
21+
{{ macros.kolla_patch_sources() }}
22+
23+
{% block valkey_sentinel_footer %}{% endblock %}
24+
{% block footer %}{% endblock %}
25+
26+
USER valkey
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
if [[ ! -d "/var/log/kolla/valkey" ]]; then
4+
mkdir -p /var/log/kolla/valkey
5+
fi
6+
7+
if [[ $(stat -c %a /var/log/kolla/valkey) != "755" ]]; then
8+
chmod 755 /var/log/kolla/valkey
9+
fi
10+
11+
# The CONFIG REWRITE command rewrites the valkey.conf
12+
# file the server was started with, applying the minimal
13+
# changes needed to make it reflect the configuration
14+
# currently used by the server, which may be different
15+
# compared to the original one because of the use of
16+
# the CONFIG SET command.
17+
#
18+
# https://valkey.io/commands/config-rewrite/
19+
#
20+
# Because of above behaviour it's needed to
21+
# hack kolla's CMD.
22+
#
23+
# Without this hack
24+
# /usr/local/bin/kolla_set_configs --check
25+
# is always reporting changed.
26+
#
27+
# Therefore valkey-sentinel is always restarted
28+
# even if configuration is not changed from
29+
# kolla-ansible side.
30+
if [ ! -z "${VALKEY_CONF}" ] && [ ! -z ${VALKEY_GEN_CONF} ]; then
31+
cp ${VALKEY_CONF} ${VALKEY_GEN_CONF}
32+
fi
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
FROM {{ namespace }}/{{ image_prefix }}valkey-base:{{ tag }}
2+
{% block labels %}
3+
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
4+
{% endblock %}
5+
6+
{% block valkey_server_header %}{% endblock %}
7+
8+
{% import "macros.j2" as macros with context %}
9+
10+
{% if base_package_type == 'rpm' %}
11+
{{ macros.enable_extra_repos(['epel']) }}
12+
{% set valkey_server_packages = ['valkey'] %}
13+
{% elif base_package_type == 'deb' %}
14+
{% set valkey_server_packages = ['valkey'] %}
15+
{% endif %}
16+
{{ macros.install_packages(valkey_server_packages | customizable("packages")) }}
17+
18+
{{ macros.kolla_patch_sources() }}
19+
20+
{% block valkey_server_footer %}{% endblock %}
21+
{% block footer %}{% endblock %}
22+
23+
USER valkey

kolla/common/users.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,5 +345,9 @@
345345
'hsmusers-user': {
346346
'uid': 42493, # This is not used, but the group ID is required.
347347
'gid': 42493,
348-
}
348+
},
349+
'valkey-user': {
350+
'uid': 42494,
351+
'gid': 42494,
352+
},
349353
}

0 commit comments

Comments
 (0)