From 8eb1b8f68095541a828212d8314211de9cab5bec Mon Sep 17 00:00:00 2001 From: mssonicbld <79238446+mssonicbld@users.noreply.github.com> Date: Fri, 13 Jan 2023 09:55:51 +0800 Subject: [PATCH] Add k8s support feature set and Add platform label for scheduler usage (#12997) (#13351) --- Makefile.work | 1 - build_debian.sh | 1 - rules/config | 3 +-- src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py | 6 ++++++ 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Makefile.work b/Makefile.work index 0045caa331..7466a88882 100644 --- a/Makefile.work +++ b/Makefile.work @@ -344,7 +344,6 @@ SONIC_BUILD_INSTRUCTION := make \ SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \ INCLUDE_KUBERNETES=$(INCLUDE_KUBERNETES) \ KUBERNETES_VERSION=$(KUBERNETES_VERSION) \ - KUBERNETES_CNI_VERSION=$(KUBERNETES_CNI_VERSION) \ K8s_GCR_IO_PAUSE_VERSION=$(K8s_GCR_IO_PAUSE_VERSION) \ INCLUDE_KUBERNETES_MASTER=$(INCLUDE_KUBERNETES_MASTER) \ SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \ diff --git a/build_debian.sh b/build_debian.sh index 0c06cadb48..1a76208145 100755 --- a/build_debian.sh +++ b/build_debian.sh @@ -270,7 +270,6 @@ then ## Install Kubernetes echo '[INFO] Install kubernetes' install_kubernetes ${KUBERNETES_VERSION} - sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubernetes-cni=${KUBERNETES_CNI_VERSION} else echo '[INFO] Skipping Install kubernetes' fi diff --git a/rules/config b/rules/config index 7fa297dd15..56c3946ba2 100644 --- a/rules/config +++ b/rules/config @@ -165,7 +165,7 @@ INCLUDE_MACSEC = y # INCLUDE_KUBERNETES - if set to y kubernetes packages are installed to be able to # run as worker node in kubernetes cluster. -INCLUDE_KUBERNETES = n +INCLUDE_KUBERNETES ?= n KUBE_DOCKER_PROXY = http://172.16.1.1:3128/ @@ -175,7 +175,6 @@ KUBE_DOCKER_PROXY = http://172.16.1.1:3128/ # NOTE: As a worker node it has to run version compatible to kubernetes master. # KUBERNETES_VERSION = 1.22.2-00 -KUBERNETES_CNI_VERSION = 0.8.7-00 K8s_GCR_IO_PAUSE_VERSION = 3.5 # INCLUDE_KUBERNETES_MASTER - if set to y kubernetes packages are installed o be able diff --git a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py index 277266025c..9017c1eb0e 100755 --- a/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py +++ b/src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py @@ -99,6 +99,8 @@ remote_ctr_config = { USE_K8S_PROXY: "" } +ENABLED_FEATURE_SET = {"telemetry", "snmp"} + def log_debug(m): msg = "{}: {}".format(inspect.stack()[1][3], m) syslog.syslog(syslog.LOG_DEBUG, msg) @@ -260,6 +262,8 @@ class MainServer: key, op, fvs = subscriber.pop() if not key: continue + if subscriber.getTableName() == FEATURE_TABLE and key not in ENABLED_FEATURE_SET: + continue log_debug("Received message : '%s'" % str((key, op, fvs))) for callback in (self.callbacks [subscriber.getDbConnector().getDbName()] @@ -280,6 +284,8 @@ def set_node_labels(server): labels["sonic_version"] = version_info['build_version'] labels["hwsku"] = device_info.get_hwsku() if not UNIT_TESTING else "mock" labels["deployment_type"] = dep_type + platform = device_info.get_platform() + labels["worker.sonic/platform"] = platform if platform is not None else "" server.mod_db_entry(STATE_DB_NAME, KUBE_LABEL_TABLE, KUBE_LABEL_SET_KEY, labels)