Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ba64f8e8eb | ||
|
|
263aecf4ef | ||
|
|
f9239c9a44 | ||
|
|
9a2682671c | ||
|
|
ad621c807e | ||
|
|
164175160a | ||
|
|
edd28ab4cb | ||
|
|
4368dd5841 | ||
|
|
1dfe1f3b98 | ||
|
|
b1651c322a | ||
|
|
ba6741166d | ||
|
|
108f0a5c14 | ||
|
|
b04217d8e6 | ||
|
|
3ef97f0c7c | ||
|
|
e91900cc9e | ||
|
|
fe61992c06 | ||
|
|
8eeb3ca4f2 | ||
|
|
b7a9947c2f | ||
|
|
d81e908d1a | ||
|
|
a0ac81b3b4 | ||
|
|
c6d0d140a4 | ||
|
|
9bb14662e5 | ||
|
|
240d1b2f2a | ||
|
|
414cbfb838 | ||
|
|
fb7fc7ddae | ||
|
|
8c52698222 | ||
|
|
cb2e56fc44 | ||
|
|
905ec927a3 |
No files matched your search
@@ -1,7 +1,7 @@
|
|||||||
version: 2
|
version: 2
|
||||||
defaults: &defaults
|
defaults: &defaults
|
||||||
docker:
|
docker:
|
||||||
- image: weaveworks/weavebuild:go1_14_4-d7249a8d
|
- image: weaveworks/weavebuild:master-1dfe1f3b
|
||||||
working_directory: /go/src/github.com/weaveworks/weave
|
working_directory: /go/src/github.com/weaveworks/weave
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
|||||||
@@ -1,3 +1,26 @@
|
|||||||
|
## Release 2.8.1
|
||||||
|
|
||||||
|
Fixes a problem introduced in 2.8.0 for machines whose ID is in /etc/machine-id #3886
|
||||||
|
Many thanks to contributor @avestuk for this fix.
|
||||||
|
|
||||||
|
Also move Kubernetes API calls out of Weave Net daemon #3885
|
||||||
|
- this reduces the size of the 'weaver' binary and stops it crashing when run on 32-bit ARM.
|
||||||
|
|
||||||
|
## Release 2.8.0
|
||||||
|
|
||||||
|
This release makes some important changes to trim the "attack surface" of the
|
||||||
|
Kubernetes install, and improves a couple of reported issues.
|
||||||
|
|
||||||
|
* Workaround to fix ipset conflict with iptables #3851, #3882
|
||||||
|
* Kubernetes: move kernel and CNI setup to init container #3880
|
||||||
|
* For K8s, stop running in host PID namespace #3876
|
||||||
|
* NetworkPolicy: avoid logging dropped packets that were not actually dropped #3852
|
||||||
|
* Build with Go version 1.15.6 #3883
|
||||||
|
|
||||||
|
Many thanks to contributors @drigz, @KevDBG and @NeonSludge.
|
||||||
|
|
||||||
|
[Full list of changes](https://github.com/weaveworks/weave/milestone/87?closed=1)
|
||||||
|
|
||||||
## Release 2.7.0
|
## Release 2.7.0
|
||||||
|
|
||||||
This release improves resiliency in a number of areas,
|
This release improves resiliency in a number of areas,
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
# Security Policy
|
||||||
|
|
||||||
|
At Weaveworks we take security very seriously, and value our close relationship with members of the security community.
|
||||||
|
|
||||||
|
## Supported Versions
|
||||||
|
|
||||||
|
As an Open Source project, only the latest code has all fixes and security patches.
|
||||||
|
If you require a higher level of commitment, please [contact Weaveworks](https://www.weave.works/contact/) to discuss.
|
||||||
|
|
||||||
|
## Reporting a Vulnerability
|
||||||
|
|
||||||
|
To submit a security bug report please e-mail us at security@weave.works.
|
||||||
|
|
||||||
|
We also operate a Bug Bounty programme; see https://www.weave.works/bug-bounty/
|
||||||
-30
@@ -89,8 +89,6 @@ build() {
|
|||||||
## Inject the version numbers and build the distributables
|
## Inject the version numbers and build the distributables
|
||||||
## (library versions?)
|
## (library versions?)
|
||||||
sed -i.bak "/SCRIPT_VERSION=/ c\SCRIPT_VERSION=\"$VERSION\"" ./weave
|
sed -i.bak "/SCRIPT_VERSION=/ c\SCRIPT_VERSION=\"$VERSION\"" ./weave
|
||||||
sed -i.bak -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.6.yaml
|
|
||||||
sed -i.bak -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.7.yaml
|
|
||||||
sed -i.bak -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.8.yaml
|
sed -i.bak -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.8.yaml
|
||||||
sed -i.bak -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.9.yaml
|
sed -i.bak -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.9.yaml
|
||||||
sed -i.bak -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.11.yaml
|
sed -i.bak -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.11.yaml
|
||||||
@@ -162,20 +160,6 @@ draft() {
|
|||||||
--name "weave" \
|
--name "weave" \
|
||||||
--file "./weave"
|
--file "./weave"
|
||||||
|
|
||||||
github-release upload \
|
|
||||||
--user $GITHUB_USER \
|
|
||||||
--repo weave \
|
|
||||||
--tag $LATEST_TAG \
|
|
||||||
--name "weave-daemonset-k8s-1.6.yaml" \
|
|
||||||
--file "./prog/weave-kube/weave-daemonset-k8s-1.6.yaml"
|
|
||||||
|
|
||||||
github-release upload \
|
|
||||||
--user $GITHUB_USER \
|
|
||||||
--repo weave \
|
|
||||||
--tag $LATEST_TAG \
|
|
||||||
--name "weave-daemonset-k8s-1.7.yaml" \
|
|
||||||
--file "./prog/weave-kube/weave-daemonset-k8s-1.7.yaml"
|
|
||||||
|
|
||||||
github-release upload \
|
github-release upload \
|
||||||
--user $GITHUB_USER \
|
--user $GITHUB_USER \
|
||||||
--repo weave \
|
--repo weave \
|
||||||
@@ -284,20 +268,6 @@ publish() {
|
|||||||
--name "weave" \
|
--name "weave" \
|
||||||
--file "./weave"
|
--file "./weave"
|
||||||
|
|
||||||
github-release upload \
|
|
||||||
--user $GITHUB_USER \
|
|
||||||
--repo weave \
|
|
||||||
--tag latest_release \
|
|
||||||
--name "weave-daemonset-k8s-1.6.yaml" \
|
|
||||||
--file "./prog/weave-kube/weave-daemonset-k8s-1.6.yaml"
|
|
||||||
|
|
||||||
github-release upload \
|
|
||||||
--user $GITHUB_USER \
|
|
||||||
--repo weave \
|
|
||||||
--tag latest_release \
|
|
||||||
--name "weave-daemonset-k8s-1.7.yaml" \
|
|
||||||
--file "./prog/weave-kube/weave-daemonset-k8s-1.7.yaml"
|
|
||||||
|
|
||||||
github-release upload \
|
github-release upload \
|
||||||
--user $GITHUB_USER \
|
--user $GITHUB_USER \
|
||||||
--repo weave \
|
--repo weave \
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
FROM golang:1.14.6-buster
|
FROM golang:1.15.6-buster
|
||||||
|
|
||||||
# Support Raspberry Pi 2 and newer
|
# Support Raspberry Pi 2 and newer
|
||||||
ENV GOARM 7
|
ENV GOARM 7
|
||||||
|
|||||||
+1
-1
@@ -592,7 +592,7 @@ type NoMasqLocalTracker struct {
|
|||||||
func NewNoMasqLocalTracker(ips ipset.Interface) *NoMasqLocalTracker {
|
func NewNoMasqLocalTracker(ips ipset.Interface) *NoMasqLocalTracker {
|
||||||
return &NoMasqLocalTracker{
|
return &NoMasqLocalTracker{
|
||||||
ips: ips,
|
ips: ips,
|
||||||
owner: ipset.UID(0), // dummy ipset owner
|
owner: ipset.UID("0"), // dummy ipset owner
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+15
-2
@@ -7,6 +7,7 @@ import (
|
|||||||
"log"
|
"log"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
)
|
)
|
||||||
@@ -21,6 +22,8 @@ const (
|
|||||||
ListSet = Type("list:set")
|
ListSet = Type("list:set")
|
||||||
HashIP = Type("hash:ip")
|
HashIP = Type("hash:ip")
|
||||||
HashNet = Type("hash:net")
|
HashNet = Type("hash:net")
|
||||||
|
|
||||||
|
DestroyRetrySleepMs = 100
|
||||||
)
|
)
|
||||||
|
|
||||||
type Interface interface {
|
type Interface interface {
|
||||||
@@ -153,12 +156,22 @@ func (i *ipset) FlushAll() error {
|
|||||||
|
|
||||||
func (i *ipset) Destroy(ipsetName Name) error {
|
func (i *ipset) Destroy(ipsetName Name) error {
|
||||||
i.removeSetFromUsers(ipsetName)
|
i.removeSetFromUsers(ipsetName)
|
||||||
return doExec("destroy", string(ipsetName))
|
err := doExec("destroy", string(ipsetName))
|
||||||
|
if err != nil {
|
||||||
|
time.Sleep(DestroyRetrySleepMs * time.Millisecond)
|
||||||
|
return doExec("destroy", string(ipsetName))
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (i *ipset) DestroyAll() error {
|
func (i *ipset) DestroyAll() error {
|
||||||
i.users = make(map[entryKey]map[UID]struct{})
|
i.users = make(map[entryKey]map[UID]struct{})
|
||||||
return doExec("destroy")
|
err := doExec("destroy")
|
||||||
|
if err != nil {
|
||||||
|
time.Sleep(DestroyRetrySleepMs * time.Millisecond)
|
||||||
|
return doExec("destroy")
|
||||||
|
}
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fetch a list of all existing sets with a given prefix
|
// Fetch a list of all existing sets with a given prefix
|
||||||
|
|||||||
+5
-2
@@ -158,12 +158,15 @@ func (npc *controller) AddNetworkPolicy(ctx context.Context, obj interface{}) er
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if egressNetworkPolicy {
|
if egressNetworkPolicy {
|
||||||
npc.defaultEgressDrop = true
|
if err := npc.ipt.Append(TableFilter, chains.EgressChain,
|
||||||
|
"-m", "state", "--state", "NEW", "-m", "mark", "!", "--mark", EgressMark, "-j", "NFLOG", "--nflog-group", "86"); err != nil {
|
||||||
|
return fmt.Errorf("Failed to add iptable egress log rule: %w", err)
|
||||||
|
}
|
||||||
if err := npc.ipt.Append(TableFilter, chains.EgressChain,
|
if err := npc.ipt.Append(TableFilter, chains.EgressChain,
|
||||||
"-m", "mark", "!", "--mark", EgressMark, "-j", "DROP"); err != nil {
|
"-m", "mark", "!", "--mark", EgressMark, "-j", "DROP"); err != nil {
|
||||||
npc.defaultEgressDrop = false
|
|
||||||
return fmt.Errorf("Failed to add iptable rule to drop egress traffic from the pods by default due to %s", err.Error())
|
return fmt.Errorf("Failed to add iptable rule to drop egress traffic from the pods by default due to %s", err.Error())
|
||||||
}
|
}
|
||||||
|
npc.defaultEgressDrop = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -314,6 +314,8 @@ func main() {
|
|||||||
justReclaim bool
|
justReclaim bool
|
||||||
justCheck bool
|
justCheck bool
|
||||||
justSetNodeStatus bool
|
justSetNodeStatus bool
|
||||||
|
justVersion bool
|
||||||
|
justUID bool
|
||||||
peerName string
|
peerName string
|
||||||
nodeName string
|
nodeName string
|
||||||
logLevel string
|
logLevel string
|
||||||
@@ -323,6 +325,8 @@ func main() {
|
|||||||
flag.BoolVar(&runReclaimDaemon, "run-reclaim-daemon", false, "run background process that reclaim IP space from dead peers ")
|
flag.BoolVar(&runReclaimDaemon, "run-reclaim-daemon", false, "run background process that reclaim IP space from dead peers ")
|
||||||
flag.BoolVar(&justCheck, "check-peer-new", false, "return success if peer name is not stored in annotation")
|
flag.BoolVar(&justCheck, "check-peer-new", false, "return success if peer name is not stored in annotation")
|
||||||
flag.BoolVar(&justSetNodeStatus, "set-node-status", false, "set NodeNetworkUnavailable to false")
|
flag.BoolVar(&justSetNodeStatus, "set-node-status", false, "set NodeNetworkUnavailable to false")
|
||||||
|
flag.BoolVar(&justVersion, "print-k8s-version", false, "print the Kubernetes version and exit")
|
||||||
|
flag.BoolVar(&justUID, "print-uid", false, "print a UID for this installation and exit")
|
||||||
flag.StringVar(&peerName, "peer-name", "unknown", "name of this Weave Net peer")
|
flag.StringVar(&peerName, "peer-name", "unknown", "name of this Weave Net peer")
|
||||||
flag.StringVar(&nodeName, "node-name", "unknown", "name of this Kubernetes node")
|
flag.StringVar(&nodeName, "node-name", "unknown", "name of this Kubernetes node")
|
||||||
flag.StringVar(&logLevel, "log-level", "info", "logging level (debug, info, warning, error)")
|
flag.StringVar(&logLevel, "log-level", "info", "logging level (debug, info, warning, error)")
|
||||||
@@ -371,6 +375,21 @@ func main() {
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
if justVersion {
|
||||||
|
k8sVersion, err := c.Discovery().ServerVersion()
|
||||||
|
if err != nil {
|
||||||
|
common.Log.Fatalf("[kube-peers] Could not get Kubernetes version: %v", err)
|
||||||
|
}
|
||||||
|
fmt.Println(k8sVersion.String())
|
||||||
|
}
|
||||||
|
if justUID {
|
||||||
|
// use UID of `weave-net` configmap as unique ID of the Kubernetes cluster
|
||||||
|
cm, err := c.CoreV1().ConfigMaps(configMapNamespace).Get(context.Background(), configMapName, api.GetOptions{})
|
||||||
|
if err != nil {
|
||||||
|
common.Log.Fatalf("Unable to fetch ConfigMap %s/%s to infer unique cluster ID", configMapNamespace, configMapName)
|
||||||
|
}
|
||||||
|
fmt.Println(cm.ObjectMeta.UID)
|
||||||
|
}
|
||||||
if runReclaimDaemon {
|
if runReclaimDaemon {
|
||||||
// Handle SIGINT and SIGTERM
|
// Handle SIGINT and SIGTERM
|
||||||
ch := make(chan os.Signal, 1)
|
ch := make(chan os.Signal, 1)
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ LABEL maintainer="Weaveworks <help@weave.works>" \
|
|||||||
org.opencontainers.image.source="https://github.com/weaveworks/weave" \
|
org.opencontainers.image.source="https://github.com/weaveworks/weave" \
|
||||||
org.opencontainers.image.vendor="Weaveworks"
|
org.opencontainers.image.vendor="Weaveworks"
|
||||||
|
|
||||||
ADD ./launch.sh ./kube-utils /home/weave/
|
ADD ./init.sh ./launch.sh ./kube-utils /home/weave/
|
||||||
ENTRYPOINT ["/home/weave/launch.sh"]
|
ENTRYPOINT ["/home/weave/launch.sh"]
|
||||||
|
|
||||||
# This label will change for every build, and should therefore be the last layer of the image:
|
# This label will change for every build, and should therefore be the last layer of the image:
|
||||||
|
|||||||
Executable
+64
@@ -0,0 +1,64 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# Initialisation of Weave Net pod: check Linux settings and install CNI plugin
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
modprobe_safe() {
|
||||||
|
modprobe $1 || echo "Ignore the error if \"$1\" is built-in in the kernel" >&2
|
||||||
|
}
|
||||||
|
|
||||||
|
# Check whether xt_set actually exists
|
||||||
|
xt_set_exists() {
|
||||||
|
# Clean everything up in advance, in case there's leftovers
|
||||||
|
iptables -w -F WEAVE-KUBE-TEST 2>/dev/null || true
|
||||||
|
iptables -w -X WEAVE-KUBE-TEST 2>/dev/null || true
|
||||||
|
ipset destroy weave-kube-test 2>/dev/null || true
|
||||||
|
|
||||||
|
ipset create weave-kube-test hash:ip
|
||||||
|
iptables -w -t filter -N WEAVE-KUBE-TEST
|
||||||
|
if ! iptables -w -A WEAVE-KUBE-TEST -m set --match-set weave-kube-test src -j DROP; then
|
||||||
|
NOT_EXIST=1
|
||||||
|
fi
|
||||||
|
iptables -w -F WEAVE-KUBE-TEST
|
||||||
|
iptables -w -X WEAVE-KUBE-TEST
|
||||||
|
# delay to allow kernel to clean up - see https://github.com/weaveworks/weave/issues/3847
|
||||||
|
sleep 1
|
||||||
|
ipset destroy weave-kube-test
|
||||||
|
[ -z "$NOT_EXIST" ] || (echo "\"xt_set\" does not exist" >&2 && return 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
# Default for network policy
|
||||||
|
EXPECT_NPC=${EXPECT_NPC:-1}
|
||||||
|
|
||||||
|
# Ensure we have the required modules for NPC
|
||||||
|
if [ "${EXPECT_NPC}" != "0" ]; then
|
||||||
|
modprobe_safe br_netfilter
|
||||||
|
modprobe_safe xt_set
|
||||||
|
xt_set_exists
|
||||||
|
fi
|
||||||
|
|
||||||
|
# kube-proxy requires that bridged traffic passes through netfilter
|
||||||
|
if ! BRIDGE_NF_ENABLED=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables); then
|
||||||
|
echo "Cannot detect bridge-nf support - network policy and iptables mode kubeproxy may not work reliably" >&2
|
||||||
|
else
|
||||||
|
if [ "$BRIDGE_NF_ENABLED" != "1" ]; then
|
||||||
|
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# This is where we expect the manifest to map host directories
|
||||||
|
HOST_ROOT=${HOST_ROOT:-/host}
|
||||||
|
|
||||||
|
# Install CNI plugin binary to typical CNI bin location
|
||||||
|
# with fall-back to CNI directory used by kube-up on GCI OS
|
||||||
|
if ! mkdir -p $HOST_ROOT/opt/cni/bin ; then
|
||||||
|
if mkdir -p $HOST_ROOT/home/kubernetes/bin ; then
|
||||||
|
export WEAVE_CNI_PLUGIN_DIR=$HOST_ROOT/home/kubernetes/bin
|
||||||
|
else
|
||||||
|
echo "Failed to install the Weave CNI plugin" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
mkdir -p $HOST_ROOT/etc/cni/net.d
|
||||||
|
export HOST_ROOT
|
||||||
|
/home/weave/weave --local setup-cni
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
# Launch of Weave Net pod - requires that init.sh has been run previously
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
modprobe_safe() {
|
# If this is run from an older manifest, run the init script here
|
||||||
modprobe $1 || echo "Ignore the error if \"$1\" is built-in in the kernel" >&2
|
[ "${INIT_CONTAINER}" = "true" ] || "$(dirname "$0")/init.sh"
|
||||||
}
|
|
||||||
|
|
||||||
# Setup iptables backend to be legacy or nftable
|
# Setup iptables backend to be legacy or nftable
|
||||||
setup_iptables_backend() {
|
setup_iptables_backend() {
|
||||||
@@ -34,24 +34,6 @@ setup_iptables_backend() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check whether xt_set actually exists
|
|
||||||
xt_set_exists() {
|
|
||||||
# Clean everything up in advance, in case there's leftovers
|
|
||||||
iptables -w -F WEAVE-KUBE-TEST 2>/dev/null || true
|
|
||||||
iptables -w -X WEAVE-KUBE-TEST 2>/dev/null || true
|
|
||||||
ipset destroy weave-kube-test 2>/dev/null || true
|
|
||||||
|
|
||||||
ipset create weave-kube-test hash:ip
|
|
||||||
iptables -w -t filter -N WEAVE-KUBE-TEST
|
|
||||||
if ! iptables -w -A WEAVE-KUBE-TEST -m set --match-set weave-kube-test src -j DROP; then
|
|
||||||
NOT_EXIST=1
|
|
||||||
fi
|
|
||||||
iptables -w -F WEAVE-KUBE-TEST
|
|
||||||
iptables -w -X WEAVE-KUBE-TEST
|
|
||||||
ipset destroy weave-kube-test
|
|
||||||
[ -z "$NOT_EXIST" ] || (echo "\"xt_set\" does not exist" >&2 && return 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
setup_iptables_backend
|
setup_iptables_backend
|
||||||
|
|
||||||
# Default if not supplied - same as weave net default
|
# Default if not supplied - same as weave net default
|
||||||
@@ -67,23 +49,6 @@ DB_PREFIX=${DB_PREFIX:-/weavedb/weave-net}
|
|||||||
|
|
||||||
# Default for network policy
|
# Default for network policy
|
||||||
EXPECT_NPC=${EXPECT_NPC:-1}
|
EXPECT_NPC=${EXPECT_NPC:-1}
|
||||||
NO_MASQ_LOCAL=${NO_MASQ_LOCAL:-1}
|
|
||||||
|
|
||||||
# Ensure we have the required modules for NPC
|
|
||||||
if [ "${EXPECT_NPC}" != "0" ]; then
|
|
||||||
modprobe_safe br_netfilter
|
|
||||||
modprobe_safe xt_set
|
|
||||||
xt_set_exists
|
|
||||||
fi
|
|
||||||
|
|
||||||
# kube-proxy requires that bridged traffic passes through netfilter
|
|
||||||
if ! BRIDGE_NF_ENABLED=$(cat /proc/sys/net/bridge/bridge-nf-call-iptables); then
|
|
||||||
echo "Cannot detect bridge-nf support - network policy and iptables mode kubeproxy may not work reliably" >&2
|
|
||||||
else
|
|
||||||
if [ "$BRIDGE_NF_ENABLED" != "1" ]; then
|
|
||||||
echo 1 > /proc/sys/net/bridge/bridge-nf-call-iptables
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
STATUS_OPTS="--metrics-addr=$METRICS_ADDR"
|
STATUS_OPTS="--metrics-addr=$METRICS_ADDR"
|
||||||
# --status-addr exposes internal information, so only turn it on if asked to.
|
# --status-addr exposes internal information, so only turn it on if asked to.
|
||||||
@@ -153,6 +118,10 @@ fi
|
|||||||
# weaver is running as the DB can only be opened by one process at a time
|
# weaver is running as the DB can only be opened by one process at a time
|
||||||
/usr/bin/weaveutil set-db-flag "$DB_PREFIX" peer-reclaim ok
|
/usr/bin/weaveutil set-db-flag "$DB_PREFIX" peer-reclaim ok
|
||||||
|
|
||||||
|
# couple more variables
|
||||||
|
WEAVE_KUBERNETES_VERSION=$(/home/weave/kube-utils -print-k8s-version)
|
||||||
|
WEAVE_KUBERNETES_UID=$(/home/weave/kube-utils -print-uid)
|
||||||
|
|
||||||
post_start_actions() {
|
post_start_actions() {
|
||||||
# Wait for weave process to become responsive
|
# Wait for weave process to become responsive
|
||||||
while true ; do
|
while true ; do
|
||||||
@@ -160,20 +129,6 @@ post_start_actions() {
|
|||||||
sleep 1
|
sleep 1
|
||||||
done
|
done
|
||||||
|
|
||||||
# Install CNI plugin binary to typical CNI bin location
|
|
||||||
# with fall-back to CNI directory used by kube-up on GCI OS
|
|
||||||
if ! mkdir -p $HOST_ROOT/opt/cni/bin ; then
|
|
||||||
if mkdir -p $HOST_ROOT/home/kubernetes/bin ; then
|
|
||||||
export WEAVE_CNI_PLUGIN_DIR=$HOST_ROOT/home/kubernetes/bin
|
|
||||||
else
|
|
||||||
echo "Failed to install the Weave CNI plugin" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
mkdir -p $HOST_ROOT/etc/cni/net.d
|
|
||||||
export HOST_ROOT
|
|
||||||
/home/weave/weave --local setup-cni
|
|
||||||
|
|
||||||
# Attempt to run the reclaim process, but don't halt the script if it fails
|
# Attempt to run the reclaim process, but don't halt the script if it fails
|
||||||
/home/weave/kube-utils -reclaim -node-name="$HOSTNAME" -peer-name="$PEERNAME" -log-level=debug || true
|
/home/weave/kube-utils -reclaim -node-name="$HOSTNAME" -peer-name="$PEERNAME" -log-level=debug || true
|
||||||
|
|
||||||
@@ -190,7 +145,6 @@ post_start_actions &
|
|||||||
|
|
||||||
/home/weave/weaver $EXTRA_ARGS --port=6783 $(router_bridge_opts) \
|
/home/weave/weaver $EXTRA_ARGS --port=6783 $(router_bridge_opts) \
|
||||||
--name="$PEERNAME" \
|
--name="$PEERNAME" \
|
||||||
--host-root=$HOST_ROOT \
|
|
||||||
--http-addr=$HTTP_ADDR $STATUS_OPTS --docker-api='' --no-dns \
|
--http-addr=$HTTP_ADDR $STATUS_OPTS --docker-api='' --no-dns \
|
||||||
--db-prefix="$DB_PREFIX" \
|
--db-prefix="$DB_PREFIX" \
|
||||||
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
|
--ipalloc-range=$IPALLOC_RANGE $NICKNAME_ARG \
|
||||||
|
|||||||
@@ -118,11 +118,34 @@ items:
|
|||||||
labels:
|
labels:
|
||||||
name: weave-net
|
name: weave-net
|
||||||
spec:
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: weave-init
|
||||||
|
image: 'weaveworks/weave-kube:latest'
|
||||||
|
imagePullPolicy: Always
|
||||||
|
command:
|
||||||
|
- /home/weave/init.sh
|
||||||
|
env:
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- name: cni-bin
|
||||||
|
mountPath: /host/opt
|
||||||
|
- name: cni-bin2
|
||||||
|
mountPath: /host/home
|
||||||
|
- name: cni-conf
|
||||||
|
mountPath: /host/etc
|
||||||
|
- name: lib-modules
|
||||||
|
mountPath: /lib/modules
|
||||||
|
- name: xtables-lock
|
||||||
|
mountPath: /run/xtables.lock
|
||||||
|
readOnly: false
|
||||||
containers:
|
containers:
|
||||||
- name: weave
|
- name: weave
|
||||||
command:
|
command:
|
||||||
- /home/weave/launch.sh
|
- /home/weave/launch.sh
|
||||||
env:
|
env:
|
||||||
|
- name: INIT_CONTAINER
|
||||||
|
value: "true"
|
||||||
- name: HOSTNAME
|
- name: HOSTNAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
@@ -143,16 +166,12 @@ items:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: weavedb
|
- name: weavedb
|
||||||
mountPath: /weavedb
|
mountPath: /weavedb
|
||||||
- name: cni-bin
|
|
||||||
mountPath: /host/opt
|
|
||||||
- name: cni-bin2
|
|
||||||
mountPath: /host/home
|
|
||||||
- name: cni-conf
|
|
||||||
mountPath: /host/etc
|
|
||||||
- name: dbus
|
- name: dbus
|
||||||
mountPath: /host/var/lib/dbus
|
mountPath: /host/var/lib/dbus
|
||||||
- name: lib-modules
|
readOnly: true
|
||||||
mountPath: /lib/modules
|
- mountPath: /host/etc/machine-id
|
||||||
|
name: cni-machine-id
|
||||||
|
readOnly: true
|
||||||
- name: xtables-lock
|
- name: xtables-lock
|
||||||
mountPath: /run/xtables.lock
|
mountPath: /run/xtables.lock
|
||||||
readOnly: false
|
readOnly: false
|
||||||
@@ -177,7 +196,7 @@ items:
|
|||||||
readOnly: false
|
readOnly: false
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
dnsPolicy: ClusterFirstWithHostNet
|
dnsPolicy: ClusterFirstWithHostNet
|
||||||
hostPID: true
|
hostPID: false
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
securityContext:
|
securityContext:
|
||||||
seLinuxOptions: {}
|
seLinuxOptions: {}
|
||||||
@@ -200,6 +219,9 @@ items:
|
|||||||
- name: cni-conf
|
- name: cni-conf
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /etc
|
path: /etc
|
||||||
|
- name: cni-machine-id
|
||||||
|
hostPath:
|
||||||
|
path: /etc/machine-id
|
||||||
- name: dbus
|
- name: dbus
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /var/lib/dbus
|
path: /var/lib/dbus
|
||||||
|
|||||||
@@ -1,181 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: List
|
|
||||||
items:
|
|
||||||
- apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: ClusterRole
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ''
|
|
||||||
resources:
|
|
||||||
- pods
|
|
||||||
- namespaces
|
|
||||||
- nodes
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiGroups:
|
|
||||||
- extensions
|
|
||||||
resources:
|
|
||||||
- networkpolicies
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: ClusterRoleBinding
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
roleRef:
|
|
||||||
kind: ClusterRole
|
|
||||||
name: weave-net
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: Role
|
|
||||||
metadata:
|
|
||||||
name: weave-net-kube-peer
|
|
||||||
namespace: kube-system
|
|
||||||
labels:
|
|
||||||
name: weave-net-kube-peer
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ''
|
|
||||||
resources:
|
|
||||||
- configmaps
|
|
||||||
resourceNames:
|
|
||||||
- weave-net
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- update
|
|
||||||
- apiGroups:
|
|
||||||
- ''
|
|
||||||
resources:
|
|
||||||
- configmaps
|
|
||||||
verbs:
|
|
||||||
- create
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: RoleBinding
|
|
||||||
metadata:
|
|
||||||
name: weave-net-kube-peer
|
|
||||||
namespace: kube-system
|
|
||||||
labels:
|
|
||||||
name: weave-net-kube-peer
|
|
||||||
roleRef:
|
|
||||||
kind: Role
|
|
||||||
name: weave-net-kube-peer
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
- apiVersion: extensions/v1beta1
|
|
||||||
kind: DaemonSet
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
spec:
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: weave
|
|
||||||
command:
|
|
||||||
- /home/weave/launch.sh
|
|
||||||
env:
|
|
||||||
- name: HOSTNAME
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
apiVersion: v1
|
|
||||||
fieldPath: spec.nodeName
|
|
||||||
image: 'weaveworks/weave-kube:latest'
|
|
||||||
imagePullPolicy: Always
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
host: 127.0.0.1
|
|
||||||
path: /status
|
|
||||||
port: 6784
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 50m
|
|
||||||
securityContext:
|
|
||||||
privileged: true
|
|
||||||
volumeMounts:
|
|
||||||
- name: weavedb
|
|
||||||
mountPath: /weavedb
|
|
||||||
- name: cni-bin
|
|
||||||
mountPath: /host/opt
|
|
||||||
- name: cni-bin2
|
|
||||||
mountPath: /host/home
|
|
||||||
- name: cni-conf
|
|
||||||
mountPath: /host/etc
|
|
||||||
- name: dbus
|
|
||||||
mountPath: /host/var/lib/dbus
|
|
||||||
- name: lib-modules
|
|
||||||
mountPath: /lib/modules
|
|
||||||
- name: weave-npc
|
|
||||||
env:
|
|
||||||
- name: HOSTNAME
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
apiVersion: v1
|
|
||||||
fieldPath: spec.nodeName
|
|
||||||
image: 'weaveworks/weave-npc:latest'
|
|
||||||
imagePullPolicy: Always
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 50m
|
|
||||||
securityContext:
|
|
||||||
privileged: true
|
|
||||||
hostNetwork: true
|
|
||||||
hostPID: true
|
|
||||||
restartPolicy: Always
|
|
||||||
securityContext:
|
|
||||||
seLinuxOptions: {}
|
|
||||||
serviceAccountName: weave-net
|
|
||||||
tolerations:
|
|
||||||
- effect: NoSchedule
|
|
||||||
operator: Exists
|
|
||||||
- effect: NoExecute
|
|
||||||
operator: Exists
|
|
||||||
volumes:
|
|
||||||
- name: weavedb
|
|
||||||
hostPath:
|
|
||||||
path: /var/lib/weave
|
|
||||||
- name: cni-bin
|
|
||||||
hostPath:
|
|
||||||
path: /opt
|
|
||||||
- name: cni-bin2
|
|
||||||
hostPath:
|
|
||||||
path: /home
|
|
||||||
- name: cni-conf
|
|
||||||
hostPath:
|
|
||||||
path: /etc
|
|
||||||
- name: dbus
|
|
||||||
hostPath:
|
|
||||||
path: /var/lib/dbus
|
|
||||||
- name: lib-modules
|
|
||||||
hostPath:
|
|
||||||
path: /lib/modules
|
|
||||||
updateStrategy:
|
|
||||||
type: RollingUpdate
|
|
||||||
@@ -1,200 +0,0 @@
|
|||||||
apiVersion: v1
|
|
||||||
kind: List
|
|
||||||
items:
|
|
||||||
- apiVersion: v1
|
|
||||||
kind: ServiceAccount
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: ClusterRole
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ''
|
|
||||||
resources:
|
|
||||||
- pods
|
|
||||||
- namespaces
|
|
||||||
- nodes
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiGroups:
|
|
||||||
- 'networking.k8s.io'
|
|
||||||
resources:
|
|
||||||
- networkpolicies
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiGroups:
|
|
||||||
- ''
|
|
||||||
resources:
|
|
||||||
- nodes/status
|
|
||||||
verbs:
|
|
||||||
- patch
|
|
||||||
- update
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: ClusterRoleBinding
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
roleRef:
|
|
||||||
kind: ClusterRole
|
|
||||||
name: weave-net
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: Role
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ''
|
|
||||||
resources:
|
|
||||||
- configmaps
|
|
||||||
resourceNames:
|
|
||||||
- weave-net
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- update
|
|
||||||
- apiGroups:
|
|
||||||
- ''
|
|
||||||
resources:
|
|
||||||
- configmaps
|
|
||||||
verbs:
|
|
||||||
- create
|
|
||||||
- apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
kind: RoleBinding
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
roleRef:
|
|
||||||
kind: Role
|
|
||||||
name: weave-net
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
- apiVersion: extensions/v1beta1
|
|
||||||
kind: DaemonSet
|
|
||||||
metadata:
|
|
||||||
name: weave-net
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
namespace: kube-system
|
|
||||||
spec:
|
|
||||||
# Wait 5 seconds to let pod connect before rolling next pod
|
|
||||||
minReadySeconds: 5
|
|
||||||
template:
|
|
||||||
metadata:
|
|
||||||
labels:
|
|
||||||
name: weave-net
|
|
||||||
spec:
|
|
||||||
containers:
|
|
||||||
- name: weave
|
|
||||||
command:
|
|
||||||
- /home/weave/launch.sh
|
|
||||||
env:
|
|
||||||
- name: HOSTNAME
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
apiVersion: v1
|
|
||||||
fieldPath: spec.nodeName
|
|
||||||
image: 'weaveworks/weave-kube:latest'
|
|
||||||
imagePullPolicy: Always
|
|
||||||
readinessProbe:
|
|
||||||
httpGet:
|
|
||||||
host: 127.0.0.1
|
|
||||||
path: /status
|
|
||||||
port: 6784
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 50m
|
|
||||||
securityContext:
|
|
||||||
privileged: true
|
|
||||||
volumeMounts:
|
|
||||||
- name: weavedb
|
|
||||||
mountPath: /weavedb
|
|
||||||
- name: cni-bin
|
|
||||||
mountPath: /host/opt
|
|
||||||
- name: cni-bin2
|
|
||||||
mountPath: /host/home
|
|
||||||
- name: cni-conf
|
|
||||||
mountPath: /host/etc
|
|
||||||
- name: dbus
|
|
||||||
mountPath: /host/var/lib/dbus
|
|
||||||
- name: lib-modules
|
|
||||||
mountPath: /lib/modules
|
|
||||||
- name: xtables-lock
|
|
||||||
mountPath: /run/xtables.lock
|
|
||||||
readOnly: false
|
|
||||||
- name: weave-npc
|
|
||||||
env:
|
|
||||||
- name: HOSTNAME
|
|
||||||
valueFrom:
|
|
||||||
fieldRef:
|
|
||||||
apiVersion: v1
|
|
||||||
fieldPath: spec.nodeName
|
|
||||||
image: 'weaveworks/weave-npc:latest'
|
|
||||||
imagePullPolicy: Always
|
|
||||||
resources:
|
|
||||||
requests:
|
|
||||||
cpu: 50m
|
|
||||||
securityContext:
|
|
||||||
privileged: true
|
|
||||||
volumeMounts:
|
|
||||||
- name: xtables-lock
|
|
||||||
mountPath: /run/xtables.lock
|
|
||||||
readOnly: false
|
|
||||||
hostNetwork: true
|
|
||||||
hostPID: true
|
|
||||||
restartPolicy: Always
|
|
||||||
securityContext:
|
|
||||||
seLinuxOptions: {}
|
|
||||||
serviceAccountName: weave-net
|
|
||||||
tolerations:
|
|
||||||
- effect: NoSchedule
|
|
||||||
operator: Exists
|
|
||||||
- effect: NoExecute
|
|
||||||
operator: Exists
|
|
||||||
volumes:
|
|
||||||
- name: weavedb
|
|
||||||
hostPath:
|
|
||||||
path: /var/lib/weave
|
|
||||||
- name: cni-bin
|
|
||||||
hostPath:
|
|
||||||
path: /opt
|
|
||||||
- name: cni-bin2
|
|
||||||
hostPath:
|
|
||||||
path: /home
|
|
||||||
- name: cni-conf
|
|
||||||
hostPath:
|
|
||||||
path: /etc
|
|
||||||
- name: dbus
|
|
||||||
hostPath:
|
|
||||||
path: /var/lib/dbus
|
|
||||||
- name: lib-modules
|
|
||||||
hostPath:
|
|
||||||
path: /lib/modules
|
|
||||||
- name: xtables-lock
|
|
||||||
hostPath:
|
|
||||||
path: /run/xtables.lock
|
|
||||||
updateStrategy:
|
|
||||||
type: RollingUpdate
|
|
||||||
@@ -115,11 +115,34 @@ items:
|
|||||||
labels:
|
labels:
|
||||||
name: weave-net
|
name: weave-net
|
||||||
spec:
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: weave-init
|
||||||
|
image: 'weaveworks/weave-kube:latest'
|
||||||
|
imagePullPolicy: Always
|
||||||
|
command:
|
||||||
|
- /home/weave/init.sh
|
||||||
|
env:
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- name: cni-bin
|
||||||
|
mountPath: /host/opt
|
||||||
|
- name: cni-bin2
|
||||||
|
mountPath: /host/home
|
||||||
|
- name: cni-conf
|
||||||
|
mountPath: /host/etc
|
||||||
|
- name: lib-modules
|
||||||
|
mountPath: /lib/modules
|
||||||
|
- name: xtables-lock
|
||||||
|
mountPath: /run/xtables.lock
|
||||||
|
readOnly: false
|
||||||
containers:
|
containers:
|
||||||
- name: weave
|
- name: weave
|
||||||
command:
|
command:
|
||||||
- /home/weave/launch.sh
|
- /home/weave/launch.sh
|
||||||
env:
|
env:
|
||||||
|
- name: INIT_CONTAINER
|
||||||
|
value: "true"
|
||||||
- name: HOSTNAME
|
- name: HOSTNAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
@@ -140,16 +163,12 @@ items:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: weavedb
|
- name: weavedb
|
||||||
mountPath: /weavedb
|
mountPath: /weavedb
|
||||||
- name: cni-bin
|
|
||||||
mountPath: /host/opt
|
|
||||||
- name: cni-bin2
|
|
||||||
mountPath: /host/home
|
|
||||||
- name: cni-conf
|
|
||||||
mountPath: /host/etc
|
|
||||||
- name: dbus
|
- name: dbus
|
||||||
mountPath: /host/var/lib/dbus
|
mountPath: /host/var/lib/dbus
|
||||||
- name: lib-modules
|
readOnly: true
|
||||||
mountPath: /lib/modules
|
- mountPath: /host/etc/machine-id
|
||||||
|
name: cni-machine-id
|
||||||
|
readOnly: true
|
||||||
- name: xtables-lock
|
- name: xtables-lock
|
||||||
mountPath: /run/xtables.lock
|
mountPath: /run/xtables.lock
|
||||||
readOnly: false
|
readOnly: false
|
||||||
@@ -173,7 +192,7 @@ items:
|
|||||||
mountPath: /run/xtables.lock
|
mountPath: /run/xtables.lock
|
||||||
readOnly: false
|
readOnly: false
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
hostPID: true
|
hostPID: false
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
securityContext:
|
securityContext:
|
||||||
seLinuxOptions: {}
|
seLinuxOptions: {}
|
||||||
@@ -196,6 +215,9 @@ items:
|
|||||||
- name: cni-conf
|
- name: cni-conf
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /etc
|
path: /etc
|
||||||
|
- name: cni-machine-id
|
||||||
|
hostPath:
|
||||||
|
path: /etc/machine-id
|
||||||
- name: dbus
|
- name: dbus
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /var/lib/dbus
|
path: /var/lib/dbus
|
||||||
|
|||||||
@@ -118,11 +118,34 @@ items:
|
|||||||
labels:
|
labels:
|
||||||
name: weave-net
|
name: weave-net
|
||||||
spec:
|
spec:
|
||||||
|
initContainers:
|
||||||
|
- name: weave-init
|
||||||
|
image: 'weaveworks/weave-kube:latest'
|
||||||
|
imagePullPolicy: Always
|
||||||
|
command:
|
||||||
|
- /home/weave/init.sh
|
||||||
|
env:
|
||||||
|
securityContext:
|
||||||
|
privileged: true
|
||||||
|
volumeMounts:
|
||||||
|
- name: cni-bin
|
||||||
|
mountPath: /host/opt
|
||||||
|
- name: cni-bin2
|
||||||
|
mountPath: /host/home
|
||||||
|
- name: cni-conf
|
||||||
|
mountPath: /host/etc
|
||||||
|
- name: lib-modules
|
||||||
|
mountPath: /lib/modules
|
||||||
|
- name: xtables-lock
|
||||||
|
mountPath: /run/xtables.lock
|
||||||
|
readOnly: false
|
||||||
containers:
|
containers:
|
||||||
- name: weave
|
- name: weave
|
||||||
command:
|
command:
|
||||||
- /home/weave/launch.sh
|
- /home/weave/launch.sh
|
||||||
env:
|
env:
|
||||||
|
- name: INIT_CONTAINER
|
||||||
|
value: "true"
|
||||||
- name: HOSTNAME
|
- name: HOSTNAME
|
||||||
valueFrom:
|
valueFrom:
|
||||||
fieldRef:
|
fieldRef:
|
||||||
@@ -143,16 +166,12 @@ items:
|
|||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: weavedb
|
- name: weavedb
|
||||||
mountPath: /weavedb
|
mountPath: /weavedb
|
||||||
- name: cni-bin
|
|
||||||
mountPath: /host/opt
|
|
||||||
- name: cni-bin2
|
|
||||||
mountPath: /host/home
|
|
||||||
- name: cni-conf
|
|
||||||
mountPath: /host/etc
|
|
||||||
- name: dbus
|
- name: dbus
|
||||||
mountPath: /host/var/lib/dbus
|
mountPath: /host/var/lib/dbus
|
||||||
- name: lib-modules
|
readOnly: true
|
||||||
mountPath: /lib/modules
|
- mountPath: /host/etc/machine-id
|
||||||
|
name: cni-machine-id
|
||||||
|
readOnly: true
|
||||||
- name: xtables-lock
|
- name: xtables-lock
|
||||||
mountPath: /run/xtables.lock
|
mountPath: /run/xtables.lock
|
||||||
readOnly: false
|
readOnly: false
|
||||||
@@ -177,7 +196,7 @@ items:
|
|||||||
readOnly: false
|
readOnly: false
|
||||||
hostNetwork: true
|
hostNetwork: true
|
||||||
dnsPolicy: ClusterFirstWithHostNet
|
dnsPolicy: ClusterFirstWithHostNet
|
||||||
hostPID: true
|
hostPID: false
|
||||||
restartPolicy: Always
|
restartPolicy: Always
|
||||||
securityContext:
|
securityContext:
|
||||||
seLinuxOptions: {}
|
seLinuxOptions: {}
|
||||||
@@ -200,6 +219,9 @@ items:
|
|||||||
- name: cni-conf
|
- name: cni-conf
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /etc
|
path: /etc
|
||||||
|
- name: cni-machine-id
|
||||||
|
hostPath:
|
||||||
|
path: /etc/machine-id
|
||||||
- name: dbus
|
- name: dbus
|
||||||
hostPath:
|
hostPath:
|
||||||
path: /var/lib/dbus
|
path: /var/lib/dbus
|
||||||
|
|||||||
@@ -193,7 +193,6 @@ func createBaseRules(ipt *iptables.IPTables, ips ipset.Interface) error {
|
|||||||
ruleSpecs = append(ruleSpecs, [][]string{
|
ruleSpecs = append(ruleSpecs, [][]string{
|
||||||
{"-m", "state", "--state", "NEW", "-j", chains.EgressDefaultChain},
|
{"-m", "state", "--state", "NEW", "-j", chains.EgressDefaultChain},
|
||||||
{"-m", "state", "--state", "NEW", "-m", "mark", "!", "--mark", npc.EgressMark, "-j", chains.EgressCustomChain},
|
{"-m", "state", "--state", "NEW", "-m", "mark", "!", "--mark", npc.EgressMark, "-j", chains.EgressCustomChain},
|
||||||
{"-m", "state", "--state", "NEW", "-m", "mark", "!", "--mark", npc.EgressMark, "-j", "NFLOG", "--nflog-group", "86"},
|
|
||||||
}...)
|
}...)
|
||||||
if err := net.AddChainWithRules(ipt, npc.TableFilter, chains.EgressChain, ruleSpecs); err != nil {
|
if err := net.AddChainWithRules(ipt, npc.TableFilter, chains.EgressChain, ruleSpecs); err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
@@ -10,9 +10,6 @@ import (
|
|||||||
|
|
||||||
checkpoint "github.com/weaveworks/go-checkpoint"
|
checkpoint "github.com/weaveworks/go-checkpoint"
|
||||||
weave "github.com/weaveworks/weave/router"
|
weave "github.com/weaveworks/weave/router"
|
||||||
api "k8s.io/apimachinery/pkg/apis/meta/v1"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
|
||||||
"k8s.io/client-go/rest"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var checker *checkpoint.Checker
|
var checker *checkpoint.Checker
|
||||||
@@ -20,9 +17,7 @@ var newVersion atomic.Value
|
|||||||
var success atomic.Value
|
var success atomic.Value
|
||||||
|
|
||||||
const (
|
const (
|
||||||
updateCheckPeriod = 6 * time.Hour
|
updateCheckPeriod = 6 * time.Hour
|
||||||
configMapName = "weave-net"
|
|
||||||
configMapNamespace = "kube-system"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func checkForUpdates(dockerVersion string, router *weave.NetworkRouter, clusterSize uint) {
|
func checkForUpdates(dockerVersion string, router *weave.NetworkRouter, clusterSize uint) {
|
||||||
@@ -88,36 +83,13 @@ func checkpointFlags(router *weave.NetworkRouter) []checkpoint.Flag {
|
|||||||
return flags
|
return flags
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkpoint Kubernetes specific details
|
// checkpoint Kubernetes specific details, passed in from launch script
|
||||||
func checkpointKubernetes(ctx context.Context, flags map[string]string, clusterSize uint) {
|
func checkpointKubernetes(ctx context.Context, flags map[string]string, clusterSize uint) {
|
||||||
// checks if weaver is running in Kubernetes
|
version := os.Getenv("WEAVE_KUBERNETES_VERSION")
|
||||||
host := os.Getenv("KUBERNETES_SERVICE_HOST")
|
if len(version) == 0 {
|
||||||
if len(host) == 0 {
|
return // not running under Kubernetes
|
||||||
return
|
|
||||||
}
|
}
|
||||||
config, err := rest.InClusterConfig()
|
flags["kubernetes-version"] = version
|
||||||
if err != nil {
|
flags["kubernetes-cluster-uid"] = string(os.Getenv("WEAVE_KUBERNETES_UID"))
|
||||||
Log.Printf("Could not get Kubernetes in-cluster config: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
c, err := kubernetes.NewForConfig(config)
|
|
||||||
if err != nil {
|
|
||||||
Log.Printf("Could not make Kubernetes client: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
k8sVersion, err := c.Discovery().ServerVersion()
|
|
||||||
if err != nil {
|
|
||||||
Log.Printf("Could not get Kubernetes version: %v", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
flags["kubernetes-version"] = k8sVersion.String()
|
|
||||||
|
|
||||||
// use UID of `weave-net` configmap as unique ID of the Kubenerets cluster
|
|
||||||
cm, err := c.CoreV1().ConfigMaps(configMapNamespace).Get(ctx, configMapName, api.GetOptions{})
|
|
||||||
if err != nil {
|
|
||||||
Log.Printf("Unable to fetch ConfigMap %s/%s to infer unique cluster ID", configMapNamespace, configMapName)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
flags["kubernetes-cluster-uid"] = string(cm.ObjectMeta.UID)
|
|
||||||
flags["kubernetes-cluster-size"] = fmt.Sprint(clusterSize)
|
flags["kubernetes-cluster-size"] = fmt.Sprint(clusterSize)
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,17 @@ root@ubuntu:/# ping pingme
|
|||||||
...
|
...
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Moreover, weaveDNS always register all network aliases (--network-alias option to docker run).
|
||||||
|
|
||||||
|
```
|
||||||
|
host1$ docker run --network weave --network-alias pingme --network-alias pingme2 -dti weaveworks/ubuntu
|
||||||
|
host1$ docker run --network weave --hostname=ubuntu.weave.local -ti weaveworks/ubuntu
|
||||||
|
root@ubuntu:/# ping pingme
|
||||||
|
...
|
||||||
|
root@ubuntu:/# ping pingme2
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
> **Note** If both hostname and container name are specified at
|
> **Note** If both hostname and container name are specified at
|
||||||
the same time, the hostname takes precedence. In this circumstance, if
|
the same time, the hostname takes precedence. In this circumstance, if
|
||||||
the hostname is not in the weaveDNS domain, the container is *not*
|
the hostname is not in the weaveDNS domain, the container is *not*
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ fi
|
|||||||
# Ensure Kubernetes uses locally built container images and inject code coverage environment variable (or do nothing depending on $COVERAGE):
|
# Ensure Kubernetes uses locally built container images and inject code coverage environment variable (or do nothing depending on $COVERAGE):
|
||||||
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
||||||
-e "s%env:%$WEAVE_ENV_VARS%" \
|
-e "s%env:%$WEAVE_ENV_VARS%" \
|
||||||
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.9.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.11.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
@@ -361,19 +361,10 @@ sleep 2
|
|||||||
|
|
||||||
assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http://$DOMAIN:8080/status >/dev/null"
|
assert_raises "$SSH $HOST1 $KUBECTL exec $denyPodName -- curl -s -S -f -m 2 http://$DOMAIN:8080/status >/dev/null"
|
||||||
|
|
||||||
# Passing --no-masq-local and setting externalTrafficPolicy to Local must preserve
|
# Setting externalTrafficPolicy to Local must preserve the client source IP addr
|
||||||
# the client source IP addr
|
|
||||||
|
|
||||||
CLIENT_IP_MASQ="$($SSH $HOST1 curl -sS http://$HOST2:31138/client_ip)"
|
CLIENT_IP_MASQ="$($SSH $HOST1 curl -sS http://$HOST2:31138/client_ip)"
|
||||||
|
|
||||||
$SSH $HOST1 "$KUBECTL delete ds weave-net -n=kube-system"
|
|
||||||
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
|
||||||
-e "s%env:%$WEAVE_ENV_VARS%" \
|
|
||||||
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.9.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
|
||||||
|
|
||||||
sleep 2
|
|
||||||
assert_raises 'wait_for_x check_connections "connections to establish"'
|
|
||||||
|
|
||||||
run_on $HOST1 "$KUBECTL patch svc netvirt -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'"
|
run_on $HOST1 "$KUBECTL patch svc netvirt -p '{\"spec\":{\"externalTrafficPolicy\":\"Local\"}}'"
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function setup_kubernetes_cluster {
|
|||||||
# Ensure Kubernetes uses locally built container images and inject code coverage environment variable (or do nothing depending on $COVERAGE):
|
# Ensure Kubernetes uses locally built container images and inject code coverage environment variable (or do nothing depending on $COVERAGE):
|
||||||
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
||||||
-e "s%env:%$COVERAGE_ARGS%" \
|
-e "s%env:%$COVERAGE_ARGS%" \
|
||||||
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.7.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.11.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
||||||
}
|
}
|
||||||
|
|
||||||
function weave_connected {
|
function weave_connected {
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ function setup_kubernetes_cluster {
|
|||||||
# Ensure Kubernetes uses locally built container images and inject code coverage environment variable (or do nothing depending on $COVERAGE):
|
# Ensure Kubernetes uses locally built container images and inject code coverage environment variable (or do nothing depending on $COVERAGE):
|
||||||
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
sed -e "s%imagePullPolicy: Always%imagePullPolicy: Never%" \
|
||||||
-e "s%env:%$COVERAGE_ARGS%" \
|
-e "s%env:%$COVERAGE_ARGS%" \
|
||||||
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.7.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.11.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
|
||||||
}
|
}
|
||||||
|
|
||||||
function force_drop_node {
|
function force_drop_node {
|
||||||
|
|||||||
Reference in new issue
Block a user