Commit 7e050cd7 authored by Michelle Nguyen's avatar Michelle Nguyen
Browse files

Metadata: better handle nil hostname/IP pairs

Summary:
customer is running into an issue where there is a nil hostnameIPPair when we are trying to resolve an endpoints update to the relevant agent.
tracking the hostnameIPPair through the code, it looks like it is nil because we can't find the hostnameIPPair for a given pod in etcd...
unfortunately its hard to say why this info is not in etcd. for now, we can handle it better so that we don't crash, and also log the pod name to see if there's anything unique about this pod.

Test Plan: n/a

Reviewers: zasgar, #engineering

Reviewed By: zasgar, #engineering

Differential Revision: https://phab.corp.pixielabs.ai/D5503

GitOrigin-RevId: de1e92a5ab7c7e519dd90aa1b36d88535a31904b
parent 766cebc2
Showing with 9 additions and 0 deletions
+9 -0
......@@ -268,6 +268,12 @@ func (mh *MetadataHandler) handleEndpointsMetadata(o runtime.Object, eventType w
if err != nil {
continue
}
if hnPair == nil {
log.WithField("podName", addr.TargetRef.Name).WithField("namespace", addr.TargetRef.Namespace).Info("Could not find hostnameIPPair for pod")
continue
}
updatePb := GetNodeResourceUpdateFromEndpoints(pb, hnPair, mh.mds)
mh.subscriberUpdates <- &UpdateMessage{
Hostnames: []*HostnameIPPair{hnPair},
......
......@@ -279,6 +279,9 @@ func (mds *KVMetadataStore) GetAgentsForHostnamePairs(hostnames *[]*HostnameIPPa
agents := []string{}
for _, hn := range *hostnames {
if hn == nil {
continue
}
resp, err := mds.cache.Get(GetHostnamePairAgentKey(hn))
if err != nil {
continue
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment