Disable eventd and rsyslog plugin in slim images (#17905)
### Why I did it Disable eventd at buildtime for slim images ##### Work item tracking - Microsoft ADO **(number only)**:26386286 #### How I did it Add flags for disabling eventd and only copy rsyslog conf files when eventd is included and not slim image #### How to verify it Manual testing
This commit is contained in:
parent
865042ed23
commit
c8439cdd4b
@ -556,6 +556,7 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
|
||||
SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD=$(SONIC_CONFIG_USE_NATIVE_DOCKERD_FOR_BUILD) \
|
||||
SONIC_INCLUDE_SYSTEM_TELEMETRY=$(INCLUDE_SYSTEM_TELEMETRY) \
|
||||
SONIC_INCLUDE_SYSTEM_GNMI=$(INCLUDE_SYSTEM_GNMI) \
|
||||
SONIC_INCLUDE_SYSTEM_EVENTD=$(INCLUDE_SYSTEM_EVENTD) \
|
||||
INCLUDE_DHCP_RELAY=$(INCLUDE_DHCP_RELAY) \
|
||||
INCLUDE_DHCP_SERVER=$(INCLUDE_DHCP_SERVER) \
|
||||
INCLUDE_MACSEC=$(INCLUDE_MACSEC) \
|
||||
|
@ -51,13 +51,17 @@ COPY ["dhcp-relay.programs.j2", "dhcpv4-relay.agents.j2", "dhcpv6-relay.agents.j
|
||||
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
||||
COPY ["critical_processes", "/etc/supervisor"]
|
||||
COPY ["cli", "/cli/"]
|
||||
|
||||
{% if include_system_eventd == "y" %}
|
||||
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
|
||||
# Copy regex json and rsyslog_plugin.conf file into rsyslog.d
|
||||
COPY ["*.json", "/etc/rsyslog.d/"]
|
||||
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
|
||||
|
||||
# Create dhcp_relay_regex.conf
|
||||
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/dhcp_relay_events.conf
|
||||
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
|
||||
RUN rm -f /etc/rsyslog.d/events_info.json
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
ENTRYPOINT ["/usr/bin/docker_init.sh"]
|
||||
|
@ -54,15 +54,19 @@ COPY ["TSC", "/usr/bin/TSC"]
|
||||
COPY ["TS", "/usr/bin/TS"]
|
||||
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
||||
COPY ["zsocket.sh", "/usr/bin/"]
|
||||
COPY ["*.json", "/etc/rsyslog.d/"]
|
||||
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
|
||||
RUN chmod a+x /usr/bin/TSA && \
|
||||
chmod a+x /usr/bin/TSB && \
|
||||
chmod a+x /usr/bin/TSC && \
|
||||
chmod a+x /usr/bin/zsocket.sh
|
||||
|
||||
{% if include_system_eventd == "y" %}
|
||||
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
|
||||
COPY ["*.json", "/etc/rsyslog.d/"]
|
||||
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
|
||||
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/bgp_events.conf
|
||||
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
|
||||
RUN rm -f /etc/rsyslog.d/events_info.json
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
ENTRYPOINT ["/usr/bin/docker_init.sh"]
|
||||
|
@ -75,17 +75,20 @@ COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
|
||||
# Copy all Jinja2 template files into the templates folder
|
||||
COPY ["*.j2", "/usr/share/sonic/templates/"]
|
||||
|
||||
# Copy all regex json files and rsyslog_plugin.conf to rsyslog.d
|
||||
COPY ["*.json", "/etc/rsyslog.d/"]
|
||||
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
|
||||
|
||||
RUN sonic-cfggen -a "{\"ENABLE_ASAN\":\"{{ENABLE_ASAN}}\"}" -t /usr/share/sonic/templates/docker-init.j2 > /usr/bin/docker-init.sh
|
||||
RUN rm -f /usr/share/sonic/templates/docker-init.j2
|
||||
RUN chmod 755 /usr/bin/docker-init.sh
|
||||
|
||||
{% if include_system_eventd == "y" %}
|
||||
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
|
||||
# Copy all regex json files and rsyslog_plugin.conf to rsyslog.d
|
||||
COPY ["*.json", "/etc/rsyslog.d/"]
|
||||
COPY ["files/rsyslog_plugin.conf.j2", "/etc/rsyslog.d/"]
|
||||
# Create swss rsyslog_plugin conf file
|
||||
RUN j2 -f json /etc/rsyslog.d/rsyslog_plugin.conf.j2 /etc/rsyslog.d/events_info.json > /etc/rsyslog.d/swss_events.conf
|
||||
RUN rm -f /etc/rsyslog.d/rsyslog_plugin.conf.j2
|
||||
RUN rm -f /etc/rsyslog.d/events_info.json
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
ENTRYPOINT ["/usr/bin/docker-init.sh"]
|
||||
|
@ -38,7 +38,6 @@
|
||||
("lldp", "enabled", true, "enabled"),
|
||||
("pmon", "enabled", true, "enabled"),
|
||||
("snmp", "enabled", true, "enabled"),
|
||||
("eventd", "enabled", false, "enabled"),
|
||||
("swss", "enabled", false, "enabled"),
|
||||
("syncd", "enabled", false, "enabled")] %}
|
||||
{%- if include_router_advertiser == "y" %}{% do features.append(("radv", "enabled", false, "enabled")) %}{% endif %}
|
||||
@ -60,6 +59,11 @@
|
||||
{%- if include_macsec == "y" %}{% do features.append(("macsec", "{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] == 'SpineRouter' and DEVICE_RUNTIME_METADATA['MACSEC_SUPPORTED'] %}enabled{% else %}disabled{% endif %}", false, "enabled")) %}{% endif %}
|
||||
{%- if include_system_gnmi == "y" %}{% do features.append(("gnmi", "enabled", true, "enabled")) %}{% endif %}
|
||||
{%- if include_system_telemetry == "y" %}{% do features.append(("telemetry", "enabled", true, "enabled")) %}{% endif %}
|
||||
{%- if include_system_eventd == "y" and BUILD_REDUCE_IMAGE_SIZE == "y" and sonic_asic_platform == "broadcom" %}
|
||||
{% do features.append(("eventd","disabled", false, "enabled")) %}
|
||||
{%- elif include_system_eventd == "y" %}
|
||||
{% do features.append(("eventd", "enabled", false, "enabled")) %}
|
||||
{%- endif %}
|
||||
"FEATURE": {
|
||||
{# delayed field if set, will start the feature systemd .timer unit instead of .service unit #}
|
||||
{%- for feature, state, delayed, autorestart in features %}
|
||||
|
@ -324,6 +324,9 @@ sudo dpkg --root=$FILESYSTEM_ROOT -i {{deb}} || sudo LANG=C DEBIAN_FRONTEND=noni
|
||||
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-db-cli_*.deb || \
|
||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
||||
|
||||
|
||||
{% if include_system_eventd == "y" %}
|
||||
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
|
||||
# Install sonic-rsyslog-plugin
|
||||
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/sonic-rsyslog-plugin_*.deb || \
|
||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
||||
@ -343,6 +346,9 @@ sudo cp $BUILD_TEMPLATES/bgpd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/
|
||||
j2 -f json $BUILD_TEMPLATES/rsyslog_plugin.conf.j2 $BUILD_TEMPLATES/syncd_events_info.json | sudo tee $FILESYSTEM_ROOT_ETC/rsyslog.d/syncd_events.conf
|
||||
sudo cp $BUILD_TEMPLATES/syncd_regex.json $FILESYSTEM_ROOT_ETC/rsyslog.d/
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
# Install custom-built monit package and SONiC configuration files
|
||||
sudo dpkg --root=$FILESYSTEM_ROOT -i $debs_path/monit_*.deb || \
|
||||
sudo LANG=C DEBIAN_FRONTEND=noninteractive chroot $FILESYSTEM_ROOT apt-get -y install -f
|
||||
@ -404,7 +410,8 @@ sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.service $FILESYSTEM_ROOT_USR_LIB_S
|
||||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-config.sh $FILESYSTEM_ROOT/usr/bin/
|
||||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
||||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog-container.conf.j2 $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
|
||||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/* $FILESYSTEM_ROOT/etc/rsyslog.d/
|
||||
j2 $IMAGE_CONFIGS/rsyslog/rsyslog.d/00-sonic.conf.j2 | sudo tee $FILESYSTEM_ROOT/etc/rsyslog.d/00-sonic.conf
|
||||
sudo cp $IMAGE_CONFIGS/rsyslog/rsyslog.d/*.conf $FILESYSTEM_ROOT/etc/rsyslog.d/
|
||||
echo "rsyslog-config.service" | sudo tee -a $GENERATED_SERVICE_FILE
|
||||
|
||||
# Copy containercfgd configuration files
|
||||
|
@ -5,6 +5,9 @@ template(name="prog_msg" type="list") {
|
||||
constant(value="\n")
|
||||
}
|
||||
|
||||
{% if include_system_eventd == "y" %}
|
||||
{% if build_reduce_image_size != "y" or sonic_asic_platform != "broadcom" %}
|
||||
|
||||
$ModLoad omprog
|
||||
|
||||
if re_match($programname, "bgp[0-9]*#(frr|zebra|staticd|watchfrr)") then {
|
||||
@ -25,6 +28,9 @@ if re_match($programname, "bgp[0-9]*#bgpd") then {
|
||||
stop
|
||||
}
|
||||
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
## Teamd rules
|
||||
|
||||
if $programname contains "teamd_" then {
|
@ -127,6 +127,9 @@ DEFAULT_VS_PREPARE_MEM = yes
|
||||
# INCLUDE_SYSTEM_GNMI - build docker-sonic-gnmi for system gnmi support
|
||||
INCLUDE_SYSTEM_GNMI = y
|
||||
|
||||
# INCLUDE_SYSTEM_EVENTD - build docker-eventd for system eventd support
|
||||
INCLUDE_SYSTEM_EVENTD = y
|
||||
|
||||
# INCLUDE_SYSTEM_TELEMETRY - build docker-sonic-telemetry for system telemetry support
|
||||
INCLUDE_SYSTEM_TELEMETRY = n
|
||||
|
||||
|
@ -25,10 +25,14 @@ $(DOCKER_DHCP)_SERVICE_REQUIRES = updategraph
|
||||
$(DOCKER_DHCP)_SERVICE_AFTER = database
|
||||
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_EVENTD)
|
||||
ifeq ($(INCLUDE_SYSTEM_EVENTD), y)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_EVENTD)
|
||||
endif
|
||||
|
||||
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG)
|
||||
ifeq ($(INCLUDE_SYSTEM_EVENTD), y)
|
||||
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_EVENTD_DBG)
|
||||
endif
|
||||
|
||||
$(DOCKER_EVENTD)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
|
||||
$(DOCKER_EVENTD)_CONTAINER_NAME = eventd
|
||||
|
9
slave.mk
9
slave.mk
@ -165,6 +165,10 @@ ifeq ($(SONIC_INCLUDE_SYSTEM_GNMI),y)
|
||||
INCLUDE_SYSTEM_GNMI = y
|
||||
endif
|
||||
|
||||
ifeq ($(SONIC_INCLUDE_SYSTEM_EVENTD),y)
|
||||
INCLUDE_SYSTEM_EVENTD = y
|
||||
endif
|
||||
|
||||
ifeq ($(SONIC_INCLUDE_RESTAPI),y)
|
||||
INCLUDE_RESTAPI = y
|
||||
endif
|
||||
@ -423,6 +427,7 @@ $(info "INCLUDE_MGMT_FRAMEWORK" : "$(INCLUDE_MGMT_FRAMEWORK)")
|
||||
$(info "INCLUDE_ICCPD" : "$(INCLUDE_ICCPD)")
|
||||
$(info "INCLUDE_SYSTEM_TELEMETRY" : "$(INCLUDE_SYSTEM_TELEMETRY)")
|
||||
$(info "INCLUDE_SYSTEM_GNMI" : "$(INCLUDE_SYSTEM_GNMI)")
|
||||
$(info "INCLUDE_SYSTEM_EVENTD" : "$(INCLUDE_SYSTEM_EVENTD)")
|
||||
$(info "ENABLE_HOST_SERVICE_ON_START" : "$(ENABLE_HOST_SERVICE_ON_START)")
|
||||
$(info "INCLUDE_RESTAPI" : "$(INCLUDE_RESTAPI)")
|
||||
$(info "INCLUDE_SFLOW" : "$(INCLUDE_SFLOW)")
|
||||
@ -1129,6 +1134,8 @@ $(addprefix $(TARGET_PATH)/, $(DOCKER_IMAGES)) : $(TARGET_PATH)/%.gz : .platform
|
||||
sudo mount --bind $(PYTHON_DEBS_PATH) $($*.gz_PATH)/python-debs $(LOG)
|
||||
sudo mount --bind $(PYTHON_WHEELS_PATH) $($*.gz_PATH)/python-wheels $(LOG)
|
||||
# Export variables for j2. Use path for unique variable names, e.g. docker_orchagent_debs
|
||||
export include_system_eventd="$(INCLUDE_SYSTEM_EVENTD)"
|
||||
export build_reduce_image_size="$(BUILD_REDUCE_IMAGE_SIZE)"
|
||||
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_debs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_DEPENDS),RDEPENDS))\n" | awk '!a[$$0]++'))
|
||||
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_pydebs=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_DEBS)))\n" | awk '!a[$$0]++'))
|
||||
$(eval export $(subst -,_,$(notdir $($*.gz_PATH)))_whls=$(shell printf "$(subst $(SPACE),\n,$(call expand,$($*.gz_PYTHON_WHEELS)))\n" | awk '!a[$$0]++'))
|
||||
@ -1413,6 +1420,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
|
||||
export sonic_su_prod_signing_tool="/sonic/scripts/$(shell basename -- $(SECURE_UPGRADE_PROD_SIGNING_TOOL))"
|
||||
export include_system_telemetry="$(INCLUDE_SYSTEM_TELEMETRY)"
|
||||
export include_system_gnmi="$(INCLUDE_SYSTEM_GNMI)"
|
||||
export include_system_eventd="$(INCLUDE_SYSTEM_EVENTD)"
|
||||
export build_reduce_image_size="$(BUILD_REDUCE_IMAGE_SIZE)"
|
||||
export include_restapi="$(INCLUDE_RESTAPI)"
|
||||
export include_nat="$(INCLUDE_NAT)"
|
||||
export include_p4rt="$(INCLUDE_P4RT)"
|
||||
|
Loading…
Reference in New Issue
Block a user