@@ -13,6 +13,7 @@ import (
13
13
kubeflowv1 "github.com/StatCan/kubeflow-controller/pkg/apis/kubeflowcontroller/v1"
14
14
"github.com/andanhm/go-prettytime"
15
15
"github.com/gorilla/mux"
16
+ "gopkg.in/inf.v0"
16
17
corev1 "k8s.io/api/core/v1"
17
18
"k8s.io/apimachinery/pkg/api/resource"
18
19
v1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@@ -64,7 +65,7 @@ type newnotebookrequest struct {
64
65
65
66
type notebookresponse struct {
66
67
Age string `json:"age"`
67
- CPU resource. Quantity `json:"cpu"`
68
+ CPU * inf. Dec `json:"cpu"`
68
69
GPU resource.Quantity `json:"gpu"`
69
70
GPUVendor GPUVendor `json:"gpuvendor"`
70
71
Image string `json:"image"`
@@ -203,13 +204,18 @@ func (s *server) GetNotebooks(w http.ResponseWriter, r *http.Request) {
203
204
volumes = append (volumes , vol .Name )
204
205
}
205
206
207
+ cpulimit := resource .Zero .AsDec ()
208
+ if req , ok := notebook .Spec .Template .Spec .Containers [0 ].Resources .Requests [corev1 .ResourceCPU ]; ok {
209
+ cpulimit = req .AsDec ()
210
+ }
211
+
206
212
resp .Notebooks = append (resp .Notebooks , notebookresponse {
207
213
Age : prettytime .Format (notebook .CreationTimestamp .Time ),
208
214
Name : notebook .Name ,
209
215
Namespace : notebook .Namespace ,
210
216
Image : notebook .Spec .Template .Spec .Containers [0 ].Image ,
211
217
ShortImage : imageparts [len (imageparts )- 1 ],
212
- CPU : notebook . Spec . Template . Spec . Containers [ 0 ]. Resources . Requests [ corev1 . ResourceCPU ] ,
218
+ CPU : cpulimit ,
213
219
Memory : notebook .Spec .Template .Spec .Containers [0 ].Resources .Requests [corev1 .ResourceMemory ],
214
220
Reason : reason ,
215
221
Status : status ,
0 commit comments