Skip to content
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 base gnmi docker image #17292

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
30 changes: 30 additions & 0 deletions dockers/docker-base-gnmi/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{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

{% if docker_base_gnmi_debs.strip() -%}
# Copy locally-built Debian package dependencies
{{ copy_files("debs/", docker_base_gnmi_debs.split(' '), "/debs/") }}

# Install locally-built Debian packages and implicitly install their dependencies
{{ install_debian_packages(docker_base_gnmi_debs.split(' ')) }}
{%- endif %}

RUN apt-get clean -y && \
apt-get autoclean - && \
apt-get autoremove -y && \
rm -rf /debs

COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]

ENTRYPOINT ["/usr/local/bin/supervisord"]
3 changes: 1 addition & 2 deletions dockers/docker-sonic-gnmi/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-config-engine-bullseye-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
FROM docker-base-gnmi-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

ARG docker_container_name
ARG image_version
Expand Down Expand Up @@ -28,7 +28,6 @@ RUN apt-get clean -y && \
COPY ["start.sh", "gnmi-native.sh", "dialout.sh", "/usr/bin/"]
COPY ["telemetry_vars.j2", "/usr/share/sonic/templates/"]
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
COPY ["files/supervisor-proc-exit-listener", "/usr/bin"]
COPY ["critical_processes", "/etc/supervisor"]

ENTRYPOINT ["/usr/local/bin/supervisord"]
2 changes: 1 addition & 1 deletion dockers/docker-sonic-telemetry/Dockerfile.j2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
FROM docker-sonic-gnmi-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}
FROM docker-base-gnmi-{{DOCKER_USERNAME}}:{{DOCKER_USERTAG}}

ARG docker_container_name
ARG image_version
Expand Down
11 changes: 11 additions & 0 deletions rules/docker-base-gnmi.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

DPATH := $($(DOCKER_BASE_GNMI)_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/docker-base-gnmi.mk rules/docker-base-gnmi.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
DEP_FILES += $(shell git ls-files $(DPATH))

$(DOCKER_BASE_GNMI)_CACHE_MODE := GIT_CONTENT_SHA
$(DOCKER_BASE_GNMI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(DOCKER_BASE_GNMI)_DEP_FILES := $(DEP_FILES)

$(eval $(call add_dbg_docker,$(DOCKER_BASE_GNMI),$(DOCKER_BASE_GNMI_DBG)))
22 changes: 22 additions & 0 deletions rules/docker-base-gnmi.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# docker image for GNMI base

DOCKER_BASE_GNMI_STEM = docker-base-gnmi
DOCKER_BASE_GNMI = $(DOCKER_BASE_GNMI_STEM).gz
DOCKER_BASE_GNMI_DBG = $(DOCKER_BASE_GNMI_STEM)-$(DBG_IMAGE_MARK).gz

$(DOCKER_BASE_GNMI)_PATH = $(DOCKERS_PATH)/$(DOCKER_BASE_GNMI_STEM)

$(DOCKER_BASE_GNMI)_DEPENDS += $(SONIC_MGMT_COMMON)
$(DOCKER_BASE_GNMI)_DEPENDS += $(SONIC_GNMI)
$(DOCKER_BASE_GNMI)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS)

$(DOCKER_BASE_GNMI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE)

$(DOCKER_BASE_GNMI)_VERSION = 1.0.0
$(DOCKER_BASE_GNMI)_PACKAGE_NAME = base-gnmi

$(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES)

SONIC_DOCKER_IMAGES += $(DOCKER_BASE_GNMI)
SONIC_BULLSEYE_DOCKERS += $(DOCKER_BASE_GNMI)

8 changes: 3 additions & 5 deletions rules/docker-gnmi.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ DOCKER_GNMI_DBG = $(DOCKER_GNMI_STEM)-$(DBG_IMAGE_MARK).gz

$(DOCKER_GNMI)_PATH = $(DOCKERS_PATH)/$(DOCKER_GNMI_STEM)

$(DOCKER_GNMI)_DEPENDS += $(SONIC_MGMT_COMMON)
$(DOCKER_GNMI)_DEPENDS += $(SONIC_TELEMETRY)
$(DOCKER_GNMI)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_DEPENDS)
$(DOCKER_GNMI)_DBG_DEPENDS = $($(DOCKER_BASE_GNMI)_DBG_DEPENDS)

$(DOCKER_GNMI)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_BULLSEYE)
$(DOCKER_GNMI)_LOAD_DOCKERS += $(DOCKER_BASE_GNMI)

$(DOCKER_GNMI)_VERSION = 1.0.0
$(DOCKER_GNMI)_PACKAGE_NAME = gnmi

$(DOCKER_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_BULLSEYE)_DBG_IMAGE_PACKAGES)
$(DOCKER_GNMI)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES)

