This is an automated email from the ASF dual-hosted git repository. lfrolov pushed a commit to branch DLAB-1415 in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git
commit 2ad9f90b14ffd637e6900cf5831f5ce952adc2a5 Author: leonidfrolov <[email protected]> AuthorDate: Thu Mar 19 11:54:09 2020 +0200 [DLAB-1415]: changed how billing tag and name tag is assigned to images in gcp --- infrastructure-provisioning/src/general/lib/gcp/actions_lib.py | 2 ++ .../src/general/scripts/gcp/deeplearning_configure.py | 4 ++-- .../src/general/scripts/gcp/jupyter_configure.py | 4 ++-- .../src/general/scripts/gcp/jupyterlab_configure.py | 4 ++-- .../src/general/scripts/gcp/rstudio_configure.py | 4 ++-- .../src/general/scripts/gcp/superset_configure.py | 4 ++-- .../src/general/scripts/gcp/tensor-rstudio_configure.py | 4 ++-- .../src/general/scripts/gcp/tensor_configure.py | 4 ++-- .../src/general/scripts/gcp/zeppelin_configure.py | 4 ++-- 9 files changed, 18 insertions(+), 16 deletions(-) diff --git a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py index 5b318c8..adaaf70 100644 --- a/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py +++ b/infrastructure-provisioning/src/general/lib/gcp/actions_lib.py @@ -757,8 +757,10 @@ class GCPActions: 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) + labels.update({"name": primary_image_name}) primary_params = {"name": primary_image_name, "sourceDisk": primary_disk_name, "labels": lables} primary_request = self.service.images().insert(project=self.project, body=primary_params) + labels.update({"name": secondary_image_name}) 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=[] diff --git a/infrastructure-provisioning/src/general/scripts/gcp/deeplearning_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/deeplearning_configure.py index f9762ac..238f9b4 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/deeplearning_configure.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/deeplearning_configure.py @@ -71,7 +71,7 @@ if __name__ == "__main__": notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], "project_tag": notebook_config['project_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} else: notebook_config['expected_primary_image_name'] = '{}-{}-{}-primary-image'.format( notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) @@ -79,7 +79,7 @@ if __name__ == "__main__": notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} # generating variables regarding EDGE proxy on Notebook instance instance_hostname = GCPMeta.get_private_ip_address(notebook_config['instance_name']) edge_instance_name = '{0}-{1}-{2}-edge'.format(notebook_config['service_base_name'], diff --git a/infrastructure-provisioning/src/general/scripts/gcp/jupyter_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/jupyter_configure.py index b8744e8..863be19 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/jupyter_configure.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/jupyter_configure.py @@ -71,7 +71,7 @@ if __name__ == "__main__": notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], "project_tag": notebook_config['project_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} else: notebook_config['expected_primary_image_name'] = '{}-{}-{}-primary-image'.format( notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) @@ -79,7 +79,7 @@ if __name__ == "__main__": notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} # generating variables regarding EDGE proxy on Notebook instance instance_hostname = GCPMeta.get_private_ip_address(notebook_config['instance_name']) edge_instance_name = '{0}-{1}-{2}-edge'.format(notebook_config['service_base_name'], diff --git a/infrastructure-provisioning/src/general/scripts/gcp/jupyterlab_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/jupyterlab_configure.py index fad785b..ee95260 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/jupyterlab_configure.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/jupyterlab_configure.py @@ -71,7 +71,7 @@ if __name__ == "__main__": notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], "project_tag": notebook_config['project_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} else: notebook_config['expected_primary_image_name'] = '{}-{}-{}-primary-image'.format( notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) @@ -79,7 +79,7 @@ if __name__ == "__main__": notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} # generating variables regarding EDGE proxy on Notebook instance instance_hostname = GCPMeta.get_private_ip_address(notebook_config['instance_name']) edge_instance_name = '{0}-{1}-{2}-edge'.format(notebook_config['service_base_name'], diff --git a/infrastructure-provisioning/src/general/scripts/gcp/rstudio_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/rstudio_configure.py index a51df46..6ea7a90 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/rstudio_configure.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/rstudio_configure.py @@ -72,7 +72,7 @@ if __name__ == "__main__": notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], "project_tag": notebook_config['project_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} else: notebook_config['expected_primary_image_name'] = '{}-{}-{}-primary-image'.format( notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) @@ -80,7 +80,7 @@ if __name__ == "__main__": notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} # generating variables regarding EDGE proxy on Notebook instance instance_hostname = GCPMeta.get_private_ip_address(notebook_config['instance_name']) edge_instance_name = '{0}-{1}-{2}-edge'.format(notebook_config['service_base_name'], diff --git a/infrastructure-provisioning/src/general/scripts/gcp/superset_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/superset_configure.py index 021eb4c..e43517e 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/superset_configure.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/superset_configure.py @@ -73,7 +73,7 @@ if __name__ == "__main__": notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], "project_tag": notebook_config['project_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} else: notebook_config['expected_primary_image_name'] = '{}-{}-{}-primary-image'.format( notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) @@ -81,7 +81,7 @@ if __name__ == "__main__": notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} # generating variables regarding EDGE proxy on Notebook instance instance_hostname = GCPMeta.get_private_ip_address(notebook_config['instance_name']) edge_instance_name = '{0}-{1}-{2}-edge'.format(notebook_config['service_base_name'], 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 282e0d0..cef61d1 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/tensor-rstudio_configure.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/tensor-rstudio_configure.py @@ -76,7 +76,7 @@ if __name__ == "__main__": notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], "project_tag": notebook_config['project_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} else: notebook_config['expected_primary_image_name'] = '{}-{}-{}-primary-image'.format( notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) @@ -84,7 +84,7 @@ if __name__ == "__main__": notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} # generating variables regarding EDGE proxy on Notebook instance instance_hostname = GCPMeta.get_private_ip_address(notebook_config['instance_name']) edge_instance_name = '{0}-{1}-{2}-edge'.format(notebook_config['service_base_name'], diff --git a/infrastructure-provisioning/src/general/scripts/gcp/tensor_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/tensor_configure.py index a50afd1..613b4a1 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/tensor_configure.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/tensor_configure.py @@ -72,7 +72,7 @@ if __name__ == "__main__": notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], "project_tag": notebook_config['project_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} else: notebook_config['expected_primary_image_name'] = '{}-{}-{}-primary-image'.format( notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) @@ -80,7 +80,7 @@ if __name__ == "__main__": notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} # generating variables regarding EDGE proxy on Notebook instance instance_hostname = GCPMeta.get_private_ip_address(notebook_config['instance_name']) edge_instance_name = '{0}-{1}-{2}-edge'.format(notebook_config['service_base_name'], diff --git a/infrastructure-provisioning/src/general/scripts/gcp/zeppelin_configure.py b/infrastructure-provisioning/src/general/scripts/gcp/zeppelin_configure.py index 4c7839b..d6c4fab 100644 --- a/infrastructure-provisioning/src/general/scripts/gcp/zeppelin_configure.py +++ b/infrastructure-provisioning/src/general/scripts/gcp/zeppelin_configure.py @@ -72,7 +72,7 @@ if __name__ == "__main__": notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], "project_tag": notebook_config['project_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} else: notebook_config['expected_primary_image_name'] = '{}-{}-{}-primary-image'.format( notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) @@ -80,7 +80,7 @@ if __name__ == "__main__": notebook_config['service_base_name'], notebook_config['endpoint_name'], os.environ['application']) notebook_config['image_labels'] = {"sbn": notebook_config['service_base_name'], "endpoint_tag": notebook_config['endpoint_tag'], - "product": "dlab"} + os.environ['conf_billing_tag_key']: os.environ['conf_billing_tag_value']} # generating variables regarding EDGE proxy on Notebook instance instance_hostname = GCPMeta.get_private_ip_address(notebook_config['instance_name']) edge_instance_name = '{0}-{1}-{2}-edge'.format(notebook_config['service_base_name'], --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
