Add k8s support feature set and Add platform label for scheduler usage (#12997)

Why I did it
We plan to pilot k8s feature, need to fix several bugs including enable telemetry feature and add platform label.

How I did it
Add support feature set, only enable telemetry container upgrade for now
Add platform label for scheduler usage
Remove CNI installation code, it would be auto installed when install kubeadm
How to verify it
After sonic device join k8s cluster, show node labels to check if platform label is visible.

Signed-off-by: Yun Li yunli1@microsoft.com
This commit is contained in:
lixiaoyuner 2023-01-10 23:56:44 +08:00 committed by GitHub
parent ce88a38185
commit bc7b35473e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 4 deletions

View File

@ -485,7 +485,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) \

View File

@ -283,7 +283,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

View File

@ -175,7 +175,7 @@ INCLUDE_ROUTER_ADVERTISER ?= 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/
@ -185,7 +185,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

View File

@ -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)