• 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
..
admission Loading commit data...
api Loading commit data...
apimachinery Loading commit data...
apis Loading commit data...
apiserver Loading commit data...
auth Loading commit data...
capabilities Loading commit data...
client Loading commit data...
cloudprovider Loading commit data...
controller Loading commit data...
conversion Loading commit data...
credentialprovider Loading commit data...
dns Loading commit data...
fieldpath Loading commit data...
fields Loading commit data...
genericapiserver Loading commit data...
healthz Loading commit data...
httplog Loading commit data...
hyperkube Loading commit data...
kubectl Loading commit data...
kubelet Loading commit data...
kubemark Loading commit data...
labels Loading commit data...
master Loading commit data...
metrics Loading commit data...
probe Loading commit data...
proxy Loading commit data...
quota Loading commit data...
registry Loading commit data...
runtime Loading commit data...
security Loading commit data...
securitycontext Loading commit data...
serviceaccount Loading commit data...
ssh Loading commit data...
storage Loading commit data...
types Loading commit data...
ui Loading commit data...
util Loading commit data...
version Loading commit data...
volume Loading commit data...
watch Loading commit data...
OWNERS Loading commit data...