You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dm...@apache.org on 2019/07/18 10:56:32 UTC

[incubator-dlab] 01/01: [DLAB-915] Added new deployment parameter to replace tag_resource_id in billing.yml

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

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

commit 92cb251c1ca1f7006424d5413f0fb3488196f548
Author: Dyoma33 <de...@gmail.com>
AuthorDate: Thu Jul 18 13:56:20 2019 +0300

    [DLAB-915] Added new deployment parameter to replace tag_resource_id in billing.yml
---
 infrastructure-provisioning/scripts/deploy_dlab.py                   | 1 +
 infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py     | 4 +++-
 infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py | 2 ++
 infrastructure-provisioning/src/ssn/scripts/configure_billing.py     | 3 ++-
 infrastructure-provisioning/src/ssn/scripts/configure_ui.py          | 3 ++-
 services/billing-aws/billing.yml                                     | 2 +-
 6 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/infrastructure-provisioning/scripts/deploy_dlab.py b/infrastructure-provisioning/scripts/deploy_dlab.py
index 434c97b..b62dabc 100644
--- a/infrastructure-provisioning/scripts/deploy_dlab.py
+++ b/infrastructure-provisioning/scripts/deploy_dlab.py
@@ -77,6 +77,7 @@ parser.add_argument('--key_path', type=str, default='', help='Path to admin key
 parser.add_argument('--conf_key_name', type=str, default='', help='Admin key name (WITHOUT ".pem")')
 parser.add_argument('--workspace_path', type=str, default='', help='Admin key name (WITHOUT ".pem")')
 parser.add_argument('--conf_tag_resource_id', type=str, default='dlab', help='The name of user tag')
+parser.add_argument('--conf_billing_tag', type=str, default='dlab', help='Billing tag')
 parser.add_argument('--aws_ssn_instance_size', type=str, default='t2.large', help='The SSN instance shape')
 parser.add_argument('--azure_ssn_instance_size', type=str, default='Standard_DS2_v2', help='The SSN instance shape')
 parser.add_argument('--gcp_ssn_instance_size', type=str, default='n1-standard-2', help='The SSN instance shape')
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 2b2c075..dcc7c30 100644
--- a/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
+++ b/infrastructure-provisioning/src/general/lib/os/debian/ssn_lib.py
@@ -169,7 +169,7 @@ def ensure_mongo():
 
 def start_ss(keyfile, host_string, dlab_conf_dir, web_path,
              os_user, mongo_passwd, keystore_passwd, cloud_provider,
-             service_base_name, tag_resource_id, account_id, billing_bucket,
+             service_base_name, tag_resource_id, billing_tag, account_id, billing_bucket,
              aws_job_enabled, dlab_path, billing_enabled,
              authentication_file, offer_number, currency,
              locale, region_info, ldap_login, tenant_id,
@@ -240,6 +240,7 @@ def start_ss(keyfile, host_string, dlab_conf_dir, web_path,
                 params = '--cloud_provider {} ' \
                          '--infrastructure_tag {} ' \
                          '--tag_resource_id {} ' \
+                         '--billing_tag {} ' \
                          '--account_id {} ' \
                          '--billing_bucket {} ' \
                          '--aws_job_enabled {} ' \
@@ -261,6 +262,7 @@ def start_ss(keyfile, host_string, dlab_conf_dir, web_path,
                          '--tags {}'.\
                             format(cloud_provider,
                                    service_base_name,
+                                   billing_tag,
                                    tag_resource_id,
                                    account_id,
                                    billing_bucket,
diff --git a/infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py b/infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py
index 87ce81c..8e0e4ed 100644
--- a/infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py
+++ b/infrastructure-provisioning/src/general/scripts/aws/ssn_configure.py
@@ -347,6 +347,7 @@ if __name__ == "__main__":
                  "--resource {} " \
                  "--service_base_name {} " \
                  "--tag_resource_id {} " \
+                 "--billing_tag {} " \
                  "--cloud_provider {} " \
                  "--account_id {} " \
                  "--billing_bucket {} " \
@@ -371,6 +372,7 @@ if __name__ == "__main__":
                    os.environ['conf_resource'],
                    os.environ['conf_service_base_name'],
                    os.environ['conf_tag_resource_id'],
+                   os.environ['conf_billing_tag'],
                    os.environ['conf_cloud_provider'],
                    os.environ['aws_account_id'],
                    os.environ['aws_billing_bucket'],
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_billing.py b/infrastructure-provisioning/src/ssn/scripts/configure_billing.py
index 7d07b50..210dc90 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_billing.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_billing.py
@@ -33,6 +33,7 @@ parser.add_argument('--infrastructure_tag', type=str, help='unique name for DLab
 parser.add_argument('--access_key_id', default='', type=str, help='AWS Access Key ID')
 parser.add_argument('--secret_access_key', default='', type=str, help='AWS Secret Access Key')
 parser.add_argument('--tag_resource_id', type=str, default='user:tag', help='The name of user tag')
+parser.add_argument('--billing_tag', type=str, default='dlab', help='Billing tag')
 parser.add_argument('--account_id', type=str, help='The ID of ASW linked account')
 parser.add_argument('--billing_bucket', type=str, help='The name of bucket')
 parser.add_argument('--aws_job_enabled', type=str, default='false', help='Billing format. Available options: true (aws), false(epam)')
@@ -74,7 +75,7 @@ def yml_billing(path):
             config_orig = config_orig.replace('<ACCOUNT_ID>', args.account_id)
             config_orig = config_orig.replace('<ACCESS_KEY_ID>', args.access_key_id)
             config_orig = config_orig.replace('<SECRET_ACCESS_KEY>', args.secret_access_key)
-            config_orig = config_orig.replace('<CONF_TAG_RESOURCE_ID>', args.tag_resource_id)
+            config_orig = config_orig.replace('<CONF_BILLING_TAG>', args.billing_tag)
             config_orig = config_orig.replace('<CONF_SERVICE_BASE_NAME>', args.infrastructure_tag)
             config_orig = config_orig.replace('<MONGODB_PASSWORD>', args.mongo_password)
             config_orig = config_orig.replace('<DLAB_ID>', args.dlab_id)
diff --git a/infrastructure-provisioning/src/ssn/scripts/configure_ui.py b/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
index 364a45f..06b5150 100644
--- a/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
+++ b/infrastructure-provisioning/src/ssn/scripts/configure_ui.py
@@ -44,6 +44,7 @@ parser.add_argument('--request_id', type=str, default='')
 parser.add_argument('--resource', type=str, default='')
 parser.add_argument('--service_base_name', type=str, default='')
 parser.add_argument('--tag_resource_id', type=str, default=None)
+parser.add_argument('--_billing_tag', type=str, default=None)
 parser.add_argument('--account_id', type=str, default=None)
 parser.add_argument('--billing_bucket', type=str, default=None)
 parser.add_argument('--aws_job_enabled', type=str, default=None)
@@ -233,7 +234,7 @@ if __name__ == "__main__":
     print("Starting Self-Service(UI)")
     start_ss(args.keyfile, env.host_string, dlab_conf_dir, web_path,
              args.os_user, mongo_passwd, keystore_passwd, args.cloud_provider,
-             args.service_base_name, args.tag_resource_id, args.account_id,
+             args.service_base_name, args.tag_resource_id, args.billing_tag, args.account_id,
              args.billing_bucket, args.aws_job_enabled, args.dlab_path, args.billing_enabled,
              args.authentication_file, args.offer_number, args.currency, args.locale,
              args.region_info, args.ldap_login, args.tenant_id, args.application_id,
diff --git a/services/billing-aws/billing.yml b/services/billing-aws/billing.yml
index 8b0c62e..ee70487 100644
--- a/services/billing-aws/billing.yml
+++ b/services/billing-aws/billing.yml
@@ -61,7 +61,7 @@ adapterOut:
 filter:
   - type: aws
     currencyCode: USD
-    columnDlabTag: <CONF_TAG_RESOURCE_ID>
+    columnDlabTag: <CONF_BILLING_TAG>
     serviceBaseName: <CONF_SERVICE_BASE_NAME>
 
 


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