You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datalab.apache.org by lf...@apache.org on 2021/04/20 08:11:44 UTC

[incubator-datalab] branch DATALAB-1724 created (now 0fcb530)

This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a change to branch DATALAB-1724
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git.


      at 0fcb530  [DATALAB-1724]: added necessary for termination tags to project nat route tables, added Name tag for ssn route table

This branch includes the following new commits:

     new 0fcb530  [DATALAB-1724]: added necessary for termination tags to project nat route tables, added Name tag for ssn route table

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org


[incubator-datalab] 01/01: [DATALAB-1724]: added necessary for termination tags to project nat route tables, added Name tag for ssn route table

Posted by lf...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

lfrolov pushed a commit to branch DATALAB-1724
in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git

commit 0fcb530e5310970a86a18a1b0cede1da6c69dc1b
Author: leonidfrolov <fr...@gmail.com>
AuthorDate: Tue Apr 20 11:11:23 2021 +0300

    [DATALAB-1724]: added necessary for termination tags to project nat route tables, added Name tag for ssn route table
---
 infrastructure-provisioning/src/general/lib/aws/actions_lib.py        | 4 +++-
 .../src/general/scripts/aws/edge_configure_route_table.py             | 3 ++-
 .../src/general/scripts/aws/project_prepare.py                        | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
index 4b6e97e..2f6725b 100644
--- a/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/aws/actions_lib.py
@@ -207,6 +207,7 @@ def create_rt(vpc_id, infra_tag_name, infra_tag_value, secondary):
         route_table.append(rt_id)
         print('Created Route-Table with ID: {}'.format(rt_id))
         create_tag(route_table, json.dumps(tag))
+        create_tag(route_table, json.dumps({"Key": "Name", "Value": "{}-ssn-rt".format(infra_tag_value)}))
         if not secondary:
             ig = ec2.create_internet_gateway()
             ig_id = ig.get('InternetGateway').get('InternetGatewayId')
@@ -223,13 +224,14 @@ def create_rt(vpc_id, infra_tag_name, infra_tag_value, secondary):
                            "error_message": str(err) + "\n Traceback: " + traceback.print_exc(file=sys.stdout)}))
         traceback.print_exc(file=sys.stdout)
 
-def create_nat_rt(vpc_id, infra_tag_value, edge_instance_id, private_subnet_id):
+def create_nat_rt(vpc_id, infra_tag_value, edge_instance_id, private_subnet_id, sbn):
     try:
         ec2 = boto3.client('ec2')
         nat_rt = ec2.create_route_table(VpcId=vpc_id)
         nat_rt_id = nat_rt.get('RouteTable').get('RouteTableId')
         tag = {"Key": 'Name', "Value": infra_tag_value}
         create_tag(nat_rt_id, json.dumps(tag))
+        create_tag(nat_rt_id, json.dumps({"Key": "{}-tag".format(sbn), "Value": sbn}))
         ec2 = boto3.resource('ec2')
         route_table = ec2.RouteTable(nat_rt_id)
         route_table.create_route(DestinationCidrBlock='0.0.0.0/0', InstanceId=edge_instance_id)
diff --git a/infrastructure-provisioning/src/general/scripts/aws/edge_configure_route_table.py b/infrastructure-provisioning/src/general/scripts/aws/edge_configure_route_table.py
index e034ce0..324f1c3 100644
--- a/infrastructure-provisioning/src/general/scripts/aws/edge_configure_route_table.py
+++ b/infrastructure-provisioning/src/general/scripts/aws/edge_configure_route_table.py
@@ -30,8 +30,9 @@ parser.add_argument('--vpc_id', type=str, default='')
 parser.add_argument('--infra_tag_value', type=str, default='')
 parser.add_argument('--edge_instance_id', type=str, default='')
 parser.add_argument('--private_subnet_id', type=str, default='')
+parser.add_argument('--sbn', type=str, default='')
 args = parser.parse_args()
 
 if __name__ == "__main__":
-    rt_id = create_nat_rt(args.vpc_id, args.infra_tag_value, args.edge_instance_id, args.private_subnet_id)
+    rt_id = create_nat_rt(args.vpc_id, args.infra_tag_value, args.edge_instance_id, args.private_subnet_id, args.sbn)
 
diff --git a/infrastructure-provisioning/src/general/scripts/aws/project_prepare.py b/infrastructure-provisioning/src/general/scripts/aws/project_prepare.py
index 14012ed..78d497e 100644
--- a/infrastructure-provisioning/src/general/scripts/aws/project_prepare.py
+++ b/infrastructure-provisioning/src/general/scripts/aws/project_prepare.py
@@ -700,8 +700,8 @@ if __name__ == "__main__":
             project_conf['nat_rt_name'] = '{0}-{1}-{2}-nat-rt'.format(project_conf['service_base_name'],
                                                                               project_conf['project_name'],
                                                                               project_conf['endpoint_name'])
-            params = "--vpc_id {} --infra_tag_value {} --edge_instance_id {} --private_subnet_id {}".format(
-                project_conf['vpc2_id'], project_conf['nat_rt_name'], edge_instance, subnet_id)
+            params = "--vpc_id {} --infra_tag_value {} --edge_instance_id {} --private_subnet_id {} --sbn {}".format(
+                project_conf['vpc2_id'], project_conf['nat_rt_name'], edge_instance, subnet_id, project_conf['service_base_name'])
             try:
                 local("~/scripts/{}.py {}".format('edge_configure_route_table', params))
             except:

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datalab.apache.org
For additional commands, e-mail: commits-help@datalab.apache.org