1
1
#! /bin/sh
2
+ # Launch of Weave Net pod - requires that init.sh has been run previously
2
3
3
4
set -e
4
5
5
- modprobe_safe () {
6
- modprobe $1 || echo " Ignore the error if \" $1 \" is built-in in the kernel" >&2
7
- }
8
-
9
6
# Setup iptables backend to be legacy or nftable
10
7
setup_iptables_backend () {
11
8
if [ -n " ${IPTABLES_BACKEND} " ]; then
@@ -34,24 +31,6 @@ setup_iptables_backend() {
34
31
fi
35
32
}
36
33
37
- # Check whether xt_set actually exists
38
- xt_set_exists () {
39
- # Clean everything up in advance, in case there's leftovers
40
- iptables -w -F WEAVE-KUBE-TEST 2> /dev/null || true
41
- iptables -w -X WEAVE-KUBE-TEST 2> /dev/null || true
42
- ipset destroy weave-kube-test 2> /dev/null || true
43
-
44
- ipset create weave-kube-test hash:ip
45
- iptables -w -t filter -N WEAVE-KUBE-TEST
46
- if ! iptables -w -A WEAVE-KUBE-TEST -m set --match-set weave-kube-test src -j DROP; then
47
- NOT_EXIST=1
48
- fi
49
- iptables -w -F WEAVE-KUBE-TEST
50
- iptables -w -X WEAVE-KUBE-TEST
51
- ipset destroy weave-kube-test
52
- [ -z " $NOT_EXIST " ] || (echo " \" xt_set\" does not exist" >&2 && return 1)
53
- }
54
-
55
34
setup_iptables_backend
56
35
57
36
# Default if not supplied - same as weave net default
@@ -67,23 +46,6 @@ DB_PREFIX=${DB_PREFIX:-/weavedb/weave-net}
67
46
68
47
# Default for network policy
69
48
EXPECT_NPC=${EXPECT_NPC:- 1}
70
- NO_MASQ_LOCAL=${NO_MASQ_LOCAL:- 1}
71
-
72
- # Ensure we have the required modules for NPC
73
- if [ " ${EXPECT_NPC} " != " 0" ]; then
74
- modprobe_safe br_netfilter
75
- modprobe_safe xt_set
76
- xt_set_exists
77
- fi
78
-
79
- # kube-proxy requires that bridged traffic passes through netfilter
80
- if ! BRIDGE_NF_ENABLED=$( cat /proc/sys/net/bridge/bridge-nf-call-iptables) ; then
81
- echo " Cannot detect bridge-nf support - network policy and iptables mode kubeproxy may not work reliably" >&2
82
- else
83
- if [ " $BRIDGE_NF_ENABLED " != " 1" ]; then
84
- echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
85
- fi
86
- fi
87
49
88
50
STATUS_OPTS=" --metrics-addr=$METRICS_ADDR "
89
51
# --status-addr exposes internal information, so only turn it on if asked to.
@@ -160,20 +122,6 @@ post_start_actions() {
160
122
sleep 1
161
123
done
162
124
163
- # Install CNI plugin binary to typical CNI bin location
164
- # with fall-back to CNI directory used by kube-up on GCI OS
165
- if ! mkdir -p $HOST_ROOT /opt/cni/bin ; then
166
- if mkdir -p $HOST_ROOT /home/kubernetes/bin ; then
167
- export WEAVE_CNI_PLUGIN_DIR=$HOST_ROOT /home/kubernetes/bin
168
- else
169
- echo " Failed to install the Weave CNI plugin" >&2
170
- exit 1
171
- fi
172
- fi
173
- mkdir -p $HOST_ROOT /etc/cni/net.d
174
- export HOST_ROOT
175
- /home/weave/weave --local setup-cni
176
-
177
125
# Attempt to run the reclaim process, but don't halt the script if it fails
178
126
/home/weave/kube-utils -reclaim -node-name=" $HOSTNAME " -peer-name=" $PEERNAME " -log-level=debug || true
179
127
@@ -190,7 +138,6 @@ post_start_actions &
190
138
191
139
/home/weave/weaver $EXTRA_ARGS --port=6783 $( router_bridge_opts) \
192
140
--name=" $PEERNAME " \
193
- --host-root=$HOST_ROOT \
194
141
--http-addr=$HTTP_ADDR $STATUS_OPTS --docker-api=' ' --no-dns \
195
142
--db-prefix=" $DB_PREFIX " \
196
143
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
0 commit comments