pub fn pods(&self) -> Result<impl Iterator<Item = KafkaPodRef> + '_, NoNamespaceError> {
        let ns = self.metadata.namespace.clone().context(NoNamespaceSnafu)?;
        Ok(self
            .spec
            .brokers
            .iter()
            .flat_map(|role| &role.role_groups)
            // Order rolegroups consistently, to avoid spurious downstream rewrites
            .collect::<BTreeMap<_, _>>()
            .into_iter()
            .flat_map(move |(rolegroup_name, rolegroup)| {
                let rolegroup_ref = self.broker_rolegroup_ref(rolegroup_name);
                let ns = ns.clone();
                (0..rolegroup.replicas.unwrap_or(0)).map(move |i| KafkaPodRef {
                    namespace: ns.clone(),
                    role_group_service_name: rolegroup_ref.object_name(),
                    pod_name: format!("{}-{}", rolegroup_ref.object_name(), i),
                })
            }))
    }
/// List all pods expected to form the cluster
///
/// We try to predict the pods here rather than looking at the current cluster state in order to
/// avoid instance churn.
List all pods expected to form the cluster
We try to predict the pods here rather than looking at the current cluster state in order to
avoid instance churn.
List all pods expected to form the cluster We try to predict the pods here rather than looking at the current cluster state in order to avoid instance churn .
pub fn pods(&self) -> Result<impl Iterator<Item = KafkaPodRef> + '_, NoNamespaceError> {
        let ns = self.metadata.namespace.clone().context(NoNamespaceSnafu)?;
        Ok(self
            .spec
            .brokers
            .iter()
            .flat_map(|role| &role.role_groups)
            // Order rolegroups consistently, to avoid spurious downstream rewrites
            .collect::<BTreeMap<_, _>>()
            .into_iter()
            .flat_map(move |(rolegroup_name, rolegroup)| {
                let rolegroup_ref = self.broker_rolegroup_ref(rolegroup_name);
                let ns = ns.clone();
                (0..rolegroup.replicas.unwrap_or(0)).map(move |i| KafkaPodRef {
                    namespace: ns.clone(),
                    role_group_service_name: rolegroup_ref.object_name(),
                    pod_name: format!("{}-{}", rolegroup_ref.object_name(), i),
                })
            }))
    }
pub fn pods ( & self ) -> Result < impl Iterator < Item = KafkaPodRef > + ' _ , NoNamespaceError > { let ns = self . metadata . namespace . clone ( ) . context ( NoNamespaceSnafu ) ? ; Ok ( self . spec . brokers . iter ( ) . flat_map ( | role | & role . role_groups ) // Order rolegroups consistently, to avoid spurious downstream rewrites . collect :: < BTreeMap < _ , _ > > ( ) . into_iter ( ) . flat_map ( move | ( rolegroup_name , rolegroup ) | { let rolegroup_ref = self . broker_rolegroup_ref ( rolegroup_name ) ; let ns = ns . clone ( ) ; ( 0 .. rolegroup . replicas . unwrap_or ( 0 ) ) . map ( move | i | KafkaPodRef { namespace : ns . clone ( ) , role_group_service_name : rolegroup_ref . object_name ( ) , pod_name : format ! ( " " rolegroup_ref object_name ( ) i ) , } ) } ) ) }
List all pods expected to form the cluster
We try to predict the pods here rather than looking at the current cluster state in order to
avoid instance churn.
List all pods expected to form the cluster We try to predict the pods here rather than looking at the current cluster state in order to avoid instance churn .
&self
&self