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

dmysakovets pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/develop by this push:
     new 626bfde  [GCP]: Add endpoint_tag and project_tag for images
     new e775692  Merge pull request #253 from bodnarmykola/DLAB-748
626bfde is described below

commit 626bfde2864f74ebaed7bafa0b5de100ba27ec8f
Author: Mykola_Bodnar1 <bodnarmyk...@gmail.com>
AuthorDate: Wed Aug 14 18:01:58 2019 +0300

    [GCP]: Add endpoint_tag and project_tag for images
---
 infrastructure-provisioning/src/general/lib/gcp/actions_lib.py    | 6 +++---
 .../src/general/scripts/gcp/deeplearning_configure.py             | 8 +++++++-
 .../src/general/scripts/gcp/jupyter_configure.py                  | 8 +++++++-
 .../src/general/scripts/gcp/rstudio_configure.py                  | 8 +++++++-
 .../src/general/scripts/gcp/tensor-rstudio_configure.py           | 8 +++++++-
 .../src/general/scripts/gcp/tensor_configure.py                   | 8 +++++++-
 .../src/general/scripts/gcp/zeppelin_configure.py                 | 8 +++++++-
 7 files changed, 45 insertions(+), 9 deletions(-)

diff --git a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py 
b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
index dbbeea1..6b405a6 100644
--- a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
+++ b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py
@@ -693,12 +693,12 @@ class GCPActions:
                                    file=sys.stdout)}))
             traceback.print_exc(file=sys.stdout)
 
-    def create_image_from_instance_disks(self, primary_image_name, 
secondary_image_name, instance_name, zone):
+    def create_image_from_instance_disks(self, primary_image_name, 
secondary_image_name, instance_name, zone, lables):
         primary_disk_name = 
"projects/{0}/zones/{1}/disks/{2}".format(self.project, zone, instance_name)
         secondary_disk_name = 
"projects/{0}/zones/{1}/disks/{2}-secondary".format(self.project, zone, 
instance_name)
-        primary_params = {"name": primary_image_name, "sourceDisk": 
primary_disk_name, "labels": {"product": "dlab"}}
+        primary_params = {"name": primary_image_name, "sourceDisk": 
primary_disk_name, "labels": lables}
         primary_request = self.service.images().insert(project=self.project, 
body=primary_params)
-        secondary_params = {"name": secondary_image_name, "sourceDisk": 
secondary_disk_name, "labels": {"product": "dlab"}}
+        secondary_params = {"name": secondary_image_name, "sourceDisk": 
secondary_disk_name, "labels": lables}
         secondary_request = self.service.images().insert(project=self.project, 
body=secondary_params)
         id_list=[]
         try:
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/deeplearning_configure.py 
b/infrastructure-provisioning/src/general/scripts/gcp/deeplearning_configure.py
index 446777a..62594b7 100644
--- 
a/infrastructure-provisioning/src/general/scripts/gcp/deeplearning_configure.py
+++ 
b/infrastructure-provisioning/src/general/scripts/gcp/deeplearning_configure.py
@@ -48,6 +48,8 @@ if __name__ == "__main__":
     notebook_config['key_name'] = os.environ['conf_key_name']
     notebook_config['edge_user_name'] = 
