Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(imagePullPolicy): Add and set it #121

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- main

env:
REGISTRY_NAME: k8scc01covidacr

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export class FormImageComponent implements OnInit, OnDestroy {
@Input() imagesGroupOne: string[];
@Input() imagesGroupTwo: string[];
@Input() allowCustomImage: boolean;
selected = 'Always';
@Input() hideRegistry: boolean;
@Input() hideTag: boolean;

Expand Down
37 changes: 21 additions & 16 deletions notebooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ type newnotebookrequest struct {
EnableSharedMemory bool `json:"shm"`
Configurations []string `json:"configurations"`
Language string `json:"language"`
ImagePullPolicy string `json:"imagePullPolicy"`
ServerType string `json:"serverType"`
AffinityConfig string `json:"affinityConfig"`
TolerationGroup string `json:"tolerationGroup"`
Expand Down Expand Up @@ -121,15 +122,16 @@ type notebookPhase string

// KeyType is the type of key
type KeyType struct {
Key string
Params []string
Key string
Params []string
}

// status represents the status of a notebook.
type status struct {
Message string `json:"message"`
Phase notebookPhase `json:"phase"`
State string `json:"state"`
Key KeyType `json:"key"`
Key KeyType `json:"key"`
}

const (
Expand Down Expand Up @@ -165,11 +167,10 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
return status{
Message: "Deleting this Notebook Server.",
Phase: NotebookPhaseTerminating,
Key:
KeyType{
Key: "jupyter.backend.status.notebookDeleting",
Params: []string{},
},
Key: KeyType{
Key: "jupyter.backend.status.notebookDeleting",
Params: []string{},
},
}
}

Expand All @@ -179,8 +180,8 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
return status{
Message: "No pods are currently running for this Notebook Server.",
Phase: NotebookPhaseStopped,
Key: KeyType{
Key: "jupyter.backend.status.noPodsRunning",
Key: KeyType{
Key: "jupyter.backend.status.noPodsRunning",
Params: []string{},
},
}
Expand All @@ -189,8 +190,8 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
return status{
Message: "Notebook Server is stopping.",
Phase: NotebookPhaseTerminating,
Key: KeyType{
Key: "jupyter.backend.status.notebookStopping",
Key: KeyType{
Key: "jupyter.backend.status.notebookStopping",
Params: []string{},
},
}
Expand All @@ -204,7 +205,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
Message: "Running",
Phase: NotebookPhaseReady,
Key: KeyType{
Key: "jupyter.backend.status.running",
Key: "jupyter.backend.status.running",
Params: []string{},
},
}
Expand All @@ -215,7 +216,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
Message: state.Waiting.Reason,
Phase: NotebookPhaseWaiting,
Key: KeyType{
Key: "jupyter.backend.status.waitingStatus",
Key: "jupyter.backend.status.waitingStatus",
Params: []string{},
},
}
Expand All @@ -228,7 +229,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
Message: event.Reason,
Phase: NotebookPhaseWarning,
Key: KeyType{
Key: "jupyter.backend.status.errorEvent",
Key: "jupyter.backend.status.errorEvent",
Params: []string{},
},
}
Expand All @@ -239,7 +240,7 @@ func processStatus(notebook *kubeflowv1.Notebook, events []*corev1.Event) status
Message: "Scheduling the Pod",
Phase: NotebookPhaseWaiting,
Key: KeyType{
Key: "jupyter.backend.status.schedulingPod",
Key: "jupyter.backend.status.schedulingPod",
Params: []string{},
},
}
Expand Down Expand Up @@ -640,6 +641,10 @@ func (s *server) NewNotebook(w http.ResponseWriter, r *http.Request) {
})
}

// Add imagePullPolicy
if req.ImagePullPolicy == "Always" || req.ImagePullPolicy == "Never" || req.ImagePullPolicy == "IfNotPresent" {
notebook.Spec.Template.Spec.Containers[0].ImagePullPolicy = corev1.PullPolicy(req.ImagePullPolicy)
}
log.Printf("creating notebook %q for %q", notebook.ObjectMeta.Name, namespace)

// Submit the notebook to the API server
Expand Down