• k8s-merge-robot's avatar
    Merge pull request #26398 from euank/various-kubenet-fixes · 98af4432
    k8s-merge-robot authored
    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 
    98af4432
Name
Last commit
Last update
.github Loading commit data...
Godeps Loading commit data...
api/swagger-spec Loading commit data...
build Loading commit data...
cluster Loading commit data...
cmd Loading commit data...
contrib Loading commit data...
docs Loading commit data...
examples Loading commit data...
federation Loading commit data...
hack Loading commit data...
hooks Loading commit data...
logo Loading commit data...
pkg Loading commit data...
plugin Loading commit data...
release Loading commit data...
test Loading commit data...
third_party Loading commit data...
vendor Loading commit data...
www Loading commit data...
.generated_docs Loading commit data...
.gitignore Loading commit data...
.travis.yml Loading commit data...
CHANGELOG.md Loading commit data...
CONTRIB.md Loading commit data...
CONTRIBUTING.md Loading commit data...
DESIGN.md Loading commit data...
LICENSE Loading commit data...
Makefile Loading commit data...
README.md Loading commit data...
Vagrantfile Loading commit data...
code-of-conduct.md Loading commit data...