@@ -14,8 +14,6 @@ use crate::epsilon::server::state::EpsilonState;
14
14
use crate :: epsilon:: server:: template:: Template ;
15
15
use serde:: Serialize ;
16
16
17
- //TODO: Use Label from class::Label
18
-
19
17
pub struct Instance {
20
18
pod : Pod ,
21
19
}
@@ -32,19 +30,20 @@ pub struct InstanceJson {
32
30
impl Instance {
33
31
pub async fn new ( kube : & Arc < Kube > , template : & Template ) -> EResult < Self > {
34
32
let template_name = & template. name ;
35
- let instance_type = & template. t . parse ( ) ?;
33
+ let instance_type = & template. t ;
34
+ let resources = & template. resources ;
36
35
let slots = template. slots ;
37
36
38
37
let instance_label = Label :: get_instance_type_label ( instance_type) ;
39
38
let template_label = Label :: get_template_label ( template_name) ;
40
39
let slots_label = Label :: get_slots_label ( slots) ;
41
40
42
- let port = instance_type. get_associated_port ( ) ;
43
-
44
41
let labels = vec ! [ instance_label, template_label, slots_label] ;
45
42
43
+ let port = instance_type. get_associated_port ( ) ;
44
+
46
45
let pod = kube
47
- . create_epsilon_pod ( template_name, Some ( & labels) , port)
46
+ . create_epsilon_pod ( template_name, Some ( & labels) , port, resources )
48
47
. await ?;
49
48
50
49
Ok ( Self { pod } )
@@ -68,7 +67,7 @@ impl Instance {
68
67
. labels
69
68
. as_ref ( )
70
69
. unwrap ( )
71
- . get ( "epsilon.fr/template" )
70
+ . get ( Label :: TEMPLATE_LABEL )
72
71
. unwrap ( )
73
72
}
74
73
@@ -78,7 +77,7 @@ impl Instance {
78
77
. labels
79
78
. as_ref ( )
80
79
. unwrap ( )
81
- . get ( "epsilon.fr/instance" )
80
+ . get ( Label :: INSTANCE_TYPE_LABEL )
82
81
. unwrap ( )
83
82
. parse ( )
84
83
. unwrap ( )
@@ -90,7 +89,7 @@ impl Instance {
90
89
. labels
91
90
. as_ref ( )
92
91
. unwrap ( )
93
- . get ( "epsilon.fr/slots" )
92
+ . get ( Label :: SLOTS_LABEL )
94
93
. unwrap ( )
95
94
. parse ( )
96
95
. unwrap ( )
0 commit comments