From 5096490ca560a4848ae19f6f4c95b5ea4d66a06c Mon Sep 17 00:00:00 2001
From: Michael Davis <michael.davis@cern.ch>
Date: Fri, 23 Aug 2019 11:09:06 +0200
Subject: [PATCH] [ci] Get ip from client pod and pass it to MGM pod

---
 .../docker/ctafrontend/cc7/opt/run/bin/ctaeos-mgm.sh  | 11 +++--------
 .../orchestration/create_instance.sh                  |  2 ++
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/ctaeos-mgm.sh b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/ctaeos-mgm.sh
index b0a19fd52b..32c3a4d10e 100755
--- a/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/ctaeos-mgm.sh
+++ b/continuousintegration/docker/ctafrontend/cc7/opt/run/bin/ctaeos-mgm.sh
@@ -213,15 +213,10 @@ fi
 
   # Configure gRPC interface:
   #
-  # 1. Map requests to EOS virtual identities
-  CLIENT_IP=$(host client|sed 's/^.* //')
+  # 1. Map requests from the client to EOS virtual identities
+  CLIENT_IP=$(cat /etc/grpc_client_ip)
   echo CLIENT_IP is $CLIENT_IP
-  eos -r 0 0 vid add gateway client grpc
-  #for i in {1..10}
-  #do
-    #ip_addr=10.254.75.$i
-    #eos -r 0 0 vid add gateway $ip_addr grpc
-  #done
+  eos -r 0 0 vid add gateway ${CLIENT_IP} grpc
   # 2. Add authorisation key
   #
   # Note: EOS_AUTH_KEY must be the same as the one specified in client.sh
diff --git a/continuousintegration/orchestration/create_instance.sh b/continuousintegration/orchestration/create_instance.sh
index 534c7113fc..4f68a9c08d 100755
--- a/continuousintegration/orchestration/create_instance.sh
+++ b/continuousintegration/orchestration/create_instance.sh
@@ -301,6 +301,8 @@ kubectl --namespace=${instance} exec kdc cat /root/eos-server.keytab | kubectl -
 kubectl --namespace=${instance} exec ctacli -- kinit -kt /root/ctaadmin1.keytab ctaadmin1@TEST.CTA
 kubectl --namespace=${instance} exec client -- kinit -kt /root/user1.keytab user1@TEST.CTA
 
+# Let EOS MGM pod know the address of the client pod, to configure the gRPC gateway
+kubectl --namespace=${instance} exec client -- hostname -i | kubectl --namespace=${instance} exec -i ctaeos -- bash -c "cat > /etc/grpc_client_ip"
 
 ## THE FILE IS MOVED THERE MUCH LATER AND OVERWRITES THIS
 # THIS HAS TO BE IMPROVED (DEFINITELY) SO THAT WE CAN ASYNCHRONOUSLY UPDATE THE CONFIGURATION FILES...
-- 
GitLab