sven-lange-last commented on a change in pull request #4503: Add optional 
config for appending custom registry to user provided images
URL: https://github.com/apache/openwhisk/pull/4503#discussion_r325259405
 
 

 ##########
 File path: 
core/invoker/src/main/scala/org/apache/openwhisk/core/containerpool/docker/DockerContainerFactory.scala
 ##########
 @@ -60,10 +62,14 @@ class DockerContainerFactory(instance: InvokerInstanceId,
                                userProvidedImage: Boolean,
                                memory: ByteSize,
                                cpuShares: Int)(implicit config: WhiskConfig, 
logging: Logging): Future[Container] = {
+    val registryConfig =
+      ContainerFactory.resolveRegisterConfig(userProvidedImage, 
runtimesRegistryConfig, userImagesRegistryConfig)
+    val image =
+      if (userProvidedImage && registryConfig.url.isEmpty) Left(actionImage)
+      else Right(actionImage.localImageName(registryConfig.url))
 
 Review comment:
   I have the expression that this code can be streamlined as follows to 
simplify the condition in line 68 (`(userProvidedImage && 
registryConfig.url.isEmpty)`):
   
   ```
      val registryConfig =
         ContainerFactory.resolveRegisterConfig(userProvidedImage, 
runtimesRegistryConfig, userImagesRegistryConfig)
       val imageRef = actionImage.localImageName(registryConfig.url)
       val image = if (userProvidedImage) Left(imageRef) else Right(imageRef)
   ```
   
   My understanding is that `actionImage.localImageName()` would just leave out 
the registry part if no registry urls are specified.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to