@@ -5,8 +5,8 @@ use ark_core_k8s::manager::Manager;
55use async_trait:: async_trait;
66use chrono:: Utc ;
77use dash_api:: {
8+ function:: { FunctionCrd , FunctionSpec , FunctionState , FunctionStatus } ,
89 model:: ModelFieldsNativeSpec ,
9- pipe:: { PipeCrd , PipeSpec , PipeState , PipeStatus } ,
1010} ;
1111use kube:: {
1212 api:: { Patch , PatchParams } ,
@@ -16,14 +16,14 @@ use kube::{
1616use serde_json:: json;
1717use tracing:: { info, warn} ;
1818
19- use crate :: validator:: pipe :: PipeValidator ;
19+ use crate :: validator:: function :: FunctionValidator ;
2020
2121#[ derive( Default ) ]
2222pub struct Ctx { }
2323
2424#[ async_trait]
2525impl :: ark_core_k8s:: manager:: Ctx for Ctx {
26- type Data = PipeCrd ;
26+ type Data = FunctionCrd ;
2727
2828 const NAME : & ' static str = crate :: consts:: NAME ;
2929 const NAMESPACE : & ' static str = :: dash_api:: consts:: NAMESPACE ;
@@ -45,24 +45,24 @@ impl ::ark_core_k8s::manager::Ctx for Ctx {
4545 . map ( |status| status. state )
4646 . unwrap_or_default ( )
4747 {
48- PipeState :: Pending => {
49- let validator = PipeValidator {
48+ FunctionState :: Pending => {
49+ let validator = FunctionValidator {
5050 namespace : & namespace,
5151 kube : & manager. kube ,
5252 } ;
53- match validator. validate_pipe ( data. spec . clone ( ) ) . await {
53+ match validator. validate_function ( data. spec . clone ( ) ) . await {
5454 Ok ( spec) => {
5555 Self :: update_spec_or_requeue ( & namespace, & manager. kube , & name, spec) . await
5656 }
5757 Err ( e) => {
58- warn ! ( "failed to validate pipe : {name:?}: {e}" ) ;
58+ warn ! ( "failed to validate function : {name:?}: {e}" ) ;
5959 Ok ( Action :: requeue (
6060 <Self as :: ark_core_k8s:: manager:: Ctx >:: FALLBACK ,
6161 ) )
6262 }
6363 }
6464 }
65- PipeState :: Ready => {
65+ FunctionState :: Ready => {
6666 // TODO: implement to finding changes
6767 Ok ( Action :: await_change ( ) )
6868 }
@@ -75,17 +75,17 @@ impl Ctx {
7575 namespace : & str ,
7676 kube : & Client ,
7777 name : & str ,
78- spec : PipeSpec < ModelFieldsNativeSpec > ,
78+ spec : FunctionSpec < ModelFieldsNativeSpec > ,
7979 ) -> Result < Action , Error > {
8080 match Self :: update_spec ( namespace, kube, name, spec) . await {
8181 Ok ( ( ) ) => {
82- info ! ( "pipe is ready: {namespace}/{name}" ) ;
82+ info ! ( "function is ready: {namespace}/{name}" ) ;
8383 Ok ( Action :: requeue (
8484 <Self as :: ark_core_k8s:: manager:: Ctx >:: FALLBACK ,
8585 ) )
8686 }
8787 Err ( e) => {
88- warn ! ( "failed to update pipe state ({namespace}/{name}): {e}" ) ;
88+ warn ! ( "failed to update function state ({namespace}/{name}): {e}" ) ;
8989 Ok ( Action :: requeue (
9090 <Self as :: ark_core_k8s:: manager:: Ctx >:: FALLBACK ,
9191 ) )
@@ -97,7 +97,7 @@ impl Ctx {
9797 namespace : & str ,
9898 kube : & Client ,
9999 name : & str ,
100- spec : PipeSpec < ModelFieldsNativeSpec > ,
100+ spec : FunctionSpec < ModelFieldsNativeSpec > ,
101101 ) -> Result < ( ) > {
102102 let api = Api :: < <Self as :: ark_core_k8s:: manager:: Ctx >:: Data > :: namespaced (
103103 kube. clone ( ) ,
@@ -108,8 +108,8 @@ impl Ctx {
108108 let patch = Patch :: Merge ( json ! ( {
109109 "apiVersion" : crd. api_version,
110110 "kind" : crd. kind,
111- "status" : PipeStatus {
112- state: PipeState :: Ready ,
111+ "status" : FunctionStatus {
112+ state: FunctionState :: Ready ,
113113 spec: Some ( spec) ,
114114 last_updated: Utc :: now( ) ,
115115 } ,
0 commit comments