Merge "Add Valkey"

This commit is contained in:
Zuul
2025-10-30 09:05:33 +00:00
committed by Gerrit Code Review
6 changed files with 112 additions and 1 deletions

View File

@@ -0,0 +1,17 @@
FROM {{ namespace }}/{{ image_prefix }}base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% block valkey_base_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{{ macros.configure_user(name='valkey', homedir='/run/valkey') }}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 644 /usr/local/bin/kolla_extend_start
{{ macros.kolla_patch_sources() }}
{% block valkey_base_footer %}{% endblock %}

View File

@@ -0,0 +1,9 @@
#!/bin/bash
if [[ ! -d "/var/log/kolla/valkey" ]]; then
mkdir -p /var/log/kolla/valkey
fi
if [[ $(stat -c %a /var/log/kolla/valkey) != "755" ]]; then
chmod 755 /var/log/kolla/valkey
fi

View File

@@ -0,0 +1,26 @@
FROM {{ namespace }}/{{ image_prefix }}valkey-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% block valkey_sentinel_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{% if base_package_type == 'rpm' %}
{{ macros.enable_extra_repos(['epel']) }}
{% set valkey_sentinel_packages = ['valkey'] %}
{% elif base_package_type == 'deb' %}
{% set valkey_sentinel_packages = ['valkey-sentinel'] %}
{% endif %}
{{ macros.install_packages(valkey_sentinel_packages | customizable("packages")) }}
COPY extend_start.sh /usr/local/bin/kolla_extend_start
RUN chmod 644 /usr/local/bin/kolla_extend_start
{{ macros.kolla_patch_sources() }}
{% block valkey_sentinel_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER valkey

View File

@@ -0,0 +1,32 @@
#!/bin/bash
if [[ ! -d "/var/log/kolla/valkey" ]]; then
mkdir -p /var/log/kolla/valkey
fi
if [[ $(stat -c %a /var/log/kolla/valkey) != "755" ]]; then
chmod 755 /var/log/kolla/valkey
fi
# The CONFIG REWRITE command rewrites the valkey.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://valkey.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 valkey-sentinel is always restarted
# even if configuration is not changed from
# kolla-ansible side.
if [ ! -z "${VALKEY_CONF}" ] && [ ! -z ${VALKEY_GEN_CONF} ]; then
cp ${VALKEY_CONF} ${VALKEY_GEN_CONF}
fi

View File

@@ -0,0 +1,23 @@
FROM {{ namespace }}/{{ image_prefix }}valkey-base:{{ tag }}
{% block labels %}
LABEL maintainer="{{ maintainer }}" name="{{ image_name }}" build-date="{{ build_date }}"
{% endblock %}
{% block valkey_server_header %}{% endblock %}
{% import "macros.j2" as macros with context %}
{% if base_package_type == 'rpm' %}
{{ macros.enable_extra_repos(['epel']) }}
{% set valkey_server_packages = ['valkey'] %}
{% elif base_package_type == 'deb' %}
{% set valkey_server_packages = ['valkey'] %}
{% endif %}
{{ macros.install_packages(valkey_server_packages | customizable("packages")) }}
{{ macros.kolla_patch_sources() }}
{% block valkey_server_footer %}{% endblock %}
{% block footer %}{% endblock %}
USER valkey

View File

@@ -345,5 +345,9 @@ USERS = {
'hsmusers-user': {
'uid': 42493, # This is not used, but the group ID is required.
'gid': 42493,
}
},
'valkey-user': {
'uid': 42494,
'gid': 42494,
},
}