kubernetes/pkg/kubelet/network
k8s-merge-robot 98af443209 Merge pull request #26398 from euank/various-kubenet-fixes
Automatic merge from submit-queue

Various kubenet fixes (panics and bugs and cidrs, oh my)

This PR fixes the following issues:

1. Corrects an inverse error-check that prevented `shaper.Reset` from ever being called with a correct ip address
2. Fix an issue where `parseCIDR` would fail after a kubelet restart due to an IP being stored instead of a CIDR being stored in the cache.
3. Fix an issue where kubenet could panic in TearDownPod if it was called before SetUpPod (e.g. after a kubelet restart).. because of bug number 1, this didn't happen except in rare situations (see 2 for why such a rare situation might happen)

This adds a test, but more would definitely be useful.
The commits are also granular enough I could split this up more if desired.

I'm also not super-familiar with this code, so review and feedback would be welcome.

Testing done:
```
$ cat examples/egress/egress.yml
 apiVersion: v1
kind: Pod
metadata:
  labels:
    name: egress
  name: egress-output
  annotations: {"kubernetes.io/ingress-bandwidth": "300k"}
spec:
  restartPolicy: Never
  containers:
    - name: egress
      image: busybox
      command: ["sh", "-c", "sleep 60"]
$ cat kubelet.log
...
Running: tc filter add dev cbr0 protocol ip parent 1:0 prio 1 u32 match ip dst 10.0.0.5/32 flowid 1:1
# setup
...
Running: tc filter del dev cbr0 parent 1:proto ip prio 1 handle 800::800 u32
# teardown
```

I also did various other bits of manual testing and logging to hunt down the panic and other issues, but don't have anything to paste for that 

cc @dcbw @kubernetes/sig-network
2016-05-29 04:04:22 -07:00
..
cni kubenet: Fix bug where shaper.Reset wasn't called 2016-05-27 10:20:43 -07:00
exec kubenet: set bridge promiscuous mode based on hairpinMode 2016-05-12 10:02:33 -05:00
hairpin Allow using netns path instead of container PID to change hairpin mode 2016-05-18 09:25:42 -05:00
kubenet kubenet: Fix ipv4 validity check 2016-05-27 16:25:14 -07:00
mock_network networkplugins: Add mock network plugin 2016-05-25 10:07:54 -07:00
testing Move test-only files to test-only packages 2016-03-01 09:11:32 -08:00
network.go Use the default interface for reporting network stats. 2016-03-01 16:17:04 -08:00
plugins_test.go kubenet: set bridge promiscuous mode based on hairpinMode 2016-05-12 10:02:33 -05:00
plugins.go Make IsValidLabelValue return error strings 2016-05-17 21:36:10 -07:00