[Openstack] [openstack-dev][kuryr] kuryr-cni watch question

Keon Tang ikeontang at gmail.com
Thu Aug 31 23:09:04 UTC 2017

Hi,  all

I have one question about kuryr-cni watch for pod.

Kuryr-k8s-controller will watch pod resource, if founded, then it will request resource from neutron, and annotation the pod object.

Kuryr-cni will watch the pod, if the metadata of the pod changed, then it will create pod network on host computer.

Then my question is: Before kuryr-cni starting to watch the pod, Kuryr-k8s-controller have annotated the pod, does it mean kuryr-cni will not get the changing event forever?

class K8sClient(object):

    def watch(self, path):
        params = {'watch': 'true'}
        url = self._base_url + path
        header = {}
        if self.token:
            header.update({'Authorization': 'Bearer %s' % self.token})

        # TODO(ivc): handle connection errors and retry on failure
        while True:
            with contextlib.closing(
                    requests.get(url, params=params, stream=True,
                                 cert=self.cert, verify=self.verify_server,
                                 headers=header)) as response:
                if not response.ok:
                    raise exc.K8sClientException(response.text)
                for line in response.iter_lines(delimiter='\n'):
                    line = line.strip()
                    if line:
                        yield jsonutils.loads(line)


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstack.org/pipermail/openstack/attachments/20170901/b7169713/attachment.html>

More information about the Openstack mailing list