[chassis] Fixed critical process not correct for database-chassis docker (#13445)

*Critical process for database-chassis is redis-chassis but critical_process contains hard-coded
to `redis` program always. Instead using jinja2 template to render critical process list based on database docker type. redis-chassis for database-chassis docker and redis for regular database docker.
This commit is contained in:
abdosi 2023-01-20 10:21:48 -08:00 committed by GitHub
parent b03a65f331
commit 439d4eab98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 2 deletions

View File

@ -36,12 +36,12 @@ RUN apt-get clean -y && \
' /etc/redis/redis.conf
COPY ["supervisord.conf.j2", "/usr/share/sonic/templates/"]
COPY ["critical_processes.j2", "/usr/share/sonic/templates/"]
COPY ["docker-database-init.sh", "/usr/local/bin/"]
COPY ["database_config.json.j2", "/usr/share/sonic/templates/"]
COPY ["database_global.json.j2", "/usr/share/sonic/templates/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["files/sysctl-net.conf", "/etc/sysctl.d/"]
COPY ["critical_processes", "/etc/supervisor"]
COPY ["files/update_chassisdb_config", "/usr/local/bin/"]
COPY ["flush_unused_database", "/usr/local/bin/"]

View File

@ -1 +0,0 @@
program:redis

View File

@ -0,0 +1,5 @@
{% if INSTANCES %}
{% for redis_inst, redis_items in INSTANCES.items() %}
program:{{ redis_inst }}
{%- endfor %}
{%- endif %}

View File

@ -52,6 +52,7 @@ if [[ $DATABASE_TYPE == "chassisdb" ]]; then
update_chassisdb_config -j $db_cfg_file_tmp -k -p $chassis_db_port
# generate all redis server supervisord configuration file
sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/critical_processes.j2 > /etc/supervisor/critical_processes
rm $db_cfg_file_tmp
exec /usr/local/bin/supervisord
exit 0
@ -69,6 +70,7 @@ fi
# delete chassisdb config to generate supervisord config
update_chassisdb_config -j $db_cfg_file_tmp -d
sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/supervisord.conf.j2 > /etc/supervisor/conf.d/supervisord.conf
sonic-cfggen -j $db_cfg_file_tmp -t /usr/share/sonic/templates/critical_processes.j2 > /etc/supervisor/critical_processes
if [[ "$start_chassis_db" != "1" ]] && [[ -z "$chassis_db_address" ]]; then
cp $db_cfg_file_tmp $db_cfg_file