SONIC_DOCKER_IMAGES += $(DOCKER_GNMI)
SONIC_BULLSEYE_DOCKERS += $(DOCKER_GNMI)
Expand Down
9 changes: 6 additions & 3 deletions rules/docker-telemetry.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ DOCKER_TELEMETRY_DBG = $(DOCKER_TELEMETRY_STEM)-$(DBG_IMAGE_MARK).gz

$(DOCKER_TELEMETRY)_PATH = $(DOCKERS_PATH)/$(DOCKER_TELEMETRY_STEM)

$(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_GNMI)_DBG_DEPENDS)
$(DOCKER_TELEMETRY)_DBG_DEPENDS = $($(DOCKER_BASE_GNMI)_DBG_DEPENDS)

$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_GNMI)
$(DOCKER_TELEMETRY)_LOAD_DOCKERS += $(DOCKER_BASE_GNMI)

$(DOCKER_TELEMETRY)_VERSION = 1.0.0
$(DOCKER_TELEMETRY)_PACKAGE_NAME = telemetry

$(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_GNMI)_DBG_IMAGE_PACKAGES)
$(DOCKER_TELEMETRY)_DBG_IMAGE_PACKAGES = $($(DOCKER_BASE_GNMI)_DBG_IMAGE_PACKAGES)

SONIC_DOCKER_IMAGES += $(DOCKER_TELEMETRY)
SONIC_BULLSEYE_DOCKERS += $(DOCKER_TELEMETRY)
Expand All @@ -31,6 +31,9 @@ $(DOCKER_TELEMETRY)_CONTAINER_NAME = telemetry
$(DOCKER_TELEMETRY)_RUN_OPT += -t
$(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
$(DOCKER_TELEMETRY)_RUN_OPT += -v /etc/timezone:/etc/timezone:ro
ifneq ($(INCLUDE_SYSTEM_GNMI), y)
$(DOCKER_TELEMETRY)_RUN_OPT += -v /var/run/dbus:/var/run/dbus:rw
endif
Copy link
Collaborator

Choose a reason for hiding this comment

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

why is this needed?

Copy link
Collaborator

Choose a reason for hiding this comment

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

this is telemetry

Copy link
Contributor Author

@ganglyu ganglyu Nov 29, 2023

Choose a reason for hiding this comment

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

When we disable GNMI and enable TELEMETRY like 202305 branch, telemetry needs to access dbus to support GNMI native feature.

Copy link
Collaborator

@qiluo-msft qiluo-msft Nov 30, 2023

Choose a reason for hiding this comment

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

I am not sure your goal on 202305 public repo. Is it single telemetry container or single gnmi container.

The same question is applicable to all the branch on public repos.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have reverted all the changes on 202305 public repo, and I will only change master public repo.
For master public repo, it's single gnmi container.


$(DOCKER_TELEMETRY)_FILES += $(SUPERVISOR_PROC_EXIT_LISTENER_SCRIPT)
$(DOCKER_TELEMETRY)_BASE_IMAGE_FILES += monit_telemetry:/etc/monit/conf.d
13 changes: 13 additions & 0 deletions rules/gnmi.dep
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#DPKG FRK
SPATH := $($(SONIC_GNMI)_SRC_PATH)
DEP_FILES := $(SONIC_COMMON_FILES_LIST) rules/gnmi.mk rules/gnmi.dep
DEP_FILES += $(SONIC_COMMON_BASE_FILES_LIST)
SMDEP_FILES := $(addprefix $(SPATH)/,$(shell cd $(SPATH) && git ls-files))


$(SONIC_GNMI)_CACHE_MODE := GIT_CONTENT_SHA
$(SONIC_GNMI)_DEP_FLAGS := $(SONIC_COMMON_FLAGS_LIST)
$(SONIC_GNMI)_DEP_FILES := $(DEP_FILES)
$(SONIC_GNMI)_SMDEP_FILES := $(SMDEP_FILES)
$(SONIC_GNMI)_SMDEP_PATHS := $(SPATH)

8 changes: 8 additions & 0 deletions rules/gnmi.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# SONiC telemetry package

SONIC_GNMI = sonic-gnmi_0.1_$(CONFIGURED_ARCH).deb
$(SONIC_GNMI)_SRC_PATH = $(SRC_PATH)/sonic-gnmi
$(SONIC_GNMI)_DEPENDS = $(SONIC_MGMT_COMMON) $(SONIC_MGMT_COMMON_CODEGEN) \
$(LIBSWSSCOMMON_DEV) $(LIBSWSSCOMMON)
$(SONIC_GNMI)_RDEPENDS = $(LIBSWSSCOMMON)
SONIC_DPKG_DEBS += $(SONIC_GNMI)
13 changes: 0 additions & 13 deletions rules/telemetry.dep

This file was deleted.

8 changes: 0 additions & 8 deletions rules/telemetry.mk

This file was deleted.