Skip to content

Commit 498b47b

Browse files
committed
NO-JIRA: chore(dev): log error when imagestream is found but could not be fetched
This is something that should not normally happen, but it happened to me when I was working with faked imagestreams in tests and the lack of logging confused me. I had to resort to running the webhook in debugger to understand what was going on. With this log message, such error should be easier to debug, without stepping through the code.
1 parent 3408b8c commit 498b47b

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

components/odh-notebook-controller/controllers/notebook_webhook.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ func SetContainerImageFromRegistry(ctx context.Context, cli client.Client, noteb
726726
// if not found, search in the notebook namespace
727727
// Note: This is in this order, so users should not overwrite the ImageStream
728728
err := cli.Get(ctx, types.NamespacedName{Name: imagestreamName, Namespace: controllerNamespace}, imgSelection)
729-
if err != nil && apierrs.IsNotFound(err) {
729+
if apierrs.IsNotFound(err) {
730730
log.Info("Unable to find the ImageStream in controller namespace, try finding in notebook namespace", "imagestream", imagestreamName, "controllerNamespace", controllerNamespace)
731731
// Check if the ImageStream is present in the notebook namespace
732732
err = cli.Get(ctx, types.NamespacedName{Name: imagestreamName, Namespace: notebook.Namespace}, imgSelection)
@@ -738,6 +738,8 @@ func SetContainerImageFromRegistry(ctx context.Context, cli client.Client, noteb
738738
imagestreamFound = true
739739
log.Info("ImageStream found in notebook namespace", "imagestream", imagestreamName, "namespace", notebook.Namespace)
740740
}
741+
} else if err != nil {
742+
log.Error(err, "Error getting ImageStream", "imagestream", imagestreamName, "controllerNamespace", controllerNamespace)
741743
} else {
742744
// ImageStream found in the controller namespace
743745
imagestreamFound = true

0 commit comments

Comments
 (0)