{"action":"created","issue":{"url":"https://api.github.com/repos/projectcalico/libcalico/issues/189","repository_url":"https://api.github.com/repos/projectcalico/libcalico","labels_url":"https://api.github.com/repos/projectcalico/libcalico/issues/189/labels{/name}","comments_url":"https://api.github.com/repos/projectcalico/libcalico/issues/189/comments","events_url":"https://api.github.com/repos/projectcalico/libcalico/issues/189/events","html_url":"https://github.com/projectcalico/libcalico/issues/189","id":251844526,"number":189,"title":"add support for the workloadendpoint.active_instance_id field","user":{"login":"rrayst","id":508061,"avatar_url":"https://avatars3.githubusercontent.com/u/508061?v=4","gravatar_id":"","url":"https://api.github.com/users/rrayst","html_url":"https://github.com/rrayst","followers_url":"https://api.github.com/users/rrayst/followers","following_url":"https://api.github.com/users/rrayst/following{/other_user}","gists_url":"https://api.github.com/users/rrayst/gists{/gist_id}","starred_url":"https://api.github.com/users/rrayst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rrayst/subscriptions","organizations_url":"https://api.github.com/users/rrayst/orgs","repos_url":"https://api.github.com/users/rrayst/repos","events_url":"https://api.github.com/users/rrayst/events{/privacy}","received_events_url":"https://api.github.com/users/rrayst/received_events","type":"User","site_admin":false},"labels":[{"id":443864498,"url":"https://api.github.com/repos/projectcalico/libcalico/labels/priority/P1","name":"priority/P1","color":"FF8800","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-08-22T05:47:17Z","updated_at":"2017-09-12T00:43:42Z","closed_at":null,"author_association":"NONE","body":"The ```workloadendpoint.active_instance_id``` field was introduced in libcalico-go (https://github.com/projectcalico/libcalico-go/pull/396) to fix https://github.com/projectcalico/cni-plugin/issues/310 .\r\nCurrently, libcalico-go has the field, libcalico doesn't.\r\n\r\nWe should also add it to libcalico.\r\n\r\n## Expected Behavior\r\nRun calico-policy-controller and the cni-plugin e.g. on a three-node Kubernetes cluster. \r\nDelete a pod and immediately recreate it with the same name and schedule it on the same host (which is, what StatefulSets do when their pods vanish; scheduling to the same host can happen).\r\nThe newly created pod should have network connectivity.\r\n\r\n## Current Behavior\r\nThe newly created pod looses network connectivity after ~30 seconds.\r\n\r\nThis is due to these inner workings:\r\nWhen creating the new pod, Kuberenetes calls the cni-plugin with ```CNI_COMMAND=ADD``` and ```CNI_CONTAINERID=...the new pod's id...``` . The cni-plugin writes a workloadendpoint into etcd with the active_instance_id field set to the new pod's ID.\r\nThe calico-policy-controller updates the workloadendpoint (~after 2 seconds), effectively removing the active_instance_id field.\r\nAfter ~30 seconds, the cni-plugin gets ```CNI_COMMAND=DEL``` call from Kubernetes with ```CNI_CONTAINERID=..the old pod's id...```. As the active_instance_id field is gone from etcd, the cni-plugin deletes the new pod's network connectivity.\r\n\r\nTo summarize: As calico-policy-controller removes the active_instance_id field from workloadendpoints when updating them, the effects described in https://github.com/projectcalico/cni-plugin/issues/310 reappear.\r\n\r\n## Possible Solution\r\nAdding the ```workloadendpoint.active_instance_id``` field to libcalico fixes this behavior."},"comment":{"url":"https://api.github.com/repos/projectcalico/libcalico/issues/comments/328698077","html_url":"https://github.com/projectcalico/libcalico/issues/189#issuecomment-328698077","issue_url":"https://api.github.com/repos/projectcalico/libcalico/issues/189","id":328698077,"user":{"login":"caseydavenport","id":1944093,"avatar_url":"https://avatars3.githubusercontent.com/u/1944093?v=4","gravatar_id":"","url":"https://api.github.com/users/caseydavenport","html_url":"https://github.com/caseydavenport","followers_url":"https://api.github.com/users/caseydavenport/followers","following_url":"https://api.github.com/users/caseydavenport/following{/other_user}","gists_url":"https://api.github.com/users/caseydavenport/gists{/gist_id}","starred_url":"https://api.github.com/users/caseydavenport/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caseydavenport/subscriptions","organizations_url":"https://api.github.com/users/caseydavenport/orgs","repos_url":"https://api.github.com/users/caseydavenport/repos","events_url":"https://api.github.com/users/caseydavenport/events{/privacy}","received_events_url":"https://api.github.com/users/caseydavenport/received_events","type":"User","site_admin":false},"created_at":"2017-09-12T00:43:42Z","updated_at":"2017-09-12T00:43:42Z","author_association":"OWNER","body":"@rrayst the golang code was merged to master today: https://github.com/projectcalico/k8s-policy\r\n\r\nIt's still hardening so there are likely to be bugs yet.   Feel free to try it out with the `calico/kube-policy-controller:master` tag"}}
{"actor":{"display_login":"caseydavenport"}}