kubenetworks/kubevpn

shut down local pc without kubevpn leave deployments/xx, the next time kubevpn proxy deployments/xx (same header) won't work properly

kyr1eeee opened this issue · 3 comments

this is my situation:

  1. I run this command:
    kubevpn proxy deployments/test-c3004 --headers name=kk.
    And my local tun ip is 223.254.0.101, pod's req can be proxy to my local pc successfully.
  2. I forgot to run command:
    kubevpn leave deployments/test-c3004.
    And I shut down my pc.
  3. I reboot my pc and run kubevpn command:
    kubevpn proxy deployments/test-c3004 --headers name=kk.
    it shows that my local tun ip turns to 223.254.0.103, and the ENVOY_CONFIG has two rules:
ENVOY_CONFIG:
----
- Ports:
  - containerPort: 8003
    protocol: TCP
  Rules:
  - Headers:
      name: kk
    LocalTunIPv4: 223.254.0.101
    LocalTunIPv6: efff:ffff:ffff:ffff:ffff:ffff:ffff:999a
  - Headers:
      name: kk
    LocalTunIPv4: 223.254.0.103
    LocalTunIPv6: efff:ffff:ffff:ffff:ffff:ffff:ffff:999c
  Uid: deployments.apps.test-c3004

when i request for the pod with headers name:kk, it's a failure.
And i checked the envoy log, find out that envoy sidecar choose the "old cluster" 223.254.0.101:8003 which is not available.

So i wonder if the "pkg/handler/envoy.go:addEnvoyConfig" func could be optimized. when headers is same, rule shoule be updated instead of append?

Yes, it is a good idea to optimize it. it is so clear, i will fix it as soon as possible. Thank a lot ~

This issue is solved by commit 156ee99 . You can download latest version v2.2.1 to have a try. link

Yes, it's good now. So efficent!