You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by my...@apache.org on 2020/03/20 14:31:46 UTC

[incubator-dlab] branch DLAB-1565-aws updated: [DLAB-1565]: [Azure] - billing on remote endpoint

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

mykolabodnar pushed a commit to branch DLAB-1565-aws
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-1565-aws by this push:
     new 67c5d7c  [DLAB-1565]: [Azure] - billing on remote endpoint
67c5d7c is described below

commit 67c5d7c1573376c3fc7c09924d38f043bd7d92bc
Author: bodnarmykola <bo...@gmail.com>
AuthorDate: Fri Mar 20 16:31:19 2020 +0200

    [DLAB-1565]: [Azure] - billing on remote endpoint
---
 .../terraform/azure/endpoint/main/variables.tf     | 20 +++++-
 .../terraform/bin/deploy/billing_azure.yml         | 59 ++++++++++++++++
 .../terraform/bin/deploy/endpoint_fab.py           | 80 +++++++++++++++++++++-
 infrastructure-provisioning/terraform/bin/dlab.py  | 10 +++
 4 files changed, 167 insertions(+), 2 deletions(-)

diff --git a/infrastructure-provisioning/terraform/azure/endpoint/main/variables.tf b/infrastructure-provisioning/terraform/azure/endpoint/main/variables.tf
index a00ce18..abc7e97 100644
--- a/infrastructure-provisioning/terraform/azure/endpoint/main/variables.tf
+++ b/infrastructure-provisioning/terraform/azure/endpoint/main/variables.tf
@@ -61,4 +61,22 @@ variable "ami" {
 
 variable "endpoint_volume_size" {}
 
-variable "key_path" {}
\ No newline at end of file
+variable "key_path" {}
+
+variable "authentication_file" {
+  default = ""
+}
+
+variable "offer_number" {}
+
+variable "currency" {}
+
+variable "locale" {}
+
+variable "region_info" {}
+
+variable "mongo_password" {}
+
+variable "mongo_host" {}
+
+variable "billing_enable" {}
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/bin/deploy/billing_azure.yml b/infrastructure-provisioning/terraform/bin/deploy/billing_azure.yml
new file mode 100644
index 0000000..66f5418
--- /dev/null
+++ b/infrastructure-provisioning/terraform/bin/deploy/billing_azure.yml
@@ -0,0 +1,59 @@
+spring:
+  main:
+    allow-bean-definition-overriding: true
+  data:
+    mongodb:
+      username: admin
+      password: MONGO_PASSWORD
+      database: dlabdb
+      port: MONGO_PORT
+      host: MONGO_HOST
+
+server:
+  port: 8088
+  servlet:
+    contextPath: /api/billing
+
+server.ssl.key-store-type: JKS
+server.ssl.key-store: /home/OS_USER/keys/endpoint.keystore.jks
+server.ssl.key-store-password: KEY_STORE_PASSWORD
+server.ssl.key-alias: endpoint
+
+logging:
+  file: /var/opt/dlab/log/ssn/billing.log
+  level:
+    com:
+      epam: trace
+
+keycloak:
+  bearer-only: true
+  realm: dlab
+  resource: KEYCLOAK_CLIENT_ID
+  credentials.secret: KEYCLOAK_CLIENT_SECRET
+  ssl-required: none
+  auth-server-url: KEYCLOAK_AUTH_SERVER_URL
+
+dlab:
+  sbn: SERVICE_BASE_NAME
+  billingEnabled: true
+  clientId: CLIENT_ID
+  clientSecret: CLIENT_SECRET
+  tenantId: TENANT_ID
+  subscriptionId: SUBSCRIPTION_ID
+  authenticationFile: AUTHENTICATION_FILE
+  # Billing configuration for RateCard API. For more details please see https://msdn.microsoft.com/en-us/library/mt219004.aspx
+  offerNumber: OFFER_NUMBER
+  currency: CURRENCY
+  locale: LOCALE
+  regionInfo: REGION_INFO
+  initialDelay: 10
+  period: 60
+  aggregationOutputMongoDataSource:
+    host: MONGO_HOST
+    port: MONGO_PORT
+    username: admin
+    password: MONGO_PASSWORD
+    database: dlabdb
+  ssnStorageAccountTagName: <AZURE_SSN_STORAGE_ACCOUNT_TAG>
+  sharedStorageAccountTagName: <AZURE_SHARED_STORAGE_ACCOUNT_TAG>
+  datalakeTagName: <AZURE_DATALAKE_TAG>
\ No newline at end of file
diff --git a/infrastructure-provisioning/terraform/bin/deploy/endpoint_fab.py b/infrastructure-provisioning/terraform/bin/deploy/endpoint_fab.py
index dc9c5ee..14593b1 100644
--- a/infrastructure-provisioning/terraform/bin/deploy/endpoint_fab.py
+++ b/infrastructure-provisioning/terraform/bin/deploy/endpoint_fab.py
@@ -343,9 +343,12 @@ def configure_supervisor_endpoint(endpoint_keystore_password):
                 args.subnet2_id = args.subnet_id
                 conn.sudo('sed -i "s|CONF_PARAMETER|--spring.config.location={0}billing_app.yml --conf |g" {1}/tmp/supervisor_svc.conf'
                           .format(dlab_conf_dir, args.dlab_path))
-            if args.cloud_provider == 'gcp':
+            elif args.cloud_provider == 'gcp':
                 conn.sudo('sed -i "s|CONF_PARAMETER|--spring.config.location=|g" {}/tmp/supervisor_svc.conf'
                           .format(args.dlab_path))
+            elif args.cloud_provider == 'azure':
+            conn.sudo('sed -i "s|CONF_PARAMETER|--conf |g" {}/tmp/supervisor_svc.conf'
+                      .format(args.dlab_path))
             conn.sudo('sed -i "s|OS_USR|{}|g" {}/tmp/supervisor_svc.conf'
                       .format(args.os_user, args.dlab_path))
             conn.sudo('sed -i "s|WEB_CONF|{}|g" {}/tmp/supervisor_svc.conf'
@@ -830,6 +833,81 @@ def configure_billing_endpoint(endpoint_keystore_password):
                         'value': args.keycloak_auth_server_url
                     }
                 ]
