Skip to content

Commit e0c2e16

Browse files
lixiaoyunermssonicbld
authored andcommitted
Add k8s support feature set and Add platform label for scheduler usage (sonic-net#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
1 parent ab54549 commit e0c2e16

File tree

4 files changed

+7
-4
lines changed

4 files changed

+7
-4
lines changed

Makefile.work

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,6 @@ SONIC_BUILD_INSTRUCTION := $(MAKE) \
454454
SHUTDOWN_BGP_ON_START=$(SHUTDOWN_BGP_ON_START) \
455455
INCLUDE_KUBERNETES=$(INCLUDE_KUBERNETES) \
456456
KUBERNETES_VERSION=$(KUBERNETES_VERSION) \
457-
KUBERNETES_CNI_VERSION=$(KUBERNETES_CNI_VERSION) \
458457
K8s_GCR_IO_PAUSE_VERSION=$(K8s_GCR_IO_PAUSE_VERSION) \
459458
INCLUDE_KUBERNETES_MASTER=$(INCLUDE_KUBERNETES_MASTER) \
460459
SONIC_ENABLE_PFCWD_ON_START=$(ENABLE_PFCWD_ON_START) \

build_debian.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,6 @@ then
272272
## Install Kubernetes
273273
echo '[INFO] Install kubernetes'
274274
install_kubernetes ${KUBERNETES_VERSION}
275-
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubernetes-cni=${KUBERNETES_CNI_VERSION}
276275
else
277276
echo '[INFO] Skipping Install kubernetes'
278277
fi

rules/config

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ INCLUDE_MACSEC = y
169169

170170
# INCLUDE_KUBERNETES - if set to y kubernetes packages are installed to be able to
171171
# run as worker node in kubernetes cluster.
172-
INCLUDE_KUBERNETES = n
172+
INCLUDE_KUBERNETES ?= n
173173

174174
KUBE_DOCKER_PROXY = http://172.16.1.1:3128/
175175

@@ -179,7 +179,6 @@ KUBE_DOCKER_PROXY = http://172.16.1.1:3128/
179179
# NOTE: As a worker node it has to run version compatible to kubernetes master.
180180
#
181181
KUBERNETES_VERSION = 1.22.2-00
182-
KUBERNETES_CNI_VERSION = 0.8.7-00
183182
K8s_GCR_IO_PAUSE_VERSION = 3.5
184183

185184
# INCLUDE_KUBERNETES_MASTER - if set to y kubernetes packages are installed o be able

src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@
9999
USE_K8S_PROXY: ""
100100
}
101101

102+
ENABLED_FEATURE_SET = {"telemetry", "snmp"}
103+
102104
def log_debug(m):
103105
msg = "{}: {}".format(inspect.stack()[1][3], m)
104106
syslog.syslog(syslog.LOG_DEBUG, msg)
@@ -260,6 +262,8 @@ def run(self):
260262
key, op, fvs = subscriber.pop()
261263
if not key:
262264
continue
265+
if subscriber.getTableName() == FEATURE_TABLE and key not in ENABLED_FEATURE_SET:
266+
continue
263267
log_debug("Received message : '%s'" % str((key, op, fvs)))
264268
for callback in (self.callbacks
265269
[subscriber.getDbConnector().getDbName()]
@@ -280,6 +284,8 @@ def set_node_labels(server):
280284
labels["sonic_version"] = version_info['build_version']
281285
labels["hwsku"] = device_info.get_hwsku() if not UNIT_TESTING else "mock"
282286
labels["deployment_type"] = dep_type
287+
platform = device_info.get_platform()
288+
labels["worker.sonic/platform"] = platform if platform is not None else ""
283289
server.mod_db_entry(STATE_DB_NAME,
284290
KUBE_LABEL_TABLE, KUBE_LABEL_SET_KEY, labels)
285291

0 commit comments

Comments
 (0)