async fn apply_spu_load_balancers(
        &self,
        spg_obj: &SpuGroupObj,
        spg_spec: &SpuGroupSpec,
        spu_name: &str,
    ) -> Result<ApplyResult<ServiceSpec, ServiceStatus>, ClientError> {
        let metadata = &spg_obj.metadata;

        let spu_template = &spg_spec.template.spec;
        let mut public_port = ServicePort {
            port: spu_template
                .public_endpoint
                .as_ref()
                .map(|t| t.port)
                .unwrap_or(SPU_PUBLIC_PORT),
            ..Default::default()
        };
        public_port.target_port = Some(public_port.port);

        let mut selector = HashMap::new();
        let pod_name = format!("flv-spg-{}", spu_name);
        selector.insert("statefulset.kubernetes.io/pod-name".to_owned(), pod_name);

        let service_spec = ServiceSpec {
            r#type: Some(LoadBalancerType::LoadBalancer),
            external_traffic_policy: Some(ExternalTrafficPolicy::Local),
            selector: Some(selector),
            ports: vec![public_port.clone()],
            ..Default::default()
        };
        let owner_ref = metadata.make_owner_reference::<ServiceSpec>();

        let svc_name = format!("flv-spu-{}", spu_name);

        let input_service: InputK8Obj<ServiceSpec> = InputK8Obj {
            api_version: ServiceSpec::api_version(),
            kind: ServiceSpec::kind(),
            metadata: InputObjectMeta {
                name: svc_name,
                namespace: metadata.namespace().to_string(),
                owner_references: vec![owner_ref],
                ..Default::default()
            }
            .set_labels(vec![("fluvio.io/spu-name", spu_name)]),
            spec: service_spec,
            ..Default::default()
        };

        debug!("spu '{}': enable external services", spu_name);

        self.client.apply(input_service).await
    }
/// Apply external svc for each SPU
/// This is owned by group svc
Apply external svc for each SPU
This is owned by group svc
Apply external svc for each SPU This is owned by group svc
async fn apply_spu_load_balancers(
        &self,
        spg_obj: &SpuGroupObj,
        spg_spec: &SpuGroupSpec,
        spu_name: &str,
    ) -> Result<ApplyResult<ServiceSpec, ServiceStatus>, ClientError> {
        let metadata = &spg_obj.metadata;
        let spu_template = &spg_spec.template.spec;
        let mut public_port = ServicePort {
            port: spu_template
                .public_endpoint
                .as_ref()
                .map(|t| t.port)
                .unwrap_or(SPU_PUBLIC_PORT),
            ..Default::default()
        };
        public_port.target_port = Some(public_port.port);
        let mut selector = HashMap::new();
        let pod_name = format!("flv-spg-{}", spu_name);
        selector.insert("statefulset.kubernetes.io/pod-name".to_owned(), pod_name);
        let service_spec = ServiceSpec {
            r#type: Some(LoadBalancerType::LoadBalancer),
            external_traffic_policy: Some(ExternalTrafficPolicy::Local),
            selector: Some(selector),
            ports: vec![public_port.clone()],
            ..Default::default()
        };
        let owner_ref = metadata.make_owner_reference::<ServiceSpec>();
        let svc_name = format!("flv-spu-{}", spu_name);
        let input_service: InputK8Obj<ServiceSpec> = InputK8Obj {
            api_version: ServiceSpec::api_version(),
            kind: ServiceSpec::kind(),
            metadata: InputObjectMeta {
                name: svc_name,
                namespace: metadata.namespace().to_string(),
                owner_references: vec![owner_ref],
                ..Default::default()
            }
            .set_labels(vec![("fluvio.io/spu-name", spu_name)]),
            spec: service_spec,
            ..Default::default()
        };
        debug!("spu '{}': enable external services", spu_name);
        self.client.apply(input_service).await
    }
async fn apply_spu_load_balancers ( & self , spg_obj : & SpuGroupObj , spg_spec : & SpuGroupSpec , spu_name : & str , ) -> Result < ApplyResult < ServiceSpec , ServiceStatus > , ClientError > { let metadata = & spg_obj . metadata ; let spu_template = & spg_spec . template . spec ; let mut public_port = ServicePort { port : spu_template . public_endpoint . as_ref ( ) . map ( | t | t . port ) . unwrap_or ( SPU_PUBLIC_PORT ) , .. Default :: default ( ) } ; public_port . target_port = Some ( public_port . port ) ; let mut selector = HashMap :: new ( ) ; let pod_name = format ! ( " " spu_name ) ; selector . insert ( " " . to_owned ( ) , pod_name ) ; let service_spec = ServiceSpec { r#type : Some ( LoadBalancerType :: LoadBalancer ) , external_traffic_policy : Some ( ExternalTrafficPolicy :: Local ) , selector : Some ( selector ) , ports : vec ! [ public_port clone ( ) ] , .. Default :: default ( ) } ; let owner_ref = metadata . make_owner_reference :: < ServiceSpec > ( ) ; let svc_name = format ! ( " " spu_name ) ; let input_service : InputK8Obj < ServiceSpec > = InputK8Obj { api_version : ServiceSpec :: api_version ( ) , kind : ServiceSpec :: kind ( ) , metadata : InputObjectMeta { name : svc_name , namespace : metadata . namespace ( ) . to_string ( ) , owner_references : vec ! [ owner_ref ] , .. Default :: default ( ) } . set_labels ( vec ! [ ( " " spu_name ) ] ) , spec : service_spec , .. Default :: default ( ) } ; debug ! ( " " spu_name ) ; self . client . apply ( input_service ) . await }
Apply external svc for each SPU
This is owned by group svc
Apply external svc for each SPU This is owned by group svc
&self
spg_obj
&SpuGroupObj
spg_spec
&SpuGroupSpec
spu_name
&str
&self
spg_obj
&SpuGroupObj
spg_spec
&SpuGroupSpec
spu_name
&str