Skip to content

Commit 7236fa9

Browse files
authored
Revert "[Kubernetes]: The kube server could be used as http-proxy for docker (sonic-net#7469)" (sonic-net#8023)
This change causes nightly test to fail due to the fake proxy IP is not reachable. Reverts sonic-net#7469 This reverts commit f7ed82f.
1 parent 0135ba2 commit 7236fa9

11 files changed

+11
-371
lines changed

build_debian.sh

+1
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ then
237237
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubelet=${KUBERNETES_VERSION}-00
238238
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubectl=${KUBERNETES_VERSION}-00
239239
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubeadm=${KUBERNETES_VERSION}-00
240+
# kubeadm package auto install kubelet & kubectl
240241
else
241242
echo '[INFO] Skipping Install kubernetes'
242243
fi

files/build_templates/sonic_debian_extension.j2

-23
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,6 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install azure-
448448
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install watchdog==0.10.3
449449

450450
{% if include_kubernetes == "y" %}
451-
# Point to kubelet to /etc/resolv.conf
452-
#
453-
echo 'KUBELET_EXTRA_ARGS="--resolv-conf=/etc/resolv.conf"' | sudo tee -a $FILESYSTEM_ROOT/etc/default/kubelet
454-
455451
# Copy Flannel conf file into sonic-templates
456452
#
457453
sudo cp $BUILD_TEMPLATES/kube_cni.10-flannel.conflist $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
@@ -472,25 +468,6 @@ sudo cp ${files_path}/container_startup.py ${FILESYSTEM_ROOT_USR_SHARE_SONIC_SCR
472468
sudo chmod a+x ${FILESYSTEM_ROOT_USR_SHARE_SONIC_SCRIPTS}/container_startup.py
473469

474470
# Config file used by container mgmt scripts/service
475-
fl="${files_path}/remote_ctr.config.json"
476-
use_k8s_as_http_proxy=$(python3 -c 'import json
477-
with open("'${fl}'", "r") as s:
478-
d=json.load(s);print(d.get("use_k8s_as_http_proxy", ""))
479-
')
480-
if [ "${use_k8s_as_http_proxy}" == "y" ]; then
481-
# create proxy files for docker using private IP which will
482-
# be later directed to k8s master upon config
483-
PROXY_INFO="http://172.16.1.1:3128/"
484-
cat <<EOT | sudo tee $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/http_proxy.conf > /dev/null
485-
[Service]
486-
Environment="HTTP_PROXY=${PROXY_INFO}"
487-
EOT
488-
cat <<EOT | sudo tee $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/https_proxy.conf > /dev/null
489-
[Service]
490-
Environment="HTTPS_PROXY=${PROXY_INFO}"
491-
EOT
492-
fi
493-
494471
sudo cp ${files_path}/remote_ctr.config.json ${FILESYSTEM_ROOT_ETC_SONIC}/
495472

496473
# Remote container management service files

rules/config

+3-4
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ INCLUDE_NAT = y
142142
# TELEMETRY_WRITABLE - Enable write/config operations via the gNMI interface.
143143
# Uncomment to enable:
144144
# TELEMETRY_WRITABLE = y
145-
146145
# INCLUDE_KUBERNETES - if set to y kubernetes packages are installed to be able to
147146
# run as worker node in kubernetes cluster.
148147
INCLUDE_KUBERNETES = n
@@ -155,9 +154,9 @@ INCLUDE_MACSEC = y
155154
# These are Used *only* when INCLUDE_KUBERNETES=y
156155
# NOTE: As a worker node it has to run version compatible to kubernetes master.
157156
#
158-
KUBERNETES_VERSION = 1.21.1
159-
KUBERNETES_CNI_VERSION = 0.8.7
160-
K8s_GCR_IO_PAUSE_VERSION = 3.4.1
157+
KUBERNETES_VERSION = 1.18.6
158+
KUBERNETES_CNI_VERSION = 0.8.6
159+
K8s_GCR_IO_PAUSE_VERSION = 3.2
161160

162161
# SONIC_ENABLE_IMAGE_SIGNATURE - enable image signature
163162
# To not use the auto-generated self-signed certificate, the required files to sign the image as below:

src/sonic-ctrmgrd/ctrmgr/ctrmgr_iptables.py

-135
This file was deleted.

src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py

+2-11
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import syslog
99

1010
from collections import defaultdict
11-
from ctrmgr.ctrmgr_iptables import iptable_proxy_rule_upd
1211

1312
from swsscommon import swsscommon
1413
from sonic_py_common import device_info
@@ -88,13 +87,11 @@
8887
JOIN_LATENCY = "join_latency_on_boot_seconds"
8988
JOIN_RETRY = "retry_join_interval_seconds"
9089
LABEL_RETRY = "retry_labels_update_seconds"
91-
USE_K8S_PROXY = "use_k8s_as_http_proxy"
9290

9391
remote_ctr_config = {
9492
JOIN_LATENCY: 10,
9593
JOIN_RETRY: 10,
96-
LABEL_RETRY: 2,
97-
USE_K8S_PROXY: ""
94+
LABEL_RETRY: 2
9895
}
9996

10097
def log_debug(m):
@@ -312,9 +309,6 @@ def __init__(self, server):
312309

313310
self.start_time = datetime.datetime.now()
314311

315-
if remote_ctr_config[USE_K8S_PROXY] == "y":
316-
iptable_proxy_rule_upd(self.cfg_server[CFG_SER_IP])
317-
318312
if not self.st_server[ST_FEAT_UPDATE_TS]:
319313
# This is upon system start. Sleep 10m before join
320314
self.start_time += datetime.timedelta(
@@ -342,9 +336,6 @@ def on_config_update(self, key, op, data):
342336
log_debug("Received config update: {}".format(str(data)))
343337
self.cfg_server = cfg_data
344338

345-
if remote_ctr_config[USE_K8S_PROXY] == "y":
346-
iptable_proxy_rule_upd(self.cfg_server[CFG_SER_IP])
347-
348339
if self.pending:
349340
tnow = datetime.datetime.now()
350341
if tnow < self.start_time:
@@ -368,7 +359,7 @@ def handle_update(self):
368359

369360
ip = self.cfg_server[CFG_SER_IP]
370361
disable = self.cfg_server[CFG_SER_DISABLE] != "false"
371-
362+
372363
pre_state = dict(self.st_server)
373364
log_debug("server: handle_update: disable={} ip={}".format(disable, ip))
374365
if disable or not ip:
+4-5
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[Unit]
22
Description=Container Manager watcher daemon
3-
Requires=caclmgrd.service
4-
After=caclmgrd.service
5-
BindsTo=sonic.target
6-
After=sonic.target
3+
Requires=updategraph.service
4+
After=updategraph.service
5+
76

87
[Service]
98
Type=simple
@@ -12,4 +11,4 @@ Restart=always
1211
RestartSec=30
1312

1413
[Install]
15-
WantedBy=sonic.target
14+
WantedBy=multi-user.target

src/sonic-ctrmgrd/ctrmgr/remote_ctr.config.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
"join_latency_on_boot_seconds": 300,
33
"retry_join_interval_seconds": 30,
44
"retry_labels_update_seconds": 5,
5-
"revert_to_local_on_wait_seconds": 60,
6-
"use_k8s_as_http_proxy": "y"
5+
"revert_to_local_on_wait_seconds": 60
76
}
87

0 commit comments

Comments
 (0)