Skip to content

Commit d3e2983

Browse files
committed
Revert "[Kubernetes]: The kube server could be used as http-proxy for docker (#7469)"
This reverts commit e851a42.
1 parent e784c26 commit d3e2983

File tree

11 files changed

+11
-371
lines changed

11 files changed

+11
-371
lines changed

build_debian.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,7 @@ then
235235
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubelet=${KUBERNETES_VERSION}-00
236236
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubectl=${KUBERNETES_VERSION}-00
237237
sudo LANG=C chroot $FILESYSTEM_ROOT apt-get -y install kubeadm=${KUBERNETES_VERSION}-00
238+
# kubeadm package auto install kubelet & kubectl
238239
else
239240
echo '[INFO] Skipping Install kubernetes'
240241
fi

files/build_templates/sonic_debian_extension.j2

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -414,10 +414,6 @@ sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install azure-
414414
sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install watchdog==0.10.3
415415

416416
{% if include_kubernetes == "y" %}
417-
# Point to kubelet to /etc/resolv.conf
418-
#
419-
echo 'KUBELET_EXTRA_ARGS="--resolv-conf=/etc/resolv.conf"' | sudo tee -a $FILESYSTEM_ROOT/etc/default/kubelet
420-
421417
# Copy Flannel conf file into sonic-templates
422418
#
423419
sudo cp $BUILD_TEMPLATES/kube_cni.10-flannel.conflist $FILESYSTEM_ROOT_USR_SHARE_SONIC_TEMPLATES/
@@ -438,25 +434,6 @@ sudo cp ${files_path}/container_startup.py ${FILESYSTEM_ROOT_USR_SHARE_SONIC_SCR
438434
sudo chmod a+x ${FILESYSTEM_ROOT_USR_SHARE_SONIC_SCRIPTS}/container_startup.py
439435

440436
# Config file used by container mgmt scripts/service
441-
fl="${files_path}/remote_ctr.config.json"
442-
use_k8s_as_http_proxy=$(python3 -c 'import json
443-
with open("'${fl}'", "r") as s:
444-
d=json.load(s);print(d.get("use_k8s_as_http_proxy", ""))
445-
')
446-
if [ "${use_k8s_as_http_proxy}" == "y" ]; then
447-
# create proxy files for docker using private IP which will
448-
# be later directed to k8s master upon config
449-
PROXY_INFO="http://172.16.1.1:3128/"
450-
cat <<EOT | sudo tee $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/http_proxy.conf > /dev/null
451-
[Service]
452-
Environment="HTTP_PROXY=${PROXY_INFO}"
453-
EOT
454-
cat <<EOT | sudo tee $FILESYSTEM_ROOT/etc/systemd/system/docker.service.d/https_proxy.conf > /dev/null
455-
[Service]
456-
Environment="HTTPS_PROXY=${PROXY_INFO}"
457-
EOT
458-
fi
459-
460437
sudo cp ${files_path}/remote_ctr.config.json ${FILESYSTEM_ROOT_ETC_SONIC}/
461438

462439
# Remote container management service files

rules/config

Lines changed: 3 additions & 4 deletions
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
@@ -152,9 +151,9 @@ INCLUDE_KUBERNETES = n
152151
# These are Used *only* when INCLUDE_KUBERNETES=y
153152
# NOTE: As a worker node it has to run version compatible to kubernetes master.
154153
#
155-
KUBERNETES_VERSION = 1.21.1
156-
KUBERNETES_CNI_VERSION = 0.8.7
157-
K8s_GCR_IO_PAUSE_VERSION = 3.4.1
154+
KUBERNETES_VERSION = 1.18.6
155+
KUBERNETES_CNI_VERSION = 0.8.6
156+
K8s_GCR_IO_PAUSE_VERSION = 3.2
158157

159158
# SONIC_ENABLE_IMAGE_SIGNATURE - enable image signature
160159
# 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

Lines changed: 0 additions & 135 deletions
This file was deleted.

src/sonic-ctrmgrd/ctrmgr/ctrmgrd.py

Lines changed: 2 additions & 11 deletions
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:
Lines changed: 4 additions & 5 deletions
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

Lines changed: 1 addition & 2 deletions
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)