+            elif args.cloud_provider == 'azure':
+                billing_properties = [
+                    {
+                        'key': "SERVICE_BASE_NAME",
+                        'value': args.service_base_name
+                    },
+                    {
+                        'key': "OS_USER",
+                        'value': args.os_user
+                    },
+                    {
+                        'key': "MONGO_PASSWORD",
+                        'value': args.mongo_password
+                    },
+                    {
+                        'key': "MONGO_PORT",
+                        'value': args.mongo_port
+                    },
+                    {
+                        'key': "MONGO_HOST",
+                        'value': args.mongo_host
+                    },
+                    {
+                        'key': "KEY_STORE_PASSWORD",
+                        'value': endpoint_keystore_password
+                    },
+                    {
+                        'key': "KEYCLOAK_CLIENT_ID",
+                        'value': args.keycloak_client_id
+                    },
+                    {
+                        'key': "KEYCLOAK_CLIENT_SECRET",
+                        'value': args.keycloak_client_secret
+                    },
+                    {
+                        'key': "KEYCLOAK_AUTH_SERVER_URL",
+                        'value': args.keycloak_auth_server_url
+                    },
+                    {
+                        'key': "CLIENT_ID",
+                        'value': args.azure_client_id
+                    },
+                    {
+                        'key': "CLIENT_SECRET",
+                        'value': args.azure_client_secret
+                    },
+                    {
+                        'key': "TENANT_ID",
+                        'value': args.tenant_id
+                    },
+                    {
+                        'key': "SUBSCRIPTION_ID",
+                        'value': args.subscription_id
+                    },
+                    {
+                        'key': "AUTHENTICATION_FILE",
+                        'value': args.authentication_file
+                    },
+                    {
+                        'key': "OFFER_NUMBER",
+                        'value': args.offer_number
+                    },
+                    {
+                        'key': "CURRENCY",
+                        'value': args.currency
+                    },
+                    {
+                        'key': "LOCALE",
+                        'value': args.locale
+                    },
+                    {
+                        'key': "REGION_INFO",
+                        'value': args.region_info
+                    }
+                ]
             for param in billing_properties:
                 conn.sudo('sed -i "s|{0}|{1}|g" {2}'
                           .format(param['key'], param['value'], billing_yml_path))
diff --git a/infrastructure-provisioning/terraform/bin/dlab.py b/infrastructure-provisioning/terraform/bin/dlab.py
index 1ce6d07..c1a6da9 100644
--- a/infrastructure-provisioning/terraform/bin/dlab.py
+++ b/infrastructure-provisioning/terraform/bin/dlab.py
@@ -1246,6 +1246,16 @@ class AzureEndpointBuilder(AbstractDeployBuilder):
          .add_str('--endpoint_shape', 'Instance shape of Endpoint.', default='Standard_DS2_v2', group='endpoint')
          .add_str('--endpoint_volume_size', 'Endpoint disk size', default='30', group='endpoint')
          .add_str('--additional_tag', 'Additional tag.', default='product:dlab', group='endpoint')
+         .add_str('--tenant_id', 'Azure tenant ID', group='endpoint', default='')
+         .add_str('--subscription_id', 'Azure subscription ID', group='endpoint', default='')
+         .add_str('--authentication_file', 'authentication_file', group='endpoint', default='')
+         .add_str('--offer_number', 'Azure offer number', group='endpoint', default='')
+         .add_str('--currency', 'Azure currency for billing', group='endpoint', default='')
+         .add_str('--locale', 'Azure locale', group='endpoint', default='')
+         .add_str('--region_info', 'Azure region info', group='endpoint', default='')
+         .add_str('--mongo_password', 'Mongo database password', group='endpoint')
+         .add_str('--mongo_host', 'Mongo database host', group='endpoint', default='localhost')
+         .add_bool('--billing_enable', 'Billing enable', group='endpoint', default=False)
          )
         return params.build()
 


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