(os.environ['edge_user_name']).lower().replace('_', '-')
     notebook_config['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['project_tag'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['endpoint_tag'] = 
(os.environ['endpoint_name']).lower().replace('_', '-')
     notebook_config['instance_name'] = 
'{0}-{1}-nb-{2}'.format(notebook_config['service_base_name'],
                                                                
notebook_config['project_name'],
                                                                
notebook_config['exploratory_name'])
@@ -64,6 +66,10 @@ if __name__ == "__main__":
     notebook_config['dlab_ssh_user'] = os.environ['conf_os_user']
     notebook_config['zone'] = os.environ['gcp_zone']
     notebook_config['shared_image_enabled'] = 
os.environ['conf_shared_image_enabled']
+    notebook_config['image_labels'] = {"sbn": 
notebook_config['service_base_name'],
+                                       "project_tag": 
notebook_config['project_tag'],
+                                       "endpoint_tag": 
notebook_config['endpoint_tag'],
+                                       "product": "dlab"}
     try:
         if os.environ['conf_os_family'] == 'debian':
             initial_user = 'ubuntu'
@@ -192,7 +198,7 @@ if __name__ == "__main__":
                 print("Looks like it's first time we configure notebook 
server. Creating images.")
                 image_id_list = GCPActions().create_image_from_instance_disks(
                     notebook_config['expected_primary_image_name'], 
notebook_config['expected_secondary_image_name'],
-                    notebook_config['instance_name'], notebook_config['zone'])
+                    notebook_config['instance_name'], notebook_config['zone'], 
notebook_config['image_labels'])
                 if image_id_list and image_id_list[0] != '':
                     print("Image of primary disk was successfully created. 
It's ID is {}".format(image_id_list[0]))
                 else:
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/jupyter_configure.py 
b/infrastructure-provisioning/src/general/scripts/gcp/jupyter_configure.py
index c701fc1..a7ae830 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/jupyter_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/jupyter_configure.py
@@ -48,6 +48,8 @@ if __name__ == "__main__":
     notebook_config['key_name'] = os.environ['conf_key_name']
     notebook_config['edge_user_name'] = 
(os.environ['edge_user_name']).lower().replace('_', '-')
     notebook_config['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['project_tag'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['endpoint_tag'] = 
(os.environ['endpoint_name']).lower().replace('_', '-')
     notebook_config['instance_name'] = 
'{0}-{1}-nb-{2}'.format(notebook_config['service_base_name'],
                                                                
notebook_config['project_name'],
                                                                
notebook_config['exploratory_name'])
@@ -63,6 +65,10 @@ if __name__ == "__main__":
     notebook_config['dlab_ssh_user'] = os.environ['conf_os_user']
     notebook_config['zone'] = os.environ['gcp_zone']
     notebook_config['shared_image_enabled'] = 
os.environ['conf_shared_image_enabled']
+    notebook_config['image_labels'] = {"sbn": 
notebook_config['service_base_name'],
+                                       "project_tag": 
notebook_config['project_tag'],
+                                       "endpoint_tag": 
notebook_config['endpoint_tag'],
+                                       "product": "dlab"}
     try:
         if os.environ['conf_os_family'] == 'debian':
             initial_user = 'ubuntu'
@@ -194,7 +200,7 @@ if __name__ == "__main__":
                 print("Looks like it's first time we configure notebook 
server. Creating images.")
                 image_id_list = GCPActions().create_image_from_instance_disks(
                     notebook_config['expected_primary_image_name'], 
notebook_config['expected_secondary_image_name'],
-                    notebook_config['instance_name'], notebook_config['zone'])
+                    notebook_config['instance_name'], notebook_config['zone'], 
notebook_config['image_labels'])
                 if image_id_list and image_id_list[0] != '':
                     print("Image of primary disk was successfully created. 
It's ID is {}".format(image_id_list[0]))
                 else:
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/rstudio_configure.py 
b/infrastructure-provisioning/src/general/scripts/gcp/rstudio_configure.py
index 4939d93..26baf88 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/rstudio_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/rstudio_configure.py
@@ -49,6 +49,8 @@ if __name__ == "__main__":
     notebook_config['key_name'] = os.environ['conf_key_name']
     notebook_config['edge_user_name'] = 
(os.environ['edge_user_name']).lower().replace('_', '-')
     notebook_config['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['project_tag'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['endpoint_tag'] = 
(os.environ['endpoint_name']).lower().replace('_', '-')
     notebook_config['instance_name'] = 
'{0}-{1}-nb-{2}'.format(notebook_config['service_base_name'],
                                                                
notebook_config['project_name'],
                                                                
notebook_config['exploratory_name'])
@@ -67,6 +69,10 @@ if __name__ == "__main__":
     notebook_config['ip_address'] = 
GCPMeta().get_private_ip_address(notebook_config['instance_name'])
     notebook_config['rstudio_pass'] = id_generator()
     notebook_config['shared_image_enabled'] = 
os.environ['conf_shared_image_enabled']
+    notebook_config['image_labels'] = {"sbn": 
notebook_config['service_base_name'],
+                                       "project_tag": 
notebook_config['project_tag'],
+                                       "endpoint_tag": 
notebook_config['endpoint_tag'],
+                                       "product": "dlab"}
     try:
         if os.environ['conf_os_family'] == 'debian':
             initial_user = 'ubuntu'
@@ -197,7 +203,7 @@ if __name__ == "__main__":
                 print("Looks like it's first time we configure notebook 
server. Creating images.")
                 image_id_list = GCPActions().create_image_from_instance_disks(
                     notebook_config['expected_primary_image_name'], 
notebook_config['expected_secondary_image_name'],
-                    notebook_config['instance_name'], notebook_config['zone'])
+                    notebook_config['instance_name'], notebook_config['zone'], 
notebook_config['image_labels'])
                 if image_id_list and image_id_list[0] != '':
                     print("Image of primary disk was successfully created. 
It's ID is {}".format(image_id_list[0]))
                 else:
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/tensor-rstudio_configure.py
 
b/infrastructure-provisioning/src/general/scripts/gcp/tensor-rstudio_configure.py
index 736d620..578decf 100644
--- 
a/infrastructure-provisioning/src/general/scripts/gcp/tensor-rstudio_configure.py
+++ 
b/infrastructure-provisioning/src/general/scripts/gcp/tensor-rstudio_configure.py
@@ -54,6 +54,8 @@ if __name__ == "__main__":
     notebook_config['key_name'] = os.environ['conf_key_name']
     notebook_config['edge_user_name'] = 
(os.environ['edge_user_name']).lower().replace('_', '-')
     notebook_config['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['project_tag'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['endpoint_tag'] = 
(os.environ['endpoint_name']).lower().replace('_', '-')
     notebook_config['instance_name'] = 
'{0}-{1}-nb-{2}'.format(notebook_config['service_base_name'],
                                                                
notebook_config['project_name'],
                                                                
notebook_config['exploratory_name'])
@@ -72,6 +74,10 @@ if __name__ == "__main__":
     notebook_config['zone'] = os.environ['gcp_zone']
     notebook_config['rstudio_pass'] = id_generator()
     notebook_config['shared_image_enabled'] = 
os.environ['conf_shared_image_enabled']
+    notebook_config['image_labels'] = {"sbn": 
notebook_config['service_base_name'],
+                                       "project_tag": 
notebook_config['project_tag'],
+                                       "endpoint_tag": 
notebook_config['endpoint_tag'],
+                                       "product": "dlab"}
     try:
         if os.environ['conf_os_family'] == 'debian':
             initial_user = 'ubuntu'
@@ -200,7 +206,7 @@ if __name__ == "__main__":
                 print("Looks like it's first time we configure notebook 
server. Creating images.")
                 image_id_list = GCPActions().create_image_from_instance_disks(
                     notebook_config['expected_primary_image_name'], 
notebook_config['expected_secondary_image_name'],
-                    notebook_config['instance_name'], notebook_config['zone'])
+                    notebook_config['instance_name'], notebook_config['zone'], 
notebook_config['image_labels'])
                 if image_id_list and image_id_list[0] != '':
                     print("Image of primary disk was successfully created. 
It's ID is {}".format(image_id_list[0]))
                 else:
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/tensor_configure.py 
b/infrastructure-provisioning/src/general/scripts/gcp/tensor_configure.py
index 66c5f0c..4573ae8 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/tensor_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/tensor_configure.py
@@ -50,6 +50,8 @@ if __name__ == "__main__":
     notebook_config['key_name'] = os.environ['conf_key_name']
     notebook_config['edge_user_name'] = 
(os.environ['edge_user_name']).lower().replace('_', '-')
     notebook_config['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['project_tag'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['endpoint_tag'] = 
(os.environ['endpoint_name']).lower().replace('_', '-')
     notebook_config['instance_name'] = 
'{0}-{1}-nb-{2}'.format(notebook_config['service_base_name'],
                                                                
notebook_config['project_name'],
                                                                
notebook_config['exploratory_name'])
@@ -66,6 +68,10 @@ if __name__ == "__main__":
     notebook_config['dlab_ssh_user'] = os.environ['conf_os_user']
     notebook_config['zone'] = os.environ['gcp_zone']
     notebook_config['shared_image_enabled'] = 
os.environ['conf_shared_image_enabled']
+    notebook_config['image_labels'] = {"sbn": 
notebook_config['service_base_name'],
+                                       "project_tag": 
notebook_config['project_tag'],
+                                       "endpoint_tag": 
notebook_config['endpoint_tag'],
+                                       "product": "dlab"}
     try:
         if os.environ['conf_os_family'] == 'debian':
             initial_user = 'ubuntu'
@@ -191,7 +197,7 @@ if __name__ == "__main__":
                 print("Looks like it's first time we configure notebook 
server. Creating images.")
                 image_id_list = GCPActions().create_image_from_instance_disks(
                     notebook_config['expected_primary_image_name'], 
notebook_config['expected_secondary_image_name'],
-                    notebook_config['instance_name'], notebook_config['zone'])
+                    notebook_config['instance_name'], notebook_config['zone'], 
notebook_config['image_labels'])
                 if image_id_list and image_id_list[0] != '':
                     print("Image of primary disk was successfully created. 
It's ID is {}".format(image_id_list[0]))
                 else:
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/zeppelin_configure.py 
b/infrastructure-provisioning/src/general/scripts/gcp/zeppelin_configure.py
index ee6eeed..dc6993f 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/zeppelin_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/zeppelin_configure.py
@@ -50,6 +50,8 @@ if __name__ == "__main__":
     notebook_config['key_name'] = os.environ['conf_key_name']
     notebook_config['edge_user_name'] = 
(os.environ['edge_user_name']).lower().replace('_', '-')
     notebook_config['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['project_tag'] = 
(os.environ['project_name']).lower().replace('_', '-')
+    notebook_config['endpoint_tag'] = 
(os.environ['endpoint_name']).lower().replace('_', '-')
     notebook_config['instance_name'] = 
'{0}-{1}-nb-{2}'.format(notebook_config['service_base_name'],
                                                                
notebook_config['project_name'],
                                                                
notebook_config['exploratory_name'])
@@ -66,6 +68,10 @@ if __name__ == "__main__":
     notebook_config['dlab_ssh_user'] = os.environ['conf_os_user']
     notebook_config['zone'] = os.environ['gcp_zone']
     notebook_config['shared_image_enabled'] = 
os.environ['conf_shared_image_enabled']
+    notebook_config['image_labels'] = {"sbn": 
notebook_config['service_base_name'],
+                                       "project_tag": 
notebook_config['project_tag'],
+                                       "endpoint_tag": 
notebook_config['endpoint_tag'],
+                                       "product": "dlab"}
     try:
         if os.environ['conf_os_family'] == 'debian':
             initial_user = 'ubuntu'
@@ -209,7 +215,7 @@ if __name__ == "__main__":
                 print("Looks like it's first time we configure notebook 
server. Creating images.")
                 image_id_list = GCPActions().create_image_from_instance_disks(
                     notebook_config['expected_primary_image_name'], 
notebook_config['expected_secondary_image_name'],
-                    notebook_config['instance_name'], notebook_config['zone'])
+                    notebook_config['instance_name'], notebook_config['zone'], 
notebook_config['image_labels'])
                 if image_id_list and image_id_list[0] != '':
                     print("Image of primary disk was successfully created. 
It's ID is {}".format(image_id_list[0]))
                 else:


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org
For additional commands, e-mail: commits-h...@dlab.apache.org

Reply via email to