Skip to content

Commit 639bbe1

Browse files
Revert "[containercfgd] Add containercfgd and syslog rate limit configuration support (sonic-net#12489)"
This reverts commit 3b3837a.
1 parent f02ab69 commit 639bbe1

26 files changed

+25
-563
lines changed

dockers/docker-base-bullseye/Dockerfile.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ RUN pip3 install supervisor==4.2.1
8181
# Add support for supervisord to handle startup dependencies
8282
RUN pip3 install supervisord-dependent-startup==1.4.0
8383

84-
RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d
84+
RUN mkdir -p /etc/supervisor /var/log/supervisor
8585

8686
# Install gcc, libc6-dev and python3-dev for compiling python-lzf
8787
RUN apt-get -y install build-essential libc6-dev python3-dev
@@ -119,10 +119,10 @@ RUN apt-get clean -y && \
119119
apt-get autoremove -y && \
120120
rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache
121121

122+
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
122123
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
123124
COPY ["root/.vimrc", "/root/.vimrc"]
124125

125126
RUN ln /usr/bin/vim.tiny /usr/bin/vim
126127

127128
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
128-
COPY ["etc/supervisor/containercfgd.conf", "/etc/supervisor/conf.d/"]

dockers/docker-base-bullseye/etc/supervisor/containercfgd.conf

-9
This file was deleted.

dockers/docker-base-buster/Dockerfile.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ RUN pip3 install supervisor==4.2.1
9494
# Add support for supervisord to handle startup dependencies
9595
RUN pip3 install supervisord-dependent-startup==1.4.0
9696

97-
RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d
97+
RUN mkdir -p /etc/supervisor /var/log/supervisor
9898

