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

[WIP] Change imagageurl to be equal with image selection #2790

Closed
wants to merge 1 commit into from
Closed
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
7 changes: 3 additions & 4 deletions backend/src/utils/notebookUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,13 @@ export const assembleNotebook = async (

const notebookSize = getNotebookSize(notebookSizeName);

let imageUrl = ``;
let imageSelection = ``;

try {
const image = await getImageInfo(fastify, imageName);

const selectedImage = getImageTag(image, imageTagName);

imageUrl = `${selectedImage.image?.dockerImageRepo}:${selectedImage.tag?.name}`;
imageSelection = `${selectedImage.image?.name}:${selectedImage.tag?.name}`;
} catch (e) {
fastify.log.error(`Error getting the image for ${imageName}:${imageTagName}`);
Expand Down Expand Up @@ -268,6 +266,7 @@ export const assembleNotebook = async (
},
annotations: {
'notebooks.opendatahub.io/oauth-logout-url': `${url}/notebookController/${translatedUsername}/home`,
'image.openshift.io/triggers': `[{"from":{"kind":"ImageStreamTag","name":"${imageSelection}", "namespace":"${namespace}"},"fieldPath":"spec.template.spec.containers[?(@.name==\\"${name}\\")].image"}]`,
'notebooks.opendatahub.io/last-size-selection': notebookSize.name,
'notebooks.opendatahub.io/last-image-selection': imageSelection,
'opendatahub.io/username': username,
Expand All @@ -285,7 +284,7 @@ export const assembleNotebook = async (
enableServiceLinks: false,
containers: [
{
image: imageUrl,
image: imageSelection,
imagePullPolicy: 'Always',
workingDir: MOUNT_PATH,
name: name,
Expand All @@ -301,7 +300,7 @@ export const assembleNotebook = async (
},
{
name: 'JUPYTER_IMAGE',
value: imageUrl,
value: imageSelection,
},
...configMapEnvs,
...secretEnvs,
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/api/k8s/notebooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ export const assembleNotebook = (
existingResources,
} = data;
const notebookId = overrideNotebookId || translateDisplayNameForK8s(notebookName);
const imageUrl = `${image.imageStream?.status?.dockerImageRepository}:${image.imageVersion?.name}`;
const imageSelection = `${image.imageStream?.metadata.name}:${image.imageVersion?.name}`;

const { affinity, tolerations, resources } = assemblePodSpecOptions(
Expand Down Expand Up @@ -101,6 +100,7 @@ export const assembleNotebook = (
},
annotations: {
'openshift.io/display-name': notebookName.trim(),
'image.openshift.io/triggers': `[{"from":{"kind":"ImageStreamTag","name":"${imageSelection}", "namespace":"${projectName}"},"fieldPath":"spec.template.spec.containers[?(@.name==\\"${notebookId}\\")].image"}]`,
'openshift.io/description': description || '',
'notebooks.opendatahub.io/oauth-logout-url': `${origin}/projects/${projectName}?notebookLogout=${notebookId}`,
'notebooks.opendatahub.io/last-size-selection': notebookSize.name,
Expand All @@ -120,7 +120,7 @@ export const assembleNotebook = (
enableServiceLinks: false,
containers: [
{
image: imageUrl,
image: imageSelection,
imagePullPolicy: 'Always',
workingDir: ROOT_MOUNT_PATH,
name: notebookId,
Expand All @@ -136,7 +136,7 @@ export const assembleNotebook = (
},
{
name: 'JUPYTER_IMAGE',
value: imageUrl,
value: imageSelection,
},
],
envFrom,
Expand Down
Loading