From a2bed24669917439d6ac1eda23cbad66cc6ed2ed Mon Sep 17 00:00:00 2001 From: Peter Nemere Date: Fri, 8 Dec 2023 08:27:41 +1000 Subject: [PATCH] Remove pipe char from username passed to kubernetes because it was failing to create pod --- api/quantification/quantRunner/runnerKubernetes.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/api/quantification/quantRunner/runnerKubernetes.go b/api/quantification/quantRunner/runnerKubernetes.go index e7ceb957..54c41b9e 100644 --- a/api/quantification/quantRunner/runnerKubernetes.go +++ b/api/quantification/quantRunner/runnerKubernetes.go @@ -117,6 +117,10 @@ func getPodObject(paramsStr string, params PiquantParams, dockerImage string, jo // PiQuant Map Commands will need much more CPU (and can safely request it since they are running on Fargate nodes) cpu = "3500m" } + + // Kubernetes doesn't like | in owner name, so we swap it for a _ here + safeUserId := strings.ReplaceAll(requestorUserId, "|", "_") + return &apiv1.Pod{ ObjectMeta: metav1.ObjectMeta{ Name: jobid + "-" + parts[0], @@ -129,7 +133,7 @@ func getPodObject(paramsStr string, params PiquantParams, dockerImage string, jo "app.kubernetes.io/component": application, "piquant/command": params.Command, "app": node, - "owner": requestorUserId, + "owner": safeUserId, "jobid": jobid, "numberofpods": strconv.Itoa(length), },