'Reads a list of kube events, invalidates caches and and computes a set
of pods impacted by the changes, to refresh service discovery'

def process_events(self, event_array):

    pod_uids = set()
    service_cache_checked = False
    if self._403_disable:
        return pod_uids
    for event in event_array:
        kind = event.get('involvedObject', {}).get('kind', None)
        reason = event.get('reason', None)
        if ((kind == 'Pod') and (reason == 'Killing')):
            pod_id = event.get('involvedObject', {}).get('uid', None)
            if (pod_id in self._pod_labels_cache):
                del self._pod_labels_cache[pod_id]
            if (pod_id in self._pod_services_mapping):
                del self._pod_services_mapping[pod_id]
        elif (kind == 'Service'):
            service_uid = event.get('involvedObject', {}).get('uid', None)
            if (service_cache_checked is False):
                self._service_cache_invalidated = True
                service_cache_checked = True
            if (reason == 'DeletedLoadBalancer'):
                for (pod, services) in self._pod_services_mapping.iteritems():
                    if (service_uid in services):
                        services.remove(service_uid)
                        pod_uids.add(pod)
            elif ((reason == 'CreatedLoadBalancer') or (reason == 'UpdatedLoadBalancer')):
                for pod in self.search_pods_for_service(service_uid):
                    if ((pod in self._pod_services_mapping) and (service_uid not in self._pod_services_mapping[pod])):
                        self._pod_services_mapping[pod].append(service_uid)
                        pod_uids.add(pod)
    return pod_uids
