Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions files/build_templates/init_cfg.json.j2
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
{%- set optional_feature_list = optional_features.split(' ') -%}
{%- set docker_containers_list = docker_containers.split(' ') -%}
{
"DEVICE_METADATA": {
"localhost": {
Expand All @@ -14,19 +16,18 @@
"{{crm_res}}_threshold_type": "percentage",
"{{crm_res}}_low_threshold": "70",
"{{crm_res}}_high_threshold": "85"{% if not loop.last %},{% endif -%}
{% endfor %}
{%- endfor %}
}
},
"FEATURE": {
{%- for feature in ["sflow", "telemetry"] %}
"{{feature}}": {
{%- for feature in optional_feature_list %}
"{{ feature }}": {
"status": "disabled"
}{% if not loop.last %},{% endif -%}
{% endfor %}
{%- endfor %}
},
"CONTAINER_FEATURE": {
{%- for container in ["bgp", "database", "dhcp_relay", "lldp", "pmon", "radv", "restapi", "sflow",
"snmp", "swss", "syncd", "teamd", "telemetry"] %}
{%- for container in docker_containers_list %}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It appears that Docker containers in the optional_feature_list will not get populated here in the CONTAINER_FEATURE table.

Also, please note that we are thinking of expanding the concept of a "FEATURE" to include any type of service, whether or not it spawns a container. This way all services can be enabled or disabled from the SONiC CLI. Thus, this logic would need to change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jleveque docker_containers_list is based on $($*_DOCKERS) which includes all optional and non optional docker containers.

Regarding second comment, I can rename SONIC_OPTIONAL_DOCKER_CONTAINERS to SONIC_OPTIONAL_SERVICES, so when you will need to add non-docker service you can append service name to that list and that will work for these services too.

"{{container}}": {
"auto_restart": "disabled",
"high_mem_alert": "disabled"
Expand Down
4 changes: 4 additions & 0 deletions rules/docker-sflow.mk
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SFLOW_DBG)
SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SFLOW_DBG)
endif

ifeq ($(ENABLE_SFLOW), y)
SONIC_OPTIONAL_DOCKER_CONTAINERS += $(DOCKER_SFLOW)
endif

$(DOCKER_SFLOW)_CONTAINER_NAME = sflow
$(DOCKER_SFLOW)_RUN_OPT += --privileged -t
$(DOCKER_SFLOW)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
Expand Down
4 changes: 4 additions & 0 deletions rules/docker-telemetry.mk
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,9 @@ $(DOCKER_TELEMETRY)_RUN_OPT += --privileged -t
$(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_TELEMETRY)_RUN_OPT += --mount type=bind,source="/var/platform/",target="/mnt/platform/"

ifeq ($(ENABLE_SYSTEM_TELEMETRY), y)
SONIC_OPTIONAL_DOCKER_CONTAINERS += $(DOCKER_TELEMETRY)
endif

$(DOCKER_TELEMETRY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
$(DOCKER_TELEMETRY)_BASE_IMAGE_FILES += monit_telemetry:/etc/monit/conf.d
4 changes: 3 additions & 1 deletion slave.mk
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,8 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
export platform_common_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(SONIC_PLATFORM_COMMON_PY2))"
export redis_dump_load_py2_wheel_path="$(addprefix $(PYTHON_WHEELS_PATH)/,$(REDIS_DUMP_LOAD_PY2))"
export install_debug_image="$(INSTALL_DEBUG_TOOLS)"
export optional_features="$(foreach docker,$(SONIC_OPTIONAL_DOCKER_CONTAINERS),$($(docker:-dbg.gz=.gz)_CONTAINER_NAME))"
export docker_containers="$(foreach docker,$($*_DOCKERS),$($(docker:-dbg.gz=.gz)_CONTAINER_NAME))"

$(foreach docker, $($*_DOCKERS),\
export docker_image="$(docker)"
Expand Down Expand Up @@ -706,7 +708,7 @@ $(addprefix $(TARGET_PATH)/, $(SONIC_INSTALLERS)) : $(TARGET_PATH)/% : \
)
)
export installer_services="$(SERVICES)"

export installer_extra_files="$(foreach docker, $($*_DOCKERS), $(foreach file, $($(docker:-dbg.gz=.gz)_BASE_IMAGE_FILES), $($(docker:-dbg.gz=.gz)_PATH)/base_image_files/$(file)))"

j2 -f env files/initramfs-tools/union-mount.j2 onie-image.conf > files/initramfs-tools/union-mount
Expand Down