async fn apply_spu(
        &self,
        k8_group: &SpuGroupObj,
        group_spec: &SpuGroupSpec,
        group_name: &str,
        spu_name: &str,
        _replica_index: u16,
        spu_id: SpuId,
    ) {
        let k8_metadata = &k8_group.metadata;
        let k8_namespace = k8_metadata.namespace();
        let spu_template = &group_spec.template.spec;

        let spu_private_ep = if let Some(ref ep) = &spu_template.private_endpoint {
            ep.clone()
        } else {
            SpuEndpointTemplate::default_private()
        };
        let spu_public_ep = if let Some(ref ep) = &spu_template.public_endpoint {
            ep.clone()
        } else {
            SpuEndpointTemplate::default_public()
        };

        let full_group_name = format!("flv-spg-{}", group_name);
        let full_spu_name = format!("flv-spg-{}", spu_name);
        let spu_spec = K8SpuSpec {
            spu_id: spu_id,
            spu_type: Some(K8SpuType::Managed),
            public_endpoint: K8IngressPort {
                port: spu_public_ep.port,
                encryption: spu_public_ep.encryption,
                ingress: vec![],
            },
            private_endpoint: K8Endpoint {
                host: format!("{}.{}", full_spu_name, full_group_name),
                port: spu_private_ep.port,
                encryption: spu_private_ep.encryption,
            },
            rack: None,
        };

        let owner_ref = k8_metadata.make_owner_reference::<SpuGroupSpec>();
        let input_spu: InputK8Obj<K8SpuSpec> = InputK8Obj {
            api_version: K8SpuSpec::api_version(),
            kind: K8SpuSpec::kind(),
            metadata: InputObjectMeta {
                name: spu_name.to_string(),
                namespace: k8_namespace.to_owned(),
                owner_references: vec![owner_ref],
                ..Default::default()
            },
            spec: spu_spec,
            ..Default::default()
        };

        debug!("spu '{}': apply changes", spu_name);

        if let Err(err) = self.client.apply(input_spu).await {
            error!("spu '{}': {}", spu_name, err);
        }
    }
/// create SPU crd objects from cluster spec
create SPU crd objects from cluster spec
create SPU crd objects from cluster spec
async fn apply_spu(
        &self,
        k8_group: &SpuGroupObj,
        group_spec: &SpuGroupSpec,
        group_name: &str,
        spu_name: &str,
        _replica_index: u16,
        spu_id: SpuId,
    ) {
        let k8_metadata = &k8_group.metadata;
        let k8_namespace = k8_metadata.namespace();
        let spu_template = &group_spec.template.spec;
        let spu_private_ep = if let Some(ref ep) = &spu_template.private_endpoint {
            ep.clone()
        } else {
            SpuEndpointTemplate::default_private()
        };
        let spu_public_ep = if let Some(ref ep) = &spu_template.public_endpoint {
            ep.clone()
        } else {
            SpuEndpointTemplate::default_public()
        };
        let full_group_name = format!("flv-spg-{}", group_name);
        let full_spu_name = format!("flv-spg-{}", spu_name);
        let spu_spec = K8SpuSpec {
            spu_id: spu_id,
            spu_type: Some(K8SpuType::Managed),
            public_endpoint: K8IngressPort {
                port: spu_public_ep.port,
                encryption: spu_public_ep.encryption,
                ingress: vec![],
            },
            private_endpoint: K8Endpoint {
                host: format!("{}.{}", full_spu_name, full_group_name),
                port: spu_private_ep.port,
                encryption: spu_private_ep.encryption,
            },
            rack: None,
        };
        let owner_ref = k8_metadata.make_owner_reference::<SpuGroupSpec>();
        let input_spu: InputK8Obj<K8SpuSpec> = InputK8Obj {
            api_version: K8SpuSpec::api_version(),
            kind: K8SpuSpec::kind(),
            metadata: InputObjectMeta {
                name: spu_name.to_string(),
                namespace: k8_namespace.to_owned(),
                owner_references: vec![owner_ref],
                ..Default::default()
            },
            spec: spu_spec,
            ..Default::default()
        };
        debug!("spu '{}': apply changes", spu_name);
        if let Err(err) = self.client.apply(input_spu).await {
            error!("spu '{}': {}", spu_name, err);
        }
    }
async fn apply_spu ( & self , k8_group : & SpuGroupObj , group_spec : & SpuGroupSpec , group_name : & str , spu_name : & str , _replica_index : u16 , spu_id : SpuId , ) { let k8_metadata = & k8_group . metadata ; let k8_namespace = k8_metadata . namespace ( ) ; let spu_template = & group_spec . template . spec ; let spu_private_ep = if let Some ( ref ep ) = & spu_template . private_endpoint { ep . clone ( ) } else { SpuEndpointTemplate :: default_private ( ) } ; let spu_public_ep = if let Some ( ref ep ) = & spu_template . public_endpoint { ep . clone ( ) } else { SpuEndpointTemplate :: default_public ( ) } ; let full_group_name = format ! ( " " group_name ) ; let full_spu_name = format ! ( " " spu_name ) ; let spu_spec = K8SpuSpec { spu_id : spu_id , spu_type : Some ( K8SpuType :: Managed ) , public_endpoint : K8IngressPort { port : spu_public_ep . port , encryption : spu_public_ep . encryption , ingress : vec ! [ ] , } , private_endpoint : K8Endpoint { host : format ! ( " " full_spu_name full_group_name ) , port : spu_private_ep . port , encryption : spu_private_ep . encryption , } , rack : None , } ; let owner_ref = k8_metadata . make_owner_reference :: < SpuGroupSpec > ( ) ; let input_spu : InputK8Obj < K8SpuSpec > = InputK8Obj { api_version : K8SpuSpec :: api_version ( ) , kind : K8SpuSpec :: kind ( ) , metadata : InputObjectMeta { name : spu_name . to_string ( ) , namespace : k8_namespace . to_owned ( ) , owner_references : vec ! [ owner_ref ] , .. Default :: default ( ) } , spec : spu_spec , .. Default :: default ( ) } ; debug ! ( " " spu_name ) ; if let Err ( err ) = self . client . apply ( input_spu ) . await { error ! ( " " spu_name err ) ; } }
create SPU crd objects from cluster spec
create SPU crd objects from cluster spec
&self
k8_group
&SpuGroupObj
group_spec
&SpuGroupSpec
group_name
&str
spu_name
&str
_replica_index
u16
spu_id
SpuId
&self
k8_group
&SpuGroupObj
group_spec
&SpuGroupSpec
group_name
&str
spu_name
&str
_replica_index
u16
spu_id
SpuId