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)


BR

Keon
_______________________________________________
Mailing list: http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack
Post to     : openstack@lists.openstack.org
Unsubscribe : http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack

Reply via email to