Compare commits

...
16 Commits
Author SHA1 Message Date
Bryan Boreham 276d0b621b Add release v2.0.5 2017-10-05 11:57:23 +00:00
Martynas Pumputis 6733dac9fc Merge remote-tracking branch 'origin/issues/3136-fix-etc-hosts' into 2.0 2017-10-05 13:18:41 +02:00
Bryan Boreham 2c143612e2 Add back EXEC_IMAGE so proxy can exec itself 2017-10-05 11:01:57 +00:00
Bryan Boreham 86361c5b60 Merge pull request #3137 from weaveworks/lint-nonsense
Remove explicit error check at end of functions to placate lint
2017-10-04 16:59:01 +01:00
Bryan Boreham 35c017a787 Remove explicit error check at end of functions to placate lint
It's sad because this changes a regular pattern into an irregular one,
which will create spurious diffs if more work is added at the end of
the function.  Still, this is easier than fixing the lint runner to
ignore the report.
2017-10-04 13:40:13 +00:00
Bryan Boreham 79d65bc98b Report errors from rewriting /etc/hosts 2017-10-04 13:32:52 +00:00
Bryan Boreham c16653a396 Mount iptables lock file in weave-kube (#3134)
Mount iptables lock file in weave-kube

iptables uses the file `/run/xtables.lock` so that if changes are
under way, another instance of the iptables command can wait till it
is finished.
We need to mount the lock file from the host to the container in order
for this mechanism to work at all.
Note we rely on kubelet touching the file before running any pods -
see https://github.com/kubernetes/kubernetes/pull/47212
2017-10-03 14:52:49 +01:00
Bryan Boreham ba16135b3a Escape a minus that is being interpreted as a bullet (#3131) 2017-09-29 14:16:13 +01:00
Bryan Boreham 3c53aa66b7 Improved wording after review 2017-09-26 09:41:11 +00:00
Bryan Boreham c97d4731dc Merge pull request #3113 from weaveworks/plugin-v2-troubleshooting
Add instructions on troubleshooting the V2 plugin
2017-09-26 10:40:29 +01:00
Bryan Boreham a69546c9ee Reworded on review feedback 2017-09-26 09:39:04 +00:00
Bryan Boreham 49f7e38133 Removed stray repetition of anchor 2017-09-25 16:38:07 +00:00
Martynas Pumputis b0519af573 Merge pull request #3114 from weaveworks/issues/3103-rm-pluginv2-db
Remove db file for v2 plugin

Fixes #3103
2017-09-09 12:44:51 +02:00
Bryan Boreham dc7acd6c70 Remove db file for v2 plugin 2017-09-08 13:23:26 +00:00
Bryan Boreham d63a21363e Add instructions on troubleshooting the V2 plugin 2017-09-08 11:11:44 +00:00
Bryan Boreham a330dd4970 Improve "What is Weave Cloud" link 2017-09-07 19:39:50 +00:00
18 changed files with 240 additions and 74 deletions

No files matched your search

+18
View File
@@ -1,3 +1,21 @@
## Release 2.0.5
Bug fixes
* Fix /etc/hosts inside containers so the container's name resolves to
its Weave Net address #3136,#3138
* New weave-kube config for Kubernetes 1.7 and 1.8 which resolves an
intermittent conflict with kube-proxy that could break Weave Net
until reboot #2998,#3134
* Remove persistence file in `weave reset` when using Docker plugin V2 #3103,#3114
Build and test
* Some trivial changes to placate go-lint #3137
[Full list of changes](https://github.com/weaveworks/weave/milestone/63?closed=1).
## Release 2.0.4
Bug fixes
+15
View File
@@ -91,6 +91,7 @@ build() {
sed -i "/SCRIPT_VERSION=/ c\SCRIPT_VERSION=\"$VERSION\"" ./weave
sed -i -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset.yaml
sed -i -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.6.yaml
sed -i -e "s/:latest/:$VERSION/" -e "/imagePullPolicy: Always/d" ./prog/weave-kube/weave-daemonset-k8s-1.7.yaml
make SUDO=$SUDO WEAVE_VERSION=$VERSION DOCKERHUB_USER=$DOCKERHUB_USER
if make tests; then
@@ -173,6 +174,13 @@ draft() {
--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"
echo "** Draft $TYPE $RELEASE_NAME $VERSION created at"
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG"
}
@@ -274,6 +282,13 @@ publish() {
--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"
echo "** Release $RELEASE_NAME $VERSION published at"
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/$LATEST_TAG"
echo -e "\thttps://github.com/$GITHUB_USER/weave/releases/latest_release"
+1 -4
View File
@@ -17,10 +17,7 @@ func ConfigureARPCache(procPath, name string) error {
if err := sysctl(procPath, fmt.Sprintf("net/ipv4/neigh/%s/delay_first_probe_time", name), "2"); err != nil {
return err
}
if err := sysctl(procPath, fmt.Sprintf("net/ipv4/neigh/%s/ucast_solicit", name), "1"); err != nil {
return err
}
return nil
return sysctl(procPath, fmt.Sprintf("net/ipv4/neigh/%s/ucast_solicit", name), "1")
}
func sysctl(procPath, variable, value string) error {
+2 -10
View File
@@ -383,11 +383,7 @@ func (bf bridgedFastdpImpl) init(config *BridgeConfig) error {
return errors.Wrap(err, "creating bridged fastdp veth pair")
}
if err := linkSetUpByName(bf.datapathName); err != nil {
return err
}
return nil
return linkSetUpByName(bf.datapathName)
}
func (b bridgeImpl) attach(veth *netlink.Veth) error {
@@ -473,11 +469,7 @@ func configureIPTables(config *BridgeConfig) error {
if err = ipt.ClearChain("nat", "WEAVE"); err != nil {
return errors.Wrap(err, "clearing WEAVE chain")
}
if err = ipt.AppendUnique("nat", "POSTROUTING", "-j", "WEAVE"); err != nil {
return err
}
return nil
return ipt.AppendUnique("nat", "POSTROUTING", "-j", "WEAVE")
}
func linkSetUpByName(linkName string) error {
+1 -4
View File
@@ -421,10 +421,7 @@ func (ipsec *IPSec) installDropNonEncrypted(srcIP, dstIP net.IP, udpPort int, in
func (ipsec *IPSec) removeDropNonEncrypted(srcIP, dstIP net.IP, udpPort int, inSPI SPI) error {
rules := rulesDropNonEncrypted(srcIP, dstIP, udpPort, inSPI)
if err := ipsec.resetRules(rules, true); err != nil {
return err
}
return nil
return ipsec.resetRules(rules, true)
}
func (ipsec *IPSec) removeDropNonEncryptedInbound(srcIP, dstIP net.IP, inSPI SPI) error {
+2 -9
View File
@@ -218,11 +218,7 @@ func SetupIface(ifaceName, newIfName string) error {
if err := ConfigureARPCache("/proc", newIfName); err != nil {
return err
}
if err := ipt.Append("filter", "INPUT", "-i", newIfName, "-d", "224.0.0.0/4", "-j", "DROP"); err != nil {
return err
}
return nil
return ipt.Append("filter", "INPUT", "-i", newIfName, "-d", "224.0.0.0/4", "-j", "DROP")
}
// NB: This function can be used only by a process that terminates immediately
@@ -332,8 +328,5 @@ func ExposeNAT(ipnet net.IPNet) error {
if err := addNatRule(ipt, "-d", cidr, "!", "-s", cidr, "-j", "MASQUERADE"); err != nil {
return err
}
if err := addNatRule(ipt, "-s", cidr, "!", "-d", cidr, "-j", "MASQUERADE"); err != nil {
return err
}
return nil
return addNatRule(ipt, "-s", cidr, "!", "-d", cidr, "-j", "MASQUERADE")
}
+4 -19
View File
@@ -65,10 +65,7 @@ func (ns *ns) empty() bool {
}
func (ns *ns) destroy() error {
if err := ns.podSelectors.deprovision(ns.uid, map[string]*selectorSpec{ns.allPods.key: ns.allPods}, nil); err != nil {
return err
}
return nil
return ns.podSelectors.deprovision(ns.uid, map[string]*selectorSpec{ns.allPods.key: ns.allPods}, nil)
}
func (ns *ns) onNewPodSelector(selector *selector) error {
@@ -180,11 +177,7 @@ func (ns *ns) addNetworkPolicy(obj *extnapi.NetworkPolicy) error {
if err := ns.podSelectors.provision(obj.ObjectMeta.UID, nil, podSelectors); err != nil {
return err
}
if err := ns.rules.provision(obj.ObjectMeta.UID, nil, rules); err != nil {
return err
}
return nil
return ns.rules.provision(obj.ObjectMeta.UID, nil, rules)
}
func (ns *ns) updateNetworkPolicy(oldObj, newObj *extnapi.NetworkPolicy) error {
@@ -217,11 +210,7 @@ func (ns *ns) updateNetworkPolicy(oldObj, newObj *extnapi.NetworkPolicy) error {
if err := ns.podSelectors.provision(oldObj.ObjectMeta.UID, oldPodSelectors, newPodSelectors); err != nil {
return err
}
if err := ns.rules.provision(oldObj.ObjectMeta.UID, oldRules, newRules); err != nil {
return err
}
return nil
return ns.rules.provision(oldObj.ObjectMeta.UID, oldRules, newRules)
}
func (ns *ns) deleteNetworkPolicy(obj *extnapi.NetworkPolicy) error {
@@ -240,11 +229,7 @@ func (ns *ns) deleteNetworkPolicy(obj *extnapi.NetworkPolicy) error {
if err := ns.nsSelectors.deprovision(obj.ObjectMeta.UID, nsSelectors, nil); err != nil {
return err
}
if err := ns.podSelectors.deprovision(obj.ObjectMeta.UID, podSelectors, nil); err != nil {
return err
}
return nil
return ns.podSelectors.deprovision(obj.ObjectMeta.UID, podSelectors, nil)
}
func bypassRule(nsIpsetName ipset.Name, namespace string) []string {
@@ -0,0 +1,152 @@
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: 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
livenessProbe:
httpGet:
host: 127.0.0.1
path: /status
port: 6784
initialDelaySeconds: 30
resources:
requests:
cpu: 10m
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: 10m
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
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
+3 -11
View File
@@ -50,11 +50,7 @@ func resetIPTables(ipt *iptables.IPTables) error {
return err
}
if err := ipt.ClearChain(npc.TableFilter, npc.MainChain); err != nil {
return err
}
return nil
return ipt.ClearChain(npc.TableFilter, npc.MainChain)
}
func resetIPSets(ips ipset.Interface) error {
@@ -116,12 +112,8 @@ func createBaseRules(ipt *iptables.IPTables, ips ipset.Interface) error {
if err := ips.Create(npc.LocalIpset, ipset.HashIP); err != nil {
return err
}
if err := ipt.Append(npc.TableFilter, npc.MainChain,
"-m", "set", "!", "--match-set", npc.LocalIpset, "dst", "-j", "ACCEPT"); err != nil {
return err
}
return nil
return ipt.Append(npc.TableFilter, npc.MainChain,
"-m", "set", "!", "--match-set", npc.LocalIpset, "dst", "-j", "ACCEPT")
}
func root(cmd *cobra.Command, args []string) {
+1 -2
View File
@@ -20,8 +20,7 @@ func (proxy *Proxy) RewriteEtcHosts(hostsPath, fqdn string, ips []*net.IPNet, ex
contents := buf.String()
cmdLine := fmt.Sprintf("echo '%s' > %s && rm -f %s && echo '%s' > %s", contents, mntHosts, mntHosts, contents, mntHosts)
mounts := []string{hostsPathDir + ":" + mnt}
proxy.runTransientContainer([]string{"sh"}, []string{"-c", cmdLine}, mounts)
return nil
return proxy.runTransientContainer([]string{"sh"}, []string{"-c", cmdLine}, mounts)
}
// we assume (for compatibility with the weave script) that fqdn has a dot
+6 -6
View File
@@ -330,11 +330,7 @@ func copyOwnerAndPermissions(from, to string) error {
return nil
}
if err = os.Chown(to, int(moreStat.Uid), int(moreStat.Gid)); err != nil {
return err
}
return nil
return os.Chown(to, int(moreStat.Uid), int(moreStat.Gid))
}
func (proxy *Proxy) listen(protoAndAddr string) (net.Listener, string, error) {
@@ -510,7 +506,10 @@ func (proxy *Proxy) attach(containerID string) error {
if container.HostConfig != nil {
extraHosts = container.HostConfig.ExtraHosts
}
proxy.RewriteEtcHosts(container.HostsPath, fqdn, ips, extraHosts)
if err := proxy.RewriteEtcHosts(container.HostsPath, fqdn, ips, extraHosts); err != nil {
Log.Errorf("Error from rewriting container's /etc/hosts: %s", err)
// carry on since the original /etc/hosts is good enough in most cases
}
}
pid := container.State.Pid
@@ -684,6 +683,7 @@ func (proxy *Proxy) runTransientContainer(entrypoint, cmd, binds []string) (err
env = append(env, fmt.Sprintf("%s=%s", "WEAVE_DEBUG", val))
}
Log.Debugf("Running image %q; entrypoint=%q; cmd=%q; binds=%q", proxy.Image, entrypoint, fmt.Sprintf("%.72s", cmd), binds)
var container *docker.Container
container, err = proxy.client.CreateContainer(docker.CreateContainerOptions{
Config: &docker.Config{
+1 -1
View File
@@ -32,7 +32,7 @@ You can of course also manually change the IP of any given container or subnet o
### IP Address Notation in Weave
In the IP address `10.4.2.6/8`, the network prefix is the first 8 bits
- `10`. Written out in full, that network is `10.0.0.0/8`.
\- `10`. Written out in full, that network is `10.0.0.0/8`.
The most common prefix lengths are 8, 16 and 24, but there is nothing
stopping you using a /9 network or a /26. For example, `6.250.3.1/9` is on the
+1
View File
@@ -78,3 +78,4 @@ Or to start a container:
* [Integrating Docker via the Network Plugin (Legacy)](/site/install/plugin/plugin.md)
* [How the Weave Network Plugins Work](/site/install/plugin/plugin-how-it-works.md)
* [Troubleshooting the V2 plugin](/site/troubleshooting.md#v2plugin)
+2 -2
View File
@@ -164,7 +164,7 @@ definition](http://kubernetes.io/docs/api-reference/extensions/v1beta1/definitio
all multicast traffic) by adding `--allow-mcast=false` as an
argument to `weave-npc` in the YAML configuration.
## <a name="troubleshooting"></a><a name="troubleshooting"></a> Troubleshooting
## <a name="troubleshooting"></a> Troubleshooting
The status of Weave Net can be checked by running its CLI commands. This can be done in various ways:
@@ -236,7 +236,7 @@ $ kubectl exec -n kube-system weave-net-1jkl6 -c weave -- /home/weave/weave --lo
![Weave Net status screen in Weave Cloud](weave-cloud-net-status.png)
For more information see [What is Weave Cloud?](https://www.weave.works/faq/weave-cloud-faq/)
For more information see [What is Weave Cloud?](https://www.weave.works/docs/cloud/latest/overview/)
### <a name="blocked-connections"></a> Troubleshooting Blocked Connections
+27 -5
View File
@@ -14,6 +14,7 @@ search_type: Documentation
- [List attached containers](#list-attached-containers)
* [Stopping Weave](#stop)
* [Reboots](#reboots)
* [Troubleshooting the V2 plugin](#v2plugin)
* [Snapshot Releases](#snapshots)
## <a name="diagnostics"></a>Basic Diagnostics
@@ -284,11 +285,32 @@ on reboot. This can be disabled via:
weave launch --no-restart
Note that the Weave Net router will create the `weave` network bridge
if necessary when it restarts, and the [Weave Net Docker API
Proxy](/site/tasks/weave-docker-api/weave-docker-api.md) will re-attach any application
containers that it originally attached to the Weave network when they
restart.
Note that the Weave Net router creates the `weave` network bridge if
necessary when it restarts. The [Weave Net Docker API
Proxy](/site/tasks/weave-docker-api/weave-docker-api.md) then
re-attaches any application containers that it originally attached to
the Weave network when they restart.
## <a name="v2plugin"></a>Troubleshooting the V2 plugin
If Weave Net is installed via `docker plugin install`, download the
`weave` script to run `weave status`, `weave ps` or `weave report` as
above. Install Weave Net by following the [install
instructions](/site/install/installing-weave.md).
Docker "v2" plugins do run as containers, but at a lower level within
the Docker environment. Because of this, you cannot view them with
`docker ps`, `docker inspect`, etc.
Do not run `weave launch`, `weave stop` or similar commands when using
this plugin; use the `docker plugin` commands instead. You can run
`weave reset`, but only after disabling the plugin via `docker plugin disable`.
Diagnostic logs from the plugin go to the same place as the Docker
daemon, which will depend on your Linux install. For example, if it
uses `systemd`, then do this to view the Docker and plugin logs:
sudo journalctl -u docker
## <a name="snapshots"></a>Snapshot Releases
+1 -1
View File
@@ -47,7 +47,7 @@ fi
# 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%" \
-e "s%env:%$COVERAGE_ARGS%" \
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.6.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
"$(dirname "$0")/../prog/weave-kube/weave-daemonset-k8s-1.7.yaml" | run_on "$HOST1" "$KUBECTL apply -n kube-system -f -"
sleep 5
Binary file not shown.
+3
View File
@@ -1278,6 +1278,7 @@ launch() {
-e WEAVE_DEBUG \
-e WEAVE_HTTP_ADDR \
-e WEAVE_PASSWORD \
-e EXEC_IMAGE=$EXEC_IMAGE \
-e CHECKPOINT_DISABLE \
$WEAVE_DOCKER_ARGS \
$IMAGE \
@@ -1580,7 +1581,9 @@ case "$COMMAND" in
protect_against_docker_hang
VOLUME_CONTAINERS=$(docker ps -qa --filter label=weavevolumes)
[ -n "$VOLUME_CONTAINERS" ] && docker rm -v $VOLUME_CONTAINERS >/dev/null 2>&1 || true
# weave-kube and v2-plugin put this file in different places; remove either
rm -f $HOST_ROOT/var/lib/weave/weave-netdata.db >/dev/null 2>&1 || true
rm -f $HOST_ROOT/var/lib/weave/weavedata.db >/dev/null 2>&1 || true
destroy_bridge
for LOCAL_IFNAME in $(ip link show | grep v${CONTAINER_IFNAME}pl | cut -d ' ' -f 2 | tr -d ':') ; do
ip link del ${LOCAL_IFNAME%@*} >/dev/null 2>&1 || true