fn field_map(pod: &Pod) -> HashMap<String, String> {
    let mut map = HashMap::new();
    map.insert(
        "metadata.name".into(),
        pod.metadata
            .clone()
            .unwrap_or_default()
            .name
            .unwrap_or_default(),
    );
    map.insert(
        "metadata.namespace".into(),
        pod.metadata
            .clone()
            .unwrap_or_default()
            .namespace
            .unwrap_or_else(|| "default".into()),
    );
    map.insert(
        "spec.serviceAccountName".into(),
        pod.spec
            .clone()
            .unwrap_or_default()
            .service_account_name
            .unwrap_or_default(),
    );
    map.insert(
        "status.hostIP".into(),
        pod.status
            .as_ref()
            .expect("spec must be set")
            .host_ip
            .clone()
            .unwrap_or_default(),
    );
    map.insert(
        "status.podIP".into(),
        pod.status
            .as_ref()
            .expect("spec must be set")
            .pod_ip
            .clone()
            .unwrap_or_default(),
    );
    pod.metadata
        .clone()
        .unwrap_or_default()
        .labels
        .unwrap_or_default()
        .iter()
        .for_each(|(k, v)| {
            info!("adding {} to labels", k);
            map.insert(format!("metadata.labels.{}", k), v.into());
        });
    pod.metadata
        .clone()
        .unwrap_or_default()
        .annotations
        .unwrap_or_default()
        .iter()
        .for_each(|(k, v)| {
            map.insert(format!("metadata.annotations.{}", k), v.into());
        });
    map
}
/// Build the map of allowable field_ref values.
///
/// The Downward API only supports a small selection of fields. This
/// provides those fields.
Build the map of allowable field_ref values.
The Downward API only supports a small selection of fields. This
provides those fields.
Build the map of allowable field_ref values . The Downward API only supports a small selection of fields . This provides those fields .
fn field_map(pod: &Pod) -> HashMap<String, String> {
    let mut map = HashMap::new();
    map.insert(
        "metadata.name".into(),
        pod.metadata
            .clone()
            .unwrap_or_default()
            .name
            .unwrap_or_default(),
    );
    map.insert(
        "metadata.namespace".into(),
        pod.metadata
            .clone()
            .unwrap_or_default()
            .namespace
            .unwrap_or_else(|| "default".into()),
    );
    map.insert(
        "spec.serviceAccountName".into(),
        pod.spec
            .clone()
            .unwrap_or_default()
            .service_account_name
            .unwrap_or_default(),
    );
    map.insert(
        "status.hostIP".into(),
        pod.status
            .as_ref()
            .expect("spec must be set")
            .host_ip
            .clone()
            .unwrap_or_default(),
    );
    map.insert(
        "status.podIP".into(),
        pod.status
            .as_ref()
            .expect("spec must be set")
            .pod_ip
            .clone()
            .unwrap_or_default(),
    );
    pod.metadata
        .clone()
        .unwrap_or_default()
        .labels
        .unwrap_or_default()
        .iter()
        .for_each(|(k, v)| {
            info!("adding {} to labels", k);
            map.insert(format!("metadata.labels.{}", k), v.into());
        });
    pod.metadata
        .clone()
        .unwrap_or_default()
        .annotations
        .unwrap_or_default()
        .iter()
        .for_each(|(k, v)| {
            map.insert(format!("metadata.annotations.{}", k), v.into());
        });
    map
}
fn field_map ( pod : & Pod ) -> HashMap < String , String > { let mut map = HashMap :: new ( ) ; map . insert ( " " . into ( ) , pod . metadata . clone ( ) . unwrap_or_default ( ) . name . unwrap_or_default ( ) , ) ; map . insert ( " " . into ( ) , pod . metadata . clone ( ) . unwrap_or_default ( ) . namespace . unwrap_or_else ( | | " " . into ( ) ) , ) ; map . insert ( " " . into ( ) , pod . spec . clone ( ) . unwrap_or_default ( ) . service_account_name . unwrap_or_default ( ) , ) ; map . insert ( " " . into ( ) , pod . status . as_ref ( ) . expect ( " " ) . host_ip . clone ( ) . unwrap_or_default ( ) , ) ; map . insert ( " " . into ( ) , pod . status . as_ref ( ) . expect ( " " ) . pod_ip . clone ( ) . unwrap_or_default ( ) , ) ; pod . metadata . clone ( ) . unwrap_or_default ( ) . labels . unwrap_or_default ( ) . iter ( ) . for_each ( | ( k , v ) | { info ! ( " " k ) ; map . insert ( format ! ( " " k ) , v . into ( ) ) ; } ) ; pod . metadata . clone ( ) . unwrap_or_default ( ) . annotations . unwrap_or_default ( ) . iter ( ) . for_each ( | ( k , v ) | { map . insert ( format ! ( " " k ) , v . into ( ) ) ; } ) ; map }
Build the map of allowable field_ref values.
Build the map of allowable field_ref values .
pod
&Pod
pod
&Pod