@@ -83,6 +83,7 @@ type newnotebookrequest struct {
83
83
EnableSharedMemory bool `json:"shm"`
84
84
Configurations []string `json:"configurations"`
85
85
Language string `json:"language"`
86
+ ImagePullPolicy string `json:"imagePullPolicy"`
86
87
ServerType string `json:"serverType"`
87
88
AffinityConfig string `json:"affinityConfig"`
88
89
TolerationGroup string `json:"tolerationGroup"`
@@ -121,15 +122,16 @@ type notebookPhase string
121
122
122
123
// KeyType is the type of key
123
124
type KeyType struct {
124
- Key string
125
- Params []string
125
+ Key string
126
+ Params []string
126
127
}
128
+
127
129
// status represents the status of a notebook.
128
130
type status struct {
129
131
Message string `json:"message"`
130
132
Phase notebookPhase `json:"phase"`
131
133
State string `json:"state"`
132
- Key KeyType `json:"key"`
134
+ Key KeyType `json:"key"`
133
135
}
134
136
135
137
const (
@@ -165,11 +167,10 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
165
167
return status {
166
168
Message : "Deleting this Notebook Server." ,
167
169
Phase : NotebookPhaseTerminating ,
168
- Key :
169
- KeyType {
170
- Key : "jupyter.backend.status.notebookDeleting" ,
171
- Params : []string {},
172
- },
170
+ Key : KeyType {
171
+ Key : "jupyter.backend.status.notebookDeleting" ,
172
+ Params : []string {},
173
+ },
173
174
}
174
175
}
175
176
@@ -179,8 +180,8 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
179
180
return status {
180
181
Message : "No pods are currently running for this Notebook Server." ,
181
182
Phase : NotebookPhaseStopped ,
182
- Key : KeyType {
183
- Key : "jupyter.backend.status.noPodsRunning" ,
183
+ Key : KeyType {
184
+ Key : "jupyter.backend.status.noPodsRunning" ,
184
185
Params : []string {},
185
186
},
186
187
}
@@ -189,8 +190,8 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
189
190
return status {
190
191
Message : "Notebook Server is stopping." ,
191
192
Phase : NotebookPhaseTerminating ,
192
- Key : KeyType {
193
- Key : "jupyter.backend.status.notebookStopping" ,
193
+ Key : KeyType {
194
+ Key : "jupyter.backend.status.notebookStopping" ,
194
195
Params : []string {},
195
196
},
196
197
}
@@ -204,7 +205,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
204
205
Message : "Running" ,
205
206
Phase : NotebookPhaseReady ,
206
207
Key : KeyType {
207
- Key : "jupyter.backend.status.running" ,
208
+ Key : "jupyter.backend.status.running" ,
208
209
Params : []string {},
209
210
},
210
211
}
@@ -215,7 +216,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
215
216
Message : state .Waiting .Reason ,
216
217
Phase : NotebookPhaseWaiting ,
217
218
Key : KeyType {
218
- Key : "jupyter.backend.status.waitingStatus" ,
219
+ Key : "jupyter.backend.status.waitingStatus" ,
219
220
Params : []string {},
220
221
},
221
222
}
@@ -228,7 +229,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
228
229
Message : event .Reason ,
229
230
Phase : NotebookPhaseWarning ,
230
231
Key : KeyType {
231
- Key : "jupyter.backend.status.errorEvent" ,
232
+ Key : "jupyter.backend.status.errorEvent" ,
232
233
Params : []string {},
233
234
},
234
235
}
@@ -239,7 +240,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
239
240
Message : "Scheduling the Pod" ,
240
241
Phase : NotebookPhaseWaiting ,
241
242
Key : KeyType {
242
- Key : "jupyter.backend.status.schedulingPod" ,
243
+ Key : "jupyter.backend.status.schedulingPod" ,
243
244
Params : []string {},
244
245
},
245
246
}
@@ -640,6 +641,10 @@ func (s *server) NewNotebook(w http.ResponseWriter, r *http.Request) {
640
641
})
641
642
}
642
643
644
+ // Add imagePullPolicy
645
+ if req .ImagePullPolicy == "Always" || req .ImagePullPolicy == "Never" || req .ImagePullPolicy == "IfNotPresent" {
646
+ notebook .Spec .Template .Spec .Containers [0 ].ImagePullPolicy = corev1 .PullPolicy (req .ImagePullPolicy )
647
+ }
643
648
log .Printf ("creating notebook %q for %q" , notebook .ObjectMeta .Name , namespace )
644
649
645
650
// Submit the notebook to the API server
0 commit comments