9999
RUN apt-get -y purge \
100100
exim4 \
@@ -117,10 +117,10 @@ RUN apt-get clean -y && \
117117
apt-get autoremove -y && \
118118
rm -rf /var/lib/apt/lists/* /tmp/* ~/.cache/
119119

120+
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
120121
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
121122
COPY ["root/.vimrc", "/root/.vimrc"]
122123

123124
RUN ln /usr/bin/vim.tiny /usr/bin/vim
124125

125126
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
126-
COPY ["etc/supervisor/containercfgd.conf", "/etc/supervisor/conf.d/"]

dockers/docker-base-buster/etc/supervisor/containercfgd.conf

-9
This file was deleted.

dockers/docker-base-stretch/Dockerfile.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ RUN pip install supervisor>=3.4.0
9090
# Add support for supervisord to handle startup dependencies
9191
RUN pip install supervisord-dependent-startup==1.4.0
9292

93-
RUN mkdir -p /var/log/supervisor /etc/supervisor/conf.d
93+
RUN mkdir -p /etc/supervisor /var/log/supervisor
9494

9595
RUN apt-get -y purge \
9696
exim4 \
@@ -113,10 +113,10 @@ RUN apt-get clean -y && \
113113
apt-get autoremove -y && \
114114
rm -rf /var/lib/apt/lists/* /tmp/*
115115

116+
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
116117
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
117118
COPY ["root/.vimrc", "/root/.vimrc"]
118119

119120
RUN ln /usr/bin/vim.tiny /usr/bin/vim
120121

121122
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
122-
COPY ["etc/supervisor/containercfgd.conf", "/etc/supervisor/conf.d/"]

dockers/docker-base-stretch/etc/supervisor/containercfgd.conf

-9
This file was deleted.

dockers/docker-base/Dockerfile.j2

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ RUN apt-get -y install \
4949
rsyslog \
5050
less
5151

52+
COPY ["etc/rsyslog.conf", "/etc/rsyslog.conf"]
5253
COPY ["etc/rsyslog.d/*", "/etc/rsyslog.d/"]
5354
COPY ["root/.vimrc", "/root/.vimrc"]
5455

@@ -63,11 +64,10 @@ RUN pip install wheel
6364
# Install supervisor
6465
RUN pip install supervisor>=3.4.0
6566
66-
RUN mkdir -p /etc/supervisor/conf.d
67+
RUN mkdir -p /etc/supervisor
6768
RUN mkdir -p /var/log/supervisor
6869
6970
COPY ["etc/supervisor/supervisord.conf", "/etc/supervisor/"]
70-
COPY ["etc/supervisor/containercfgd.conf", "/etc/supervisor/conf.d/"]
7171
7272
RUN apt-get -y purge \
7373
exim4 \

dockers/docker-base/etc/supervisor/containercfgd.conf

-9
This file was deleted.

dockers/docker-database/supervisord.conf.j2

+4-18
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,6 @@ logfile_maxbytes=1MB
33
logfile_backups=2
44
nodaemon=true
55

6-
[eventlistener:dependent-startup]
7-
command=python3 -m supervisord_dependent_startup
8-
autostart=true
9-
autorestart=unexpected
10-
startretries=0
11-
exitcodes=0,3
12-
events=PROCESS_STATE
13-
buffer_size=1024
14-
156
[eventlistener:supervisor-proc-exit-listener]
167
command=/usr/bin/supervisor-proc-exit-listener --container-name database
178
events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING
@@ -22,37 +13,32 @@ buffer_size=1024
2213
[program:rsyslogd]
2314
command=/usr/sbin/rsyslogd -n -iNONE
2415
priority=1
25-
autostart=false
16+
autostart=true
2617
autorestart=false
2718
stdout_logfile=syslog
2819
stderr_logfile=syslog
29-
dependent_startup=true
3020

3121
{% if INSTANCES %}
3222
{% for redis_inst, redis_items in INSTANCES.items() %}
33-
[program:{{ redis_inst }}]
23+
[program: {{ redis_inst }}]
3424
{% if redis_items['hostname'] != '127.0.0.1' and redis_inst != 'redis_chassis' %}
3525
{%- set LOOPBACK_IP = '127.0.0.1' -%}
3626
{%- else -%}
3727
{%- set LOOPBACK_IP = '' -%}
3828
{%- endif -%}
3929
command=/bin/bash -c "{ [[ -s /var/lib/{{ redis_inst }}/dump.rdb ]] || rm -f /var/lib/{{ redis_inst }}/dump.rdb; } && mkdir -p /var/lib/{{ redis_inst }} && exec /usr/bin/redis-server /etc/redis/redis.conf --bind {{ LOOPBACK_IP }} {{ redis_items['hostname'] }} --port {{ redis_items['port'] }} --unixsocket {{ redis_items['unix_socket_path'] }} --pidfile /var/run/redis/{{ redis_inst }}.pid --dir /var/lib/{{ redis_inst }}"
4030
priority=2
41-
autostart=false
31+
autostart=true
4232
autorestart=false
4333
stdout_logfile=syslog
4434
stderr_logfile=syslog
45-
dependent_startup=true
46-
dependent_startup_wait_for=rsyslogd:running
4735
{% endfor %}
4836
{% endif %}
4937

5038
[program:flushdb]
5139
command=/bin/bash -c "sleep 300 && /usr/local/bin/flush_unused_database"
5240
priority=3
53-
autostart=false
41+
autostart=true
5442
autorestart=false
5543
stdout_logfile=syslog
5644
stderr_logfile=syslog
57-
dependent_startup=true
58-
dependent_startup_wait_for=rsyslogd:running

files/build_templates/docker_image_ctl.j2

+9-24
Original file line numberDiff line numberDiff line change
@@ -34,27 +34,16 @@ function updateSyslogConf()
3434
# Also update the container name
3535
if [[ ($NUM_ASIC -gt 1) ]]; then
3636
TARGET_IP=$(docker network inspect bridge --format={{ "'{{(index .IPAM.Config 0).Gateway}}'" }})
37-
else
38-
if [ "$CONTAINER_EXISTS" = "yes" ]; then
39-
# database configuration has been synced to /etc/rsyslog.conf
40-
# no need generate it to save boot time
41-
return
42-
fi
43-
TARGET_IP="127.0.0.1"
44-
fi
45-
CONTAINER_NAME="$DOCKERNAME"
46-
TMP_FILE="/tmp/rsyslog.$CONTAINER_NAME.conf"
47-
{%- if docker_container_name == "database" %}
48-
python -c "import jinja2, os; paths=['/usr/share/sonic/templates']; loader = jinja2.FileSystemLoader(paths); env = jinja2.Environment(loader=loader, trim_blocks=True); template_file='/usr/share/sonic/templates/rsyslog-container.conf.j2'; template = env.get_template(os.path.basename(template_file)); data=template.render({\"target_ip\":\"$TARGET_IP\",\"container_name\":\"$CONTAINER_NAME\"}); print(data)" > $TMP_FILE
49-
{%- else %}
50-
sonic-cfggen -d -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\", \"platform\": \"$PLATFORM\" }" > $TMP_FILE
51-
if [ $? -ne 0 ]; then
52-
echo "Error: Execute sonic-cfggen -d failed. Execute without '-d'."
53-
sonic-cfggen -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\", \"platform\": \"$PLATFORM\" }" > $TMP_FILE
37+
CONTAINER_NAME="$DOCKERNAME"
38+
TMP_FILE="/tmp/rsyslog.$CONTAINER_NAME.conf"
39+
{%- if docker_container_name == "database" %}
40+
python -c "import jinja2, os; paths=['/usr/share/sonic/templates']; loader = jinja2.FileSystemLoader(paths); env = jinja2.Environment(loader=loader, trim_blocks=True); template_file='/usr/share/sonic/templates/rsyslog-container.conf.j2'; template = env.get_template(os.path.basename(template_file)); data=template.render({\"target_ip\":\"$TARGET_IP\",\"container_name\":\"$CONTAINER_NAME\"}); print(data)" > $TMP_FILE
41+
{%- else %}
42+
sonic-cfggen -t /usr/share/sonic/templates/rsyslog-container.conf.j2 -a "{\"target_ip\": \"$TARGET_IP\", \"container_name\": \"$CONTAINER_NAME\" }" > $TMP_FILE
43+
{%- endif %}
44+
docker cp $TMP_FILE ${DOCKERNAME}:/etc/rsyslog.conf
45+
rm -rf $TMP_FILE
5446
fi
55-
{%- endif %}
56-
docker cp $TMP_FILE ${DOCKERNAME}:/etc/rsyslog.conf
57-
rm -rf $TMP_FILE
5847
}
5948
function ebtables_config()
6049
{
@@ -407,7 +396,6 @@ start() {
407396
DOCKERMOUNT=`getMountPoint "$DOCKERCHECK"`
408397
{%- endif %}
409398
if [ x"$DOCKERMOUNT" == x"$MOUNTPATH" ]; then
410-
CONTAINER_EXISTS="yes"
411399
preStartAction
412400
{%- if docker_container_name == "database" %}
413401
echo "Starting existing ${DOCKERNAME} container"
@@ -619,7 +607,6 @@ start() {
619607
$REDIS_MNT \
620608
-v /etc/fips/fips_enable:/etc/fips/fips_enable:ro \
621609
-v /usr/share/sonic/device/$PLATFORM:/usr/share/sonic/platform:ro \
622-
-v /usr/share/sonic/templates/rsyslog-container.conf.j2:/usr/share/sonic/templates/rsyslog-container.conf.j2:ro \
623610
{%- if sonic_asic_platform != "mellanox" %}
624611
{%- if mount_default_tmpfs|default("n") == "y" %}
625612
--tmpfs /tmp \
@@ -631,7 +618,6 @@ start() {
631618
--env "NAMESPACE_ID"="$DEV" \
632619
--env "NAMESPACE_PREFIX"="$NAMESPACE_PREFIX" \
633620
--env "NAMESPACE_COUNT"=$NUM_ASIC \
634-
--env "CONTAINER_NAME"=$DOCKERNAME \
635621
--name=$DOCKERNAME \
636622
{%- if docker_container_name == "gbsyncd" %}
637623
-v /var/run/docker-syncd$DEV:/var/run/sswsyncd \
@@ -702,7 +688,6 @@ fi
702688
{%- endif %}
703689
NAMESPACE_PREFIX="asic"
704690
DOCKERNAME=$DOCKERNAME$DEV
705-
CONTAINER_EXISTS="no"
706691
if [ "$DEV" ]; then
707692
NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace
708693

files/image_config/rsyslog/rsyslog-container.conf.j2

+1-20
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,8 @@ $ModLoad imuxsock # provides support for local system logging
1515
# Set a rate limit on messages from the container
1616
#
1717

18-
{% if SYSLOG_CONFIG_FEATURE is defined %}
19-
{% if container_name in SYSLOG_CONFIG_FEATURE %}
20-
{% if 'rate_limit_interval' in SYSLOG_CONFIG_FEATURE[container_name]%}
21-
{% set rate_limit_interval = SYSLOG_CONFIG_FEATURE[container_name]['rate_limit_interval'] %}
22-
{% endif %}
23-
{% if 'rate_limit_burst' in SYSLOG_CONFIG_FEATURE[container_name]%}
24-
{% set rate_limit_burst = SYSLOG_CONFIG_FEATURE[container_name]['rate_limit_burst'] %}
25-
{% endif %}
26-
{% endif %}
27-
{% endif %}
28-
29-
{% if rate_limit_interval is defined %}
30-
$SystemLogRateLimitInterval {{ rate_limit_interval }}
31-
{% else %}
3218
$SystemLogRateLimitInterval 300
33-
{% endif %}
34-
{% if rate_limit_burst is defined %}
35-
$SystemLogRateLimitBurst {{ rate_limit_burst }}
36-
{% else %}
3719
$SystemLogRateLimitBurst 20000
38-
{% endif %}
3920

4021
#$ModLoad imklog # provides kernel logging support
4122
#$ModLoad immark # provides --MARK-- message capability
@@ -104,4 +85,4 @@ $RepeatedMsgReduction on
10485

10586
###############
10687
#### RULES ####
107-
###############
88+
###############

rules/docker-config-engine-bullseye.mk

+2-3
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ $(DOCKER_CONFIG_ENGINE_BULLSEYE)_DEPENDS += $(LIBSWSSCOMMON) \
1111
$(SONIC_DB_CLI) \
1212
$(SONIC_EVENTD)
1313
$(DOCKER_CONFIG_ENGINE_BULLSEYE)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) \
14-
$(SONIC_YANG_MGMT_PY3) \
15-
$(SONIC_YANG_MODELS_PY3) \
16-
$(SONIC_CONTAINERCFGD)
14+
$(SONIC_YANG_MGMT_PY3) \
15+
$(SONIC_YANG_MODELS_PY3)
1716
$(DOCKER_CONFIG_ENGINE_BULLSEYE)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3)
1817
$(DOCKER_CONFIG_ENGINE_BULLSEYE)_LOAD_DOCKERS += $(DOCKER_BASE_BULLSEYE)
1918
$(DOCKER_CONFIG_ENGINE_BULLSEYE)_FILES += $(SWSS_VARS_TEMPLATE)

rules/docker-config-engine-buster.mk

+1-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ $(DOCKER_CONFIG_ENGINE_BUSTER)_DEPENDS += $(LIBSWSSCOMMON) \
1111
$(SONIC_DB_CLI)
1212
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_PY_COMMON_PY3) \
1313
$(SONIC_YANG_MGMT_PY3) \
14-
$(SONIC_YANG_MODELS_PY3) \
15-
$(SONIC_CONTAINERCFGD)
14+
$(SONIC_YANG_MODELS_PY3)
1615
$(DOCKER_CONFIG_ENGINE_BUSTER)_PYTHON_WHEELS += $(SONIC_CONFIG_ENGINE_PY3)
1716
$(DOCKER_CONFIG_ENGINE_BUSTER)_LOAD_DOCKERS += $(DOCKER_BASE_BUSTER)
1817
$(DOCKER_CONFIG_ENGINE_BUSTER)_FILES += $(SWSS_VARS_TEMPLATE)

rules/sonic-containercfgd.dep

-10
This file was deleted.

rules/sonic-containercfgd.mk

-8
This file was deleted.

src/sonic-containercfgd/.gitignore

-13
This file was deleted.

src/sonic-containercfgd/containercfgd/__init__.py

Whitespace-only changes.

0 commit comments

Comments
 (0)