You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openwhisk.apache.org by GitBox <gi...@apache.org> on 2018/08/25 13:58:46 UTC

[GitHub] rabbah closed pull request #3961: Add length of podName checking code for K8s

rabbah closed pull request #3961: Add length of podName checking code for K8s
URL: https://github.com/apache/incubator-openwhisk/pull/3961
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesContainer.scala b/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesContainer.scala
index f812add784..c3cf8c5cbc 100644
--- a/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesContainer.scala
+++ b/core/invoker/src/main/scala/whisk/core/containerpool/kubernetes/KubernetesContainer.scala
@@ -63,7 +63,9 @@ object KubernetesContainer {
                                                       log: Logging): Future[KubernetesContainer] = {
     implicit val tid = transid
 
-    val podName = name.replace("_", "-").replaceAll("[()]", "").toLowerCase()
+    // Kubernetes naming rule allows maximum length of 63 character and ended with character only.
+    val origName = name.replace("_", "-").replaceAll("[()]", "").toLowerCase.take(63)
+    val podName = if (origName.endsWith("-")) origName.reverse.dropWhile(_ == '-').reverse else origName
 
     for {
       container <- kubernetes.run(podName, image, memory, environment, labels).recoverWith {


 

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


With regards,
Apache Git Services