Skip to content

Commit 8b2f81f

Browse files
author
Alan Christie
committed
fix: Better image pull policy (now based on image tag)
1 parent f74b703 commit 8b2f81f

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

operator/handlers.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,12 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
190190
notebook_interface = material.get("notebook", {}).get("interface", "lab")
191191

192192
image = material.get("image", _DEFAULT_IMAGE)
193+
image_parts = image.split(":")
194+
image_tag = "latest" if len(image_parts) == 1 else image_parts[1]
195+
image_pull_policy = (
196+
"Always" if image_tag.lower() in ["latest", "stable"] else "IfNotPresent"
197+
)
198+
193199
service_account = material.get("serviceAccountName", _DEFAULT_SA)
194200

195201
resources = material.get("resources", {})
@@ -239,7 +245,7 @@ def create(spec: Dict[str, Any], name: str, namespace: str, **_: Any) -> Dict[st
239245
"name": "notebook",
240246
"image": image,
241247
"command": command_items,
242-
"imagePullPolicy": "IfNotPresent",
248+
"imagePullPolicy": image_pull_policy,
243249
"resources": {
244250
"requests": {
245251
"memory": memory_request,

0 commit comments

Comments
 (0)