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

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


The following commit(s) were added to refs/heads/odahu-integration by this push:
     new d5cfe64  [odahu-integration] Added gcr authentication and fixed some 
bugs
     new 383a6b1  Merge remote-tracking branch 'origin/odahu-integration' into 
odahu-integration
d5cfe64 is described below

commit d5cfe6457d68c6b5290e8074c52d6a53e5fc4a6a
Author: Demyan Mysakovets <[email protected]>
AuthorDate: Mon Mar 16 16:27:06 2020 +0200

    [odahu-integration] Added gcr authentication and fixed some bugs
---
 infrastructure-provisioning/scripts/deploy_dlab.py |  4 ++--
 .../src/general/conf/dlab.ini                      | 22 ++++++++++-------
 .../src/general/files/gcp/ssn_policy.json          |  3 ++-
 .../src/general/lib/gcp/meta_lib.py                |  5 +++-
 .../src/general/lib/os/debian/ssn_lib.py           |  2 +-
 .../src/general/scripts/gcp/odahu_deploy.py        | 18 +++++++-------
 .../src/general/scripts/gcp/odahu_resume.py        |  4 ++--
 .../src/general/scripts/gcp/odahu_suspend.py       |  6 ++---
 .../src/general/scripts/gcp/odahu_terminate.py     | 18 +++++++-------
 .../src/ssn/scripts/configure_docker.py            | 28 +++++++---------------
 10 files changed, 54 insertions(+), 56 deletions(-)

