fn get_pod_info()

in nfm-controller/src/kubernetes/kubernetes_metadata_collector.rs [350:365]


    fn get_pod_info<'a>(
        pod_info: &'a HashMap<IpAddr, HashMap<i32, PodInfo>>,
        address: &'a IpAddr,
    ) -> Option<&'a HashMap<i32, PodInfo>> {
        let mut pod_data = pod_info.get(address);
        if pod_data.is_none() {
            // there can be cases where reported IPs are IPv4 adresses wrapped with IPv6
            // for example "::ffff:100.64.38.124". Try to extract the underlying IPv4 for that case
            if let IpAddr::V6(ipv6) = address {
                if let Some(ipv4) = ipv6.to_ipv4_mapped() {
                    pod_data = pod_info.get(&IpAddr::V4(ipv4));
                }
            }
        }
        pod_data
    }