-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add bmp container init workflow. #18946
Open
FengPan-Frank
wants to merge
16
commits into
sonic-net:master
Choose a base branch
from
FengPan-Frank:bmp_init
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
7a16e26
Add bmp container init workflow.
FengPan-Frank 75f40be
Add bmp container init workflow.
FengPan-Frank dcc5ce9
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank 0879370
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank 078a1f7
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank ef759dc
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank 862d2f4
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank 173c023
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank 9aed10e
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank a095920
Merge branch 'sonic-net:master' into bmp_init
FengPan-Frank 8d0a4ec
Merge branch 'master' into bmp_init
FengPan-Frank e4cfde1
integration change
FengPan-Frank 9b23a95
integration change
FengPan-Frank dff6708
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank 87d5eb3
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank c053190
Merge branch 'bmp_init' of https://github.com/FengPan-Frank/sonic-bui…
FengPan-Frank File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %} | ||
FROM docker-config-engine-bookworm-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}} | ||
|
||
ARG docker_container_name | ||
ARG image_version | ||
|
||
## Make apt-get non-interactive | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Pass the image_version to container | ||
ENV IMAGE_VERSION=$image_version | ||
|
||
RUN apt-get update | ||
|
||
|
||
RUN apt-get clean -y && \ | ||
apt-get autoclean - && \ | ||
apt-get autoremove -y && \ | ||
rm -rf /debs | ||
|
||
COPY ["bmp.sh", "bmpcfgd", "openbmpd", "/usr/bin/"] | ||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] | ||
COPY ["openbmpd.conf.j2", "/usr/share/sonic/templates/"] | ||
|
||
RUN chmod +x /usr/bin/bmp.sh | ||
RUN chmod +x /usr/bin/bmpcfgd | ||
RUN chmod +x /usr/bin/openbmpd | ||
|
||
RUN apt-get clean -y && \ | ||
apt-get autoclean -y && \ | ||
apt-get autoremove -y && \ | ||
rm -rf /debs | ||
|
||
ENTRYPOINT ["/usr/local/bin/supervisord"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
############################################################################### | ||
## Monit configuration for bmp container | ||
############################################################################### | ||
check program container_memory_bmp with path "/usr/bin/memory_checker bmp 419430400" | ||
if status == 3 for 10 times within 20 cycles then exec "/usr/bin/docker exec bmp supervisorctl restart openbmpd" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
DOCKER_EXEC_FLAGS="i" | ||
|
||
# Determine whether stdout is on a terminal | ||
if [ -t 1 ] ; then | ||
DOCKER_EXEC_FLAGS+="t" | ||
fi | ||
|
||
docker exec -$DOCKER_EXEC_FLAGS bmp redis-cli "$@" | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bash | ||
|
||
|
||
if [ "${RUNTIME_OWNER}" == "" ]; then | ||
RUNTIME_OWNER="kube" | ||
fi | ||
|
||
CTR_SCRIPT="/usr/share/sonic/scripts/container_startup.py" | ||
if test -f ${CTR_SCRIPT} | ||
then | ||
${CTR_SCRIPT} -f bmp -o ${RUNTIME_OWNER} -v ${IMAGE_VERSION} | ||
fi | ||
|
||
mkdir -p /etc/bmp | ||
|
||
is_multi_asic=$(python3 -c "from sonic_py_common.multi_asic import is_multi_asic; print(is_multi_asic())") | ||
|
||
if [[ $is_multi_asic == "True" ]]; then | ||
export multiASIC=true | ||
else | ||
export multiASIC=false | ||
fi | ||
|
||
ENABLE_MULTI_ASIC=$multiASIC j2 /usr/share/sonic/templates/openbmpd.conf.j2 > /etc/bmp/openbmpd.conf | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
group:sonic-bmp | ||
program:openbmpd | ||
program:bmpcfgd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
base: | ||
admin_id: hostname | ||
listen_port: 5000 | ||
listen_mode: v4 | ||
buffers: | ||
router: 15 | ||
heartbeat: | ||
interval: 5 | ||
startup: | ||
max_concurrent_routers: 2 | ||
initial_router_time: 60 | ||
calculate_baseline: true | ||
pat_enabled: false | ||
debug: | ||
general: false | ||
bmp: false | ||
bgp: false | ||
msgbus: false | ||
redis: | ||
multiAsic: {{ENABLE_MULTI_ASIC}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
[supervisord] | ||
logfile_maxbytes=1MB | ||
logfile_backups=2 | ||
nodaemon=true | ||
|
||
[eventlistener:dependent-startup] | ||
command=python3 -m supervisord_dependent_startup | ||
autostart=true | ||
autorestart=unexpected | ||
startretries=0 | ||
exitcodes=0,3 | ||
events=PROCESS_STATE | ||
buffer_size=1024 | ||
|
||
[eventlistener:supervisor-proc-exit-listener] | ||
command=/usr/bin/supervisor-proc-exit-listener --container-name bmp | ||
events=PROCESS_STATE_EXITED,PROCESS_STATE_RUNNING | ||
autostart=true | ||
autorestart=false | ||
buffer_size=1024 | ||
|
||
[program:rsyslogd] | ||
command=/usr/sbin/rsyslogd -n -iNONE | ||
priority=1 | ||
autostart=false | ||
autorestart=true | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
|
||
[program:bmp] | ||
command=/usr/bin/bmp.sh | ||
priority=2 | ||
autostart=false | ||
autorestart=false | ||
startsecs=0 | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=rsyslogd:running | ||
|
||
[group:sonic-bmp] | ||
programs=openbmpd,bmpcfgd | ||
|
||
[program:bmpcfgd] | ||
command=/usr/bin/bmpcfgd | ||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=bmp:exited | ||
|
||
[program:openbmpd] | ||
command=/usr/bin/openbmpd -c /etc/bmp/openbmpd.conf | ||
priority=3 | ||
autostart=false | ||
autorestart=false | ||
stdout_logfile=syslog | ||
stderr_logfile=syslog | ||
dependent_startup=true | ||
dependent_startup_wait_for=bmpcfgd:running |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
DPATH := $($(DOCKER_BMP)_PATH) | ||
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-bmp.mk rules/docker-bmp.dep | ||
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST) | ||
DEP_FILES += $(shell git ls-files $(DPATH)) | ||
|
||
$(DOCKER_BMP)_CACHE_MODE := GIT_CONTENT_SHA | ||
$(DOCKER_BMP)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST) | ||
$(DOCKER_BMP)_DEP_FILES := $(DEP_FILES) | ||
|
||
$(eval $(call add_dbg_docker,$(DOCKER_BMP),$(DOCKER_BMP_DBG))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# docker image for BMP agent | ||
|
||
DOCKER_BMP_STEM = docker-sonic-bmp | ||
DOCKER_BMP = $(DOCKER_BMP_STEM).gz | ||
DOCKER_BMP_DBG = $(DOCKER_BMP_STEM)-$(DBG_IMAGE_MARK).gz | ||
|
||
$(DOCKER_BMP)_PATH = $(DOCKERS_PATH)/$(DOCKER_BMP_STEM) | ||
|
||
$(DOCKER_BMP)_DEPENDS += $(LIBSWSSCOMMON) \ | ||
$(SONIC_DB_CLI) | ||
|
||
$(DOCKER_BMP)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_DEPENDS) | ||
|
||
$(DOCKER_BMP)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BOOKWORM) | ||
|
||
$(DOCKER_BMP)_VERSION = 1.0.0 | ||
$(DOCKER_BMP)_PACKAGE_NAME = bmp | ||
|
||
$(DOCKER_BMP)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BOOKWORM)_DBG_IMAGE_PACKAGES) | ||
|
||
SONIC_DOCKER_IMAGES += $(DOCKER_BMP) | ||
SONIC_BOOKWORM_DOCKERS += $(DOCKER_BMP) | ||
ifeq ($(INCLUDE_SYSTEM_BMP), y) | ||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_BMP) | ||
endif | ||
|
||
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_BMP_DBG) | ||
SONIC_BOOKWORM_DBG_DOCKERS += $(DOCKER_BMP_DBG) | ||
ifeq ($(INCLUDE_SYSTEM_BMP), y) | ||
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_BMP_DBG) | ||
endif | ||
|
||
$(DOCKER_BMP)_CONTAINER_NAME = bmp | ||
$(DOCKER_BMP)_RUN_OPT += -t | ||
$(DOCKER_BMP)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro | ||
$(DOCKER_BMP)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro | ||
$(DOCKER_BMP)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw | ||
|
||
$(DOCKER_BMP)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT) | ||
$(DOCKER_BMP)_BASE_IMAGE_FILES += redis-cli:/usr/bin/redis-cli:monit_bmp:/etc/monit/conf.d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you use this file?