You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openwhisk.apache.org by ra...@apache.org on 2018/08/25 13:58:48 UTC
[incubator-openwhisk] branch master updated: Add length of podName
checking code for K8s (#3961)
This is an automated email from the ASF dual-hosted git repository.
rabbah pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-openwhisk.git
The following commit(s) were added to refs/heads/master by this push:
new b3e1b92 Add length of podName checking code for K8s (#3961)
b3e1b92 is described below
commit b3e1b92a86fab5422288471d0388bd724c5f8888
Author: Keunseob Kim <ke...@nate.com>
AuthorDate: Sat Aug 25 22:58:45 2018 +0900
Add length of podName checking code for K8s (#3961)
* Add length of podName checking code for K8s
* Add ended with character checking code for K8s
Signed-off-by: keunseob.kim <ke...@samsung.com>
---
.../whisk/core/containerpool/kubernetes/KubernetesContainer.scala | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
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 56e8f10..ca91bf4 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
@@ -62,7 +62,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 {