From 5d6b1f151ce01b32b495ecf1b7354ff561b73089 Mon Sep 17 00:00:00 2001
From: Eesaan Atluri <atlurie@uab.edu>
Date: Thu, 31 Oct 2024 00:10:39 -0400
Subject: [PATCH] feat: Create multi homed proxy with fixed internal IP
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

We wanted to create a multi-homed instance connected to proxy-net and
internal-net because the nfs-mounts are shared via internal net by the server.
However, the NIC on internal-net wasn’t getting an IP assigned automatically
and this was creating an issue for NFS server to communicate with the clients.
So we created a port and assigned that port during instance creation
---
 .gitlab-ci.yml | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b626cd1..5d0c81b 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -155,10 +155,17 @@ deploy_http_proxy_node:
       ansible-playbook -c local -i 127.0.0.1, ansible/cheaha.yml | tee -a /tmp/ansible.log
       rm -rf /tmp/${CI_PROJECT_NAME}
       EOF
+    - >
+      export HTTP_PROXY_INSTANCE_PORT=$(openstack port create
+      -c id -f value --network $INTERNALNET
+      --fixed-ip subnet=$INTERNALNET_SN,ip-address=$INTERNALNET_IP
+      --disable-port-security
+      ${HTTP_PROXY_INSTANCE_NAME}_internal_port)
     - >
       export HTTP_PROXY_INSTANCE_ID=$(openstack server create
       -c id -f value --image $HTTP_PROXY_IMAGE_ID
       --network $PROXY_NETWORK
+      --port $HTTP_PROXY_INSTANCE_PORT
       --security-group webserver_sec_group
       --security-group allow-ssh
       --user-data user_data.txt
@@ -196,10 +203,17 @@ deploy_ssh_proxy_node:
       ansible-playbook -c local -i 127.0.0.1, ansible/cheaha.yml | tee -a /tmp/ansible.log
       rm -rf /tmp/${CI_PROJECT_NAME}
       EOF
+    - >
+      export SSH_PROXY_INSTANCE_PORT=$(openstack port create
+      -c id -f value --network $INTERNALNET
+      --fixed-ip subnet=$INTERNALNET_SN,ip-address=$INTERNALNET_IP
+      --disable-port-security
+      ${SSH_PROXY_INSTANCE_NAME}_internal_port)
     - >
       export SSH_PROXY_INSTANCE_ID=$(openstack server create
       -c id -f value --image $SSH_PROXY_IMAGE_ID
       --network $PROXY_NETWORK
+      --port $SSH_PROXY_INSTANCE_PORT
       --security-group allow-ssh
       --user-data user_data.txt
       --flavor $INSTANCE_FLAVOR
-- 
GitLab