diff --git a/infrastructure-provisioning/scripts/deploy_dlab.py 
b/infrastructure-provisioning/scripts/deploy_dlab.py
index 9ba714b..d18a7ed 100644
--- a/infrastructure-provisioning/scripts/deploy_dlab.py
+++ b/infrastructure-provisioning/scripts/deploy_dlab.py
@@ -142,8 +142,8 @@ parser.add_argument('--billing_dataset_name', type=str, 
default='', help='Name o
                                                                          ' for 
billing')
 parser.add_argument('--default_endpoint_name', type=str, default='local', 
help='Name of localhost provisioning service,'
                                                                                
'that created by default')
-parser.add_argument('--nexus_username', type=str, default='', help='Nexus 
repository username')
-parser.add_argument('--nexus_password', type=str, default='', help='Nexus 
repository password')
+parser.add_argument('--ssn_gcr_username', type=str, default='_json_key', 
help='Username for GCR authentication')
+parser.add_argument('--ssn_gcr_creds', type=str, default='', help='Base64 
encrypted json key for GCR authentication')
 parser.add_argument('--conf_stepcerts_enabled', type=str, default='false', 
help='Enable or disable step certificates')
 parser.add_argument('--conf_stepcerts_root_ca', type=str, default='', 
help='Step root CA')
 parser.add_argument('--conf_stepcerts_kid', type=str, default='', help='Step 
KID')
diff --git a/infrastructure-provisioning/src/general/conf/dlab.ini 
b/infrastructure-provisioning/src/general/conf/dlab.ini
index 70b7293..5b204d7 100644
--- a/infrastructure-provisioning/src/general/conf/dlab.ini
+++ b/infrastructure-provisioning/src/general/conf/dlab.ini
@@ -212,6 +212,10 @@ docker_version = 18.06.3
 # assume_role_arn =
 ### URL to Nexus repository
 nexus_url = ec2-35-163-186-140.us-west-2.compute.amazonaws.com:8083
+### Username for GCR authentication
+# gcr_username =
+### Base64 encrypted json key for GCR authentication
+# gcr_creds =
 
 #--- [edge] section contains all parameters that are using for edge node 
provisioning ---#
 [edge]
@@ -332,9 +336,9 @@ expl_instance_memory = 8000
 ###
 allowed_cidr = 0.0.0.0/0
 ###
-dns_zone_name = ailifecycle-org
+dns_zone_name = develop-dlabanalytics-com
 ###
-docker_repo = https://hub.docker.com/u/odahu
+docker_repo = odahu
 ###
 cidr = 172.31.0.0/24
 ###
@@ -348,15 +352,15 @@ k8s_version = 1.13.12
 ###
 helm_repo =  https://raw.githubusercontent.com/odahu/odahu-helm/master
 ###
-infra_version = 1.0.0
+infra_version = 1.1.0-rc8
 ###
-odahuflow_version = 1.0.0
+odahuflow_version = 1.1.0-rc8
 ###
-mlflow_toolchain_version = 1.0.0
+mlflow_toolchain_version = 1.1.0-rc8
 ###
-jupyterlab_version = 1.0.0
+jupyterlab_version = 1.1.0-rc8
 ###
-packager_version = 1.0.0-rc10
+packager_version = 1.1.0-rc10
 ###
 # node_locations =
 ###
@@ -364,11 +368,11 @@ node_version = 1.13.12-gke.2
 ###
 pods_cidr = 10.42.0.0/17
 ###
-root_domain = ailifecycle.org
+root_domain = develop.dlabanalytics.com
 ###
 service_cidr = 10.42.128.0/20
 ###
-dns_project_id = or2-msq-epmd-legn-t1iylu
+dns_project_id = or2-msq-epmc-dlab-t1iylu
 ###
 infra_vpc_peering = 0
 ###
diff --git a/infrastructure-provisioning/src/general/files/gcp/ssn_policy.json 
b/infrastructure-provisioning/src/general/files/gcp/ssn_policy.json
index fc06a3a..eb4ad12 100644
--- a/infrastructure-provisioning/src/general/files/gcp/ssn_policy.json
+++ b/infrastructure-provisioning/src/general/files/gcp/ssn_policy.json
@@ -33,5 +33,6 @@
     "iam.serviceAccountKeys.delete",
     "iam.serviceAccountKeys.get",
     "dns.resourceRecordSets.list",
-    "dns.managedZones.get"
+    "dns.managedZones.get",
+    "dns.managedZones.delete"
 ]
\ No newline at end of file
diff --git a/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py 
b/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
index 8932d9c..e8971a4 100644
--- a/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
+++ b/infrastructure-provisioning/src/general/lib/gcp/meta_lib.py
@@ -54,7 +54,7 @@ class GCPMeta:
                     ['https://www.googleapis.com/auth/compute',
                      'https://www.googleapis.com/auth/iam',
                      'https://www.googleapis.com/auth/cloud-platform'])
-            self.service = build('compute', 'v1', credentials=credentials)
+            self.[]
             self.service_iam = build('iam', 'v1', credentials=credentials)
             self.dataproc = build('dataproc', 'v1', credentials=credentials)
             self.service_storage = build('storage', 'v1', 
credentials=credentials)
@@ -765,9 +765,12 @@ class GCPMeta:
         try:
             request = self.service.regions().get(project=self.project, 
region=os.environ['gcp_region'])
             gpu_zones = ['asia-east1-a', 'asia-east1-c', 'australia1-c', 
'us-central1-c', 'us-central1-f', 'us-east1-b', 'us-east1-c', 'us-west1-a', 
'us-west1-b', 'europe-west1-b', 'europe-west1-d', 'europe-west4-a']
+            zone_full = []
             zone_list = []
             response = request.execute()
             for zone in response['zones']:
+                zone_full.append(str(zone.split('/')[-1]))
+            for zone in zone_full:
                 if zone in gpu_zones:
                     zone_list.append(str(zone.split('/')[-1]))
             return zone_list
diff --git a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py 
b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
index 4d3f339..814421e 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
@@ -333,7 +333,7 @@ def start_ss(keyfile, host_string, dlab_conf_dir, web_path,
                 append_result("Unable to generate cert and copy to java 
keystore")
                 sys.exit(1)
             sudo('service supervisor start')
-            #sudo('service nginx restart')
+            sudo('service nginx restart')
             sudo('service supervisor restart')
             sudo('touch ' + os.environ['ssn_dlab_path'] + 'tmp/ss_started')
     except Exception as err:
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/odahu_deploy.py 
b/infrastructure-provisioning/src/general/scripts/gcp/odahu_deploy.py
index 7e32297..07d1f5c 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/odahu_deploy.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/odahu_deploy.py
@@ -44,13 +44,13 @@ if __name__ == "__main__":
     odahu_conf['project_id'] = (os.environ['gcp_project_id'])
     odahu_conf['region'] = (os.environ['gcp_region'])
     odahu_conf['zone'] = (os.environ['gcp_zone'])
-    odahu_conf['node_locations'] = 
os.environ['odahu_node_locations'].split(',')
+    odahu_conf['node_locations'] = GCPMeta().get_available_zones()
     odahu_conf['dns_zone_name'] = os.environ['odahu_dns_zone_name']
     odahu_conf['docker_repo'] = os.environ['odahu_docker_repo']
     odahu_conf['odahu_cidr'] = os.environ['odahu_cidr']
     odahu_conf['service_base_name'] = 
(os.environ['conf_service_base_name']).lower().replace('_', '-')
     odahu_conf['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
-    odahu_conf['odahu_cluster_name'] = 
(os.environ['odahu_cluster_name']).lower().replace('_', '-')
+    odahu_conf['cluster_name'] = 
(os.environ['odahu_cluster_name']).lower().replace('_', '-')
     odahu_conf['bucket_name'] = 
"{}-tfstate".format((os.environ['odahu_cluster_name']).lower().replace('_', 
'-'))
     odahu_conf['static_address_name'] = 
"{}-nat-gw".format((os.environ['odahu_cluster_name']).lower().replace('_', '-'))
     try:
@@ -71,7 +71,7 @@ if __name__ == "__main__":
     odahu_conf['k8s_version'] = os.environ['odahu_k8s_version']
     odahu_conf['oauth_oidc_issuer_url'] = 
"{}/realms/{}".format(os.environ['keycloak_auth_server_url'],
                                                                 
os.environ['keycloak_realm_name'])
-    odahu_conf['oauth_oidc_host'] = os.environ['odahu_oauth_oidc_host']
+    odahu_conf['oauth_oidc_host'] = 
os.environ['keycloak_auth_server_url'].replace('https://', '').replace('/auth', 
'')
     odahu_conf['oauth_client_id'] = os.environ['keycloak_client_name']
     odahu_conf['oauth_client_secret'] = os.environ['keycloak_client_secret']
     odahu_conf['oauth_cookie_secret'] = base64.b64encode(id_generator(16))
@@ -97,7 +97,7 @@ if __name__ == "__main__":
         with open("/tmp/profile.json", 'w') as profile:
             prof = {"allowed_ips": odahu_conf['allowed_cidr'],
                     "cloud_type": "gcp",
-                    "cluster_name": 
"{}".format(odahu_conf['odahu_cluster_name']),
+                    "cluster_name": "{}".format(odahu_conf['cluster_name']),
                     "cluster_type": "gcp/gke",
                     "cluster_context": "",
                     "dns_zone_name": "{}".format(odahu_conf['dns_zone_name']),
@@ -105,12 +105,12 @@ if __name__ == "__main__":
                     "docker_repo": "{}".format(odahu_conf['docker_repo']),
                     "docker_user": "",
                     "gcp_cidr": "{}".format(odahu_conf['odahu_cidr']),
-                    "gke_node_tag": 
"{}-gke-node".format(odahu_conf['odahu_cluster_name']).split(','),
+                    "gke_node_tag": 
"{}-gke-node".format(odahu_conf['cluster_name']).split(','),
                     "grafana_admin": "{}".format(odahu_conf['grafana_admin']),
                     "grafana_pass": "BMuYxTw6v5",
                     "oauth_oidc_audience": "legion",
                     "oauth_oidc_issuer_url": 
"{}".format(odahu_conf['oauth_oidc_issuer_url']),
-                    "data_bucket": 
"{}-data-bucket".format(odahu_conf['odahu_cluster_name']),
+                    "data_bucket": 
"{}-data-bucket".format(odahu_conf['cluster_name']),
                     "helm_repo": "{}".format(odahu_conf['helm_repo']),
                     "odahu_infra_version": 
"{}".format(odahu_conf['odahu_infra_version']),
                     "odahuflow_version": 
"{}".format(odahu_conf['odahuflow_version']),
@@ -125,7 +125,7 @@ if __name__ == "__main__":
                     "oauth_cookie_secret": "OWl6VnV3SHNIQzVyMThqVw==",
                     "oauth_oidc_scope": "openid profile email offline_access 
groups",
                     "oauth_oidc_host": 
"{}".format(odahu_conf['oauth_oidc_host']),
-                    "oauth_oidc_jwks_url": 
"https://idp.demo.dlabanalytics.com/auth/realms/dlab/protocol/openid-connect/certs";,
+                    "oauth_oidc_jwks_url": 
"{}".format(odahu_conf['oauth_oidc_issuer_url']),
                     "oauth_oidc_port": 443,
                     "pods_cidr": "{}".format(odahu_conf['pods_cidr']),
                     "project_id": "{}".format(odahu_conf['project_id']),
@@ -133,7 +133,7 @@ if __name__ == "__main__":
                     "root_domain": "{}".format(odahu_conf['root_domain']),
                     "service_cidr": "{}".format(odahu_conf['service_cidr']),
                     "ssh_key": "{}".format(odahu_conf['ssh_key'].replace('\n', 
'')),
-                    "tfstate_bucket": 
"{}-tfstate".format(odahu_conf['odahu_cluster_name']),
+                    "tfstate_bucket": 
"{}-tfstate".format(odahu_conf['cluster_name']),
                     "tls_crt": "{}".format(odahu_conf['tls_crt']),
                     "tls_key": "{}".format(odahu_conf['tls_key']),
                     "zone": "{}".format(odahu_conf['zone']),
@@ -238,7 +238,7 @@ if __name__ == "__main__":
     # generating output information
     print('[SUMMARY]')
     logging.info('[SUMMARY]')
-    print('Cluster name: {}'.format(odahu_conf['odahu_cluster_name']))
+    print('Cluster name: {}'.format(odahu_conf['cluster_name']))
     with open('/tmp/result.json', 'r') as f:
         output = json.load(f)
         odahu_urls = json.dumps(output['odahu_urls']['value'], sort_keys=True, 
indent=4)
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/odahu_resume.py 
b/infrastructure-provisioning/src/general/scripts/gcp/odahu_resume.py
index 849c08c..e1b9536 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/odahu_resume.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/odahu_resume.py
@@ -46,7 +46,7 @@ if __name__ == "__main__":
     odahu_conf['project_id'] = (os.environ['gcp_project_id'])
     odahu_conf['region'] = (os.environ['gcp_region'])
     odahu_conf['zone'] = (os.environ['gcp_zone'])
-    odahu_conf['node_locations'] = 
os.environ['odahu_node_locations'].split(',')
+    odahu_conf['node_locations'] = GCPMeta().get_available_zones()
     odahu_conf['dns_zone_name'] = os.environ['odahu_dns_zone_name']
     odahu_conf['docker_repo'] = os.environ['odahu_docker_repo']
     odahu_conf['odahu_cidr'] = os.environ['odahu_cidr']
@@ -73,7 +73,7 @@ if __name__ == "__main__":
     odahu_conf['k8s_version'] = os.environ['odahu_k8s_version']
     odahu_conf['oauth_oidc_issuer_url'] = 
"{}/realms/{}".format(os.environ['keycloak_auth_server_url'],
                                                                 
os.environ['keycloak_realm_name'])
-    odahu_conf['oauth_oidc_host'] = os.environ['odahu_oauth_oidc_host']
+    odahu_conf['oauth_oidc_host'] = 
os.environ['keycloak_auth_server_url'].replace('https://', '').replace('/auth', 
'')
     odahu_conf['oauth_client_id'] = os.environ['keycloak_client_name']
     odahu_conf['oauth_client_secret'] = os.environ['keycloak_client_secret']
     odahu_conf['oauth_cookie_secret'] = os.environ['oauth_cookie_secret']
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/odahu_suspend.py 
b/infrastructure-provisioning/src/general/scripts/gcp/odahu_suspend.py
index 96b3103..b96c15e 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/odahu_suspend.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/odahu_suspend.py
@@ -44,13 +44,13 @@ if __name__ == "__main__":
     odahu_conf['project_id'] = (os.environ['gcp_project_id'])
     odahu_conf['region'] = (os.environ['gcp_region'])
     odahu_conf['zone'] = (os.environ['gcp_zone'])
-    odahu_conf['node_locations'] = 
os.environ['odahu_node_locations'].split(',')
+    odahu_conf['node_locations'] = GCPMeta().get_available_zones()
     odahu_conf['dns_zone_name'] = os.environ['odahu_dns_zone_name']
     odahu_conf['docker_repo'] = os.environ['odahu_docker_repo']
     odahu_conf['odahu_cidr'] = os.environ['odahu_cidr']
     odahu_conf['service_base_name'] = 
(os.environ['conf_service_base_name']).lower().replace('_', '-')
     odahu_conf['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
-    odahu_conf['odahu_cluster_name'] = 
(os.environ['odahu_cluster_name']).lower().replace('_', '-')
+    odahu_conf['cluster_name'] = 
(os.environ['odahu_cluster_name']).lower().replace('_', '-')
     odahu_conf['bucket_name'] = 
"{}-tfstate".format((os.environ['odahu_cluster_name']).lower().replace('_', 
'-'))
     odahu_conf['static_address_name'] = 
"{}-nat-gw".format((os.environ['odahu_cluster_name']).lower().replace('_', '-'))
     try:
@@ -71,7 +71,7 @@ if __name__ == "__main__":
     odahu_conf['k8s_version'] = os.environ['odahu_k8s_version']
     odahu_conf['oauth_oidc_issuer_url'] = 
"{}/realms/{}".format(os.environ['keycloak_auth_server_url'],
                                                                 
os.environ['keycloak_realm_name'])
-    odahu_conf['oauth_oidc_host'] = os.environ['odahu_oauth_oidc_host']
+    odahu_conf['oauth_oidc_host'] = 
os.environ['keycloak_auth_server_url'].replace('https://', '').replace('/auth', 
'')
     odahu_conf['oauth_client_id'] = os.environ['keycloak_client_name']
     odahu_conf['oauth_client_secret'] = os.environ['keycloak_client_secret']
     odahu_conf['oauth_cookie_secret'] = os.environ['oauth_cookie_secret']
diff --git 
a/infrastructure-provisioning/src/general/scripts/gcp/odahu_terminate.py 
b/infrastructure-provisioning/src/general/scripts/gcp/odahu_terminate.py
index 875e85c..b37a734 100644
--- a/infrastructure-provisioning/src/general/scripts/gcp/odahu_terminate.py
+++ b/infrastructure-provisioning/src/general/scripts/gcp/odahu_terminate.py
@@ -45,13 +45,13 @@ if __name__ == "__main__":
     odahu_conf['project_id'] = (os.environ['gcp_project_id'])
     odahu_conf['region'] = (os.environ['gcp_region'])
     odahu_conf['zone'] = (os.environ['gcp_zone'])
-    odahu_conf['node_locations'] = 
os.environ['odahu_node_locations'].split(',')
+    odahu_conf['node_locations'] = GCPMeta().get_available_zones()
     odahu_conf['dns_zone_name'] = os.environ['odahu_dns_zone_name']
     odahu_conf['docker_repo'] = os.environ['odahu_docker_repo']
     odahu_conf['odahu_cidr'] = os.environ['odahu_cidr']
     odahu_conf['service_base_name'] = 
(os.environ['conf_service_base_name']).lower().replace('_', '-')
     odahu_conf['project_name'] = 
(os.environ['project_name']).lower().replace('_', '-')
-    odahu_conf['odahu_cluster_name'] = 
(os.environ['odahu_cluster_name']).lower().replace('_', '-')
+    odahu_conf['cluster_name'] = 
(os.environ['odahu_cluster_name']).lower().replace('_', '-')
     odahu_conf['bucket_name'] = 
"{}-tfstate".format((os.environ['odahu_cluster_name']).lower().replace('_', 
'-'))
     odahu_conf['static_address_name'] = 
"{}-nat-gw".format((os.environ['odahu_cluster_name']).lower().replace('_', '-'))
     try:
@@ -72,7 +72,7 @@ if __name__ == "__main__":
     odahu_conf['k8s_version'] = os.environ['odahu_k8s_version']
     odahu_conf['oauth_oidc_issuer_url'] = 
"{}/realms/{}".format(os.environ['keycloak_auth_server_url'],
                                                                 
os.environ['keycloak_realm_name'])
-    odahu_conf['oauth_oidc_host'] = os.environ['odahu_oauth_oidc_host']
+    odahu_conf['oauth_oidc_host'] = 
os.environ['keycloak_auth_server_url'].replace('https://', '').replace('/auth', 
'')
     odahu_conf['oauth_client_id'] = os.environ['keycloak_client_name']
     odahu_conf['oauth_client_secret'] = os.environ['keycloak_client_secret']
     odahu_conf['oauth_cookie_secret'] = os.environ['oauth_cookie_secret']
@@ -98,7 +98,7 @@ if __name__ == "__main__":
         with open("/tmp/profile.json", 'w') as profile:
             prof = {"allowed_ips": odahu_conf['allowed_cidr'],
                     "cloud_type": "gcp",
-                    "cluster_name": 
"{}".format(odahu_conf['odahu_cluster_name']),
+                    "cluster_name": "{}".format(odahu_conf['cluster_name']),
                     "cluster_type": "gcp/gke",
                     "cluster_context": "",
                     "dns_zone_name": "{}".format(odahu_conf['dns_zone_name']),
@@ -106,12 +106,12 @@ if __name__ == "__main__":
                     "docker_repo": "{}".format(odahu_conf['docker_repo']),
                     "docker_user": "",
                     "gcp_cidr": "{}".format(odahu_conf['odahu_cidr']),
-                    "gke_node_tag": 
"{}-gke-node".format(odahu_conf['odahu_cluster_name']).split(','),
+                    "gke_node_tag": 
"{}-gke-node".format(odahu_conf['cluster_name']).split(','),
                     "grafana_admin": "{}".format(odahu_conf['grafana_admin']),
                     "grafana_pass": "BMuYxTw6v5",
                     "oauth_oidc_audience": "legion",
                     "oauth_oidc_issuer_url": 
"{}".format(odahu_conf['oauth_oidc_issuer_url']),
-                    "data_bucket": 
"{}-data-bucket".format(odahu_conf['odahu_cluster_name']),
+                    "data_bucket": 
"{}-data-bucket".format(odahu_conf['cluster_name']),
                     "helm_repo": "{}".format(odahu_conf['helm_repo']),
                     "odahu_infra_version": 
"{}".format(odahu_conf['odahu_infra_version']),
                     "odahuflow_version": 
"{}".format(odahu_conf['odahuflow_version']),
@@ -134,7 +134,7 @@ if __name__ == "__main__":
                     "root_domain": "{}".format(odahu_conf['root_domain']),
                     "service_cidr": "{}".format(odahu_conf['service_cidr']),
                     "ssh_key": "{}".format(odahu_conf['ssh_key'].replace('\n', 
'')),
-                    "tfstate_bucket": 
"{}-tfstate".format(odahu_conf['odahu_cluster_name']),
+                    "tfstate_bucket": 
"{}-tfstate".format(odahu_conf['cluster_name']),
                     "tls_crt": "{}".format(odahu_conf['tls_crt']),
                     "tls_key": "{}".format(odahu_conf['tls_key']),
                     "zone": "{}".format(odahu_conf['zone']),
@@ -237,7 +237,7 @@ if __name__ == "__main__":
         sys.exit(1)
 
     try:
-        buckets = GCPMeta().get_list_buckets(odahu_conf['odahu_cluster_name'])
+        buckets = GCPMeta().get_list_buckets(odahu_conf['cluster_name'])
         if 'items' in buckets:
             for i in buckets['items']:
                 GCPActions().remove_bucket(i['name'])
@@ -246,7 +246,7 @@ if __name__ == "__main__":
         sys.exit(1)
 
     try:
-        static_addresses = 
GCPMeta().get_list_static_addresses(odahu_conf['region'], 
odahu_conf['odahu_cluster_name'])
+        static_addresses = 
GCPMeta().get_list_static_addresses(odahu_conf['region'], 
odahu_conf['cluster_name'])
         if 'items' in static_addresses:
             for i in static_addresses['items']:
                 GCPActions().remove_static_address(i['name'], 
odahu_conf['region'])
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_docker.py 
b/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
index 20b9723..88d6f75 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_docker.py
@@ -39,9 +39,7 @@ parser.add_argument('--dlab_path', type=str, default='')
 parser.add_argument('--cloud_provider', type=str, default='')
 parser.add_argument('--resource', type=str, default='')
 parser.add_argument('--region', type=str, default='')
-parser.add_argument('--nexus_username', type=str, default='')
-parser.add_argument('--nexus_password', type=str, default='')
-parser.add_argument('--nexus_url', type=str, default='')
+parser.add_argument('--gcr_creds', type=str, default='')
 args = parser.parse_args()
 
 
@@ -81,21 +79,12 @@ def add_china_repository(dlab_path):
         sudo('sed -i "/pip install/s/jupyter/ipython==5.0.0 jupyter==1.0.0/g" 
Dockerfile')
         sudo('sed -i "22i COPY general/files/os/debian/sources.list 
/etc/apt/sources.list" Dockerfile')
 
-def prepare_odahu_image(nexus_username, nexus_password, nexus_url, dlab_path):
+def login_in_gcr(gcr_creds):
     try:
-        put('/root/templates/daemon.json', '/etc/docker/daemon.json', 
use_sudo=True)
-        print('daemon.json was placed')
-        # sudo('mv daemon.json /etc/docker/daemon.json')
-        # print ('daemon.json was moved')
-        sudo("sed -i \'s|<NEXUS_URL>|{}|g\' 
/etc/docker/daemon.json".format(nexus_url))
-        print('nexus url was filled in')
-        sudo('systemctl restart docker')
-        sudo('docker login -u {} -p {} {}'.format(nexus_username, 
nexus_password, nexus_url))
-        sudo(
-            "sed -i \'s|<NEXUS_URL>|{}|g\' 
{}sources/infrastructure-provisioning/src/general/files/gcp/odahu_Dockerfile".format(
-                nexus_url, dlab_path))
-    #            sudo("sed -i \'s|<ODAHU_REPO>|{}|g\' 
{}sources/infrastructure-provisioning/src/general/files/gcp/odahu_Dockerfile". \
-    #                 format(os.environ['odahu_docker_private_repo'], 
os.environ['ssn_dlab_path']))
+        with open('/tmp/dlab-gcr-ro-sa.json', 'w') as f:
+            f.write(json.dumps(gcr_creds))
+        sudo('cat /tmp/dlab-gcr-ro-sa.json | docker login -u _json_key 
--password-stdin https://gcr.io')
+        sudo('rm /tmp/dlab-gcr-ro-sa.json')
     except Exception as err:
         traceback.print_exc()
         print('Failed to prepare odahu image: ', str(err))
@@ -198,8 +187,9 @@ if __name__ == "__main__":
     if not ensure_docker_daemon(args.dlab_path, args.os_user, args.region):
         sys.exit(1)
 
-    #print("Preparing odahu image")
-    #prepare_odahu_image(args.nexus_username, args.nexus_password, 
args.nexus_url, args.dlab_path)
+    print("Login in Google Container Registry")
+    if not login_in_gcre(args.gcr_creds):
+        sys.exit(1)
 
     print("Building dlab images")
     count = 0


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to