@@ -115,40 +115,39 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) (Statu
115
115
// Return Container State if it's available
116
116
if notebook .Status .ContainerState .Running != nil {
117
117
return StatusRunning , "Running"
118
- } else if notebook .Status .ContainerState .Terminated != nil {
118
+ }
119
+ if notebook .Status .ContainerState .Terminated != nil {
119
120
return StatusError , "The Pod has Terminated"
120
- } else {
121
- status , reason := StatusWarning , ""
121
+ }
122
+ status , reason := StatusWarning , ""
122
123
123
- if notebook .Status .ContainerState .Waiting != nil {
124
- status , reason = StatusWaiting , notebook .Status .ContainerState .Waiting .Reason
125
- if notebook .Status .ContainerState .Waiting .Reason == "ImagePullBackoff" {
126
- status , reason = StatusError , notebook .Status .ContainerState .Waiting .Reason
127
- }
128
- } else {
129
- status , reason = StatusWaiting , "Scheduling the Pod"
124
+ if notebook .Status .ContainerState .Waiting != nil {
125
+ status , reason = StatusWaiting , notebook .Status .ContainerState .Waiting .Reason
126
+ if notebook .Status .ContainerState .Waiting .Reason == "ImagePullBackoff" {
127
+ status , reason = StatusError , notebook .Status .ContainerState .Waiting .Reason
130
128
}
129
+ } else {
130
+ status , reason = StatusWaiting , "Scheduling the Pod"
131
+ }
131
132
132
- // Process events
133
- for _ , event := range events {
134
- if event .Type == corev1 .EventTypeWarning {
135
- return StatusWarning , event .Message
136
- }
133
+ // Process events
134
+ for _ , event := range events {
135
+ if event .Type == corev1 .EventTypeWarning {
136
+ return StatusWarning , event .Message
137
137
}
138
-
139
- return status , reason
140
138
}
141
139
142
- return "" , ""
140
+ return status , reason
141
+
143
142
}
144
143
145
144
func processGPU (notebook * kubeflowv1.Notebook ) (resource.Quantity , GPUVendor ) {
146
145
if limit , ok := notebook .Spec .Template .Spec .Containers [0 ].Resources .Limits ["nvidia.com/gpu" ]; ok {
147
146
return limit , GPUVendorNvidia
148
- } else if limit , ok := notebook .Spec .Template .Spec .Containers [0 ].Resources .Limits ["amd.com/gpu" ]; ok {
147
+ }
148
+ if limit , ok := notebook .Spec .Template .Spec .Containers [0 ].Resources .Limits ["amd.com/gpu" ]; ok {
149
149
return limit , GPUVendorAMD
150
150
}
151
-
152
151
return resource.Quantity {}, ""
153
152
}
154
153
@@ -316,7 +315,7 @@ func (s *server) NewNotebook(w http.ResponseWriter, r *http.Request) {
316
315
Spec : corev1.PodSpec {
317
316
ServiceAccountName : DefaultServiceAccountName ,
318
317
Containers : []corev1.Container {
319
- corev1. Container {
318
+ {
320
319
Name : req .Name ,
321
320
Image : image ,
322
321
Resources : corev1.ResourceRequirements {
0 commit comments