From 0b53d3484ef7ac6c3856effde48f7733d22a8445 Mon Sep 17 00:00:00 2001 From: Yaqin Li Date: Fri, 6 Sep 2024 22:56:49 +0000 Subject: [PATCH 1/8] add a flag to disable the feature so that we could disable it in prod instance --- deploy-board/deploy_board/settings.py | 1 + .../static/js/components/clusterconfigcomponents.js | 7 ++++--- .../templates/clusters/cluster_configuration.html | 4 +++- deploy-board/deploy_board/webapp/cluster_view.py | 7 +++++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/deploy-board/deploy_board/settings.py b/deploy-board/deploy_board/settings.py index bcfcc3b89e..2dcf6d1768 100644 --- a/deploy-board/deploy_board/settings.py +++ b/deploy-board/deploy_board/settings.py @@ -298,6 +298,7 @@ TELETRAAN_DISABLE_CREATE_ENV_PAGE = True if os.getenv("TELETRAAN_DISABLE_CREATE_ENV_PAGE", "false") == "true" else False +TELETRAAN_DISABLE_BACKUP_INSTANCE_TYPES = True if os.getenv("TELETRAAN_DISABLE_BACKUP_INSTANCE_TYPES", "false") == "true" else False TELETRAAN_REDIRECT_CREATE_ENV_PAGE_URL = os.getenv("TELETRAAN_REDIRECT_CREATE_ENV_PAGE_URL", None) TELETRAAN_CLUSTER_READONLY_FIELDS = os.getenv("TELETRAAN_CLUSTER_READONLY_FIELDS", "spiffe_id").split(",") IS_DURING_CODE_FREEZE = True if os.getenv("TELETRAAN_CODE_FREEZE", "false") == "true" else False diff --git a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js index a165b9354d..5e754de35c 100644 --- a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js +++ b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js @@ -534,17 +534,18 @@ Vue.component("hosttype-select", { \ \
\ -
\ +
\ \ \
', - props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes'], + props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes', 'disablebackupinstancetypes'], data: function () { return { width: this.small ? 'col-xs-4' : 'col-xs-10', formStyle: this.small ? '' : 'form-group', groupStyle: this.showhelp ? 'input-group' : '', - selectClass: this.selectsearch ? 'form-control single-select-search' : 'form-control' + selectClass: this.selectsearch ? 'form-control single-select-search' : 'form-control', + isVisible: this.disablebackupinstancetypes !== true } }, methods: { diff --git a/deploy-board/deploy_board/templates/clusters/cluster_configuration.html b/deploy-board/deploy_board/templates/clusters/cluster_configuration.html index ca6829a854..eaf2c23335 100644 --- a/deploy-board/deploy_board/templates/clusters/cluster_configuration.html +++ b/deploy-board/deploy_board/templates/clusters/cluster_configuration.html @@ -75,7 +75,7 @@

Capacity

@base-image-change="baseImageChange" @image-name-change="imageNameChange" @help-clicked="baseImageHelpClick" > - @@ -447,6 +447,7 @@

Capacity

const hieraPaths = `{{ puppet_hiera_paths }}`; const puppetRepository = `{{ puppet_repository }}`; const deployServiceWikiUrl = `{{ conflicting_deploy_service_wiki_url }}`; + const disableBackupInstanceTypes = `{{ disable_backup_instance_types}}`; var capacitySetting = new Vue({ el: "#mainPanel", @@ -556,6 +557,7 @@

Capacity

puppetRepository, hieraPaths, deployServiceWikiUrl, + disableBackupInstanceTypes, }), methods: { addConfig: function(config) { diff --git a/deploy-board/deploy_board/webapp/cluster_view.py b/deploy-board/deploy_board/webapp/cluster_view.py index e4ea472c1a..b078f5b488 100644 --- a/deploy-board/deploy_board/webapp/cluster_view.py +++ b/deploy-board/deploy_board/webapp/cluster_view.py @@ -83,6 +83,7 @@ def get(self, request, name, stage): 'default_cmp_arm_image': DEFAULT_CMP_ARM_IMAGE, 'default_host_type': DEFAULT_CMP_HOST_TYPE, 'default_arm_host_type': DEFAULT_CMP_ARM_HOST_TYPE, + 'disable_backup_instance_types': TELETRAAN_DISABLE_BACKUP_INSTANCE_TYPES, 'capacity_creation_info': json.dumps(capacity_creation_info)}) def post(self, request, name, stage): @@ -192,7 +193,8 @@ def get(self, request, name, stage): 'is_pinterest': IS_PINTEREST, 'puppet_repository': PUPPET_CONFIG_REPOSITORY, 'puppet_hiera_paths': PUPPET_HIERA_PATHS, - 'conflicting_deploy_service_wiki_url': CONFLICTING_DEPLOY_SERVICE_WIKI_URL + 'conflicting_deploy_service_wiki_url': CONFLICTING_DEPLOY_SERVICE_WIKI_URL, + 'disable_backup_instance_types': TELETRAAN_DISABLE_BACKUP_INSTANCE_TYPES }) def post(self, request, name, stage): @@ -306,7 +308,8 @@ def get(self, request, name, stage): 'is_pinterest': IS_PINTEREST, 'puppet_repository': PUPPET_CONFIG_REPOSITORY, 'puppet_hiera_paths': PUPPET_HIERA_PATHS, - 'conflicting_deploy_service_wiki_url': CONFLICTING_DEPLOY_SERVICE_WIKI_URL + 'conflicting_deploy_service_wiki_url': CONFLICTING_DEPLOY_SERVICE_WIKI_URL, + 'disable_backup_instance_types': TELETRAAN_DISABLE_BACKUP_INSTANCE_TYPES }) def post(self, request, name, stage): From 1f4e8ff1063e21e3882711c18a48062ffe01f88d Mon Sep 17 00:00:00 2001 From: Yaqin Li Date: Fri, 6 Sep 2024 23:27:37 +0000 Subject: [PATCH 2/8] test --- deploy-board/deploy_board/webapp/cluster_view.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy-board/deploy_board/webapp/cluster_view.py b/deploy-board/deploy_board/webapp/cluster_view.py index b078f5b488..df01bcf79b 100644 --- a/deploy-board/deploy_board/webapp/cluster_view.py +++ b/deploy-board/deploy_board/webapp/cluster_view.py @@ -20,7 +20,7 @@ from django.contrib.messages import get_messages from django.views.generic import View -from deploy_board.settings import IS_PINTEREST, RODIMUS_CLUSTER_REPLACEMENT_WIKI_URL, RODIMUS_AUTO_CLUSTER_REFRESH_WIKI_URL +from deploy_board.settings import IS_PINTEREST, RODIMUS_CLUSTER_REPLACEMENT_WIKI_URL, RODIMUS_AUTO_CLUSTER_REFRESH_WIKI_URL, TELETRAAN_DISABLE_BACKUP_INSTANCE_TYPES if IS_PINTEREST: from deploy_board.settings import DEFAULT_PROVIDER, DEFAULT_CMP_IMAGE, DEFAULT_CMP_ARM_IMAGE, \ DEFAULT_CMP_HOST_TYPE, DEFAULT_CMP_ARM_HOST_TYPE, DEFAULT_CMP_PINFO_ENVIRON, DEFAULT_CMP_ACCESS_ROLE, DEFAULT_CELL, DEFAULT_ARCH, \ From 8e37782159a83e30d592d514e7b5afafb9426fdd Mon Sep 17 00:00:00 2001 From: Yaqin Li Date: Fri, 6 Sep 2024 23:35:23 +0000 Subject: [PATCH 3/8] test --- .../deploy_board/static/js/components/clusterconfigcomponents.js | 1 + .../deploy_board/templates/clusters/cluster_configuration.html | 1 + 2 files changed, 2 insertions(+) diff --git a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js index 5e754de35c..887beb9ff3 100644 --- a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js +++ b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js @@ -540,6 +540,7 @@ Vue.component("hosttype-select", { ', props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes', 'disablebackupinstancetypes'], data: function () { + console.log(this.disablebackupinstancetypes); return { width: this.small ? 'col-xs-4' : 'col-xs-10', formStyle: this.small ? '' : 'form-group', diff --git a/deploy-board/deploy_board/templates/clusters/cluster_configuration.html b/deploy-board/deploy_board/templates/clusters/cluster_configuration.html index eaf2c23335..069af71ed4 100644 --- a/deploy-board/deploy_board/templates/clusters/cluster_configuration.html +++ b/deploy-board/deploy_board/templates/clusters/cluster_configuration.html @@ -448,6 +448,7 @@

Capacity

const puppetRepository = `{{ puppet_repository }}`; const deployServiceWikiUrl = `{{ conflicting_deploy_service_wiki_url }}`; const disableBackupInstanceTypes = `{{ disable_backup_instance_types}}`; + console.log(disableBackupInstanceTypes); var capacitySetting = new Vue({ el: "#mainPanel", From 8328cc706c75500b1745ec7eae283a2859f0e396 Mon Sep 17 00:00:00 2001 From: Yaqin Li Date: Fri, 6 Sep 2024 23:42:03 +0000 Subject: [PATCH 4/8] test --- .../static/js/components/clusterconfigcomponents.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js index 887beb9ff3..6d2df37ba9 100644 --- a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js +++ b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js @@ -546,7 +546,7 @@ Vue.component("hosttype-select", { formStyle: this.small ? '' : 'form-group', groupStyle: this.showhelp ? 'input-group' : '', selectClass: this.selectsearch ? 'form-control single-select-search' : 'form-control', - isVisible: this.disablebackupinstancetypes !== true + isVisible: !this.disablebackupinstancetypes } }, methods: { From b4b99fa7c543732fe675d4192e1e1c2c2e5e2516 Mon Sep 17 00:00:00 2001 From: Yaqin Li Date: Fri, 6 Sep 2024 23:49:12 +0000 Subject: [PATCH 5/8] remove console log --- .../deploy_board/static/js/components/clusterconfigcomponents.js | 1 - .../deploy_board/templates/clusters/cluster_configuration.html | 1 - 2 files changed, 2 deletions(-) diff --git a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js index 6d2df37ba9..79ccf581f4 100644 --- a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js +++ b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js @@ -540,7 +540,6 @@ Vue.component("hosttype-select", { ', props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes', 'disablebackupinstancetypes'], data: function () { - console.log(this.disablebackupinstancetypes); return { width: this.small ? 'col-xs-4' : 'col-xs-10', formStyle: this.small ? '' : 'form-group', diff --git a/deploy-board/deploy_board/templates/clusters/cluster_configuration.html b/deploy-board/deploy_board/templates/clusters/cluster_configuration.html index 069af71ed4..eaf2c23335 100644 --- a/deploy-board/deploy_board/templates/clusters/cluster_configuration.html +++ b/deploy-board/deploy_board/templates/clusters/cluster_configuration.html @@ -448,7 +448,6 @@

Capacity

const puppetRepository = `{{ puppet_repository }}`; const deployServiceWikiUrl = `{{ conflicting_deploy_service_wiki_url }}`; const disableBackupInstanceTypes = `{{ disable_backup_instance_types}}`; - console.log(disableBackupInstanceTypes); var capacitySetting = new Vue({ el: "#mainPanel", From e6f9fe2caa00530b4bd4e1d69037d5e23785a3bf Mon Sep 17 00:00:00 2001 From: Yaqin Li Date: Sat, 7 Sep 2024 00:01:23 +0000 Subject: [PATCH 6/8] test --- .../static/js/components/clusterconfigcomponents.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js index 79ccf581f4..6826c2a7cb 100644 --- a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js +++ b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js @@ -539,13 +539,18 @@ Vue.component("hosttype-select", { \ ', props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes', 'disablebackupinstancetypes'], + computed: { + isVisible: function () { + console.log(!this.disablebackupinstancetypes); + return !this.disablebackupinstancetypes + } + }, data: function () { return { width: this.small ? 'col-xs-4' : 'col-xs-10', formStyle: this.small ? '' : 'form-group', groupStyle: this.showhelp ? 'input-group' : '', selectClass: this.selectsearch ? 'form-control single-select-search' : 'form-control', - isVisible: !this.disablebackupinstancetypes } }, methods: { From 826f04b9620bcc40222121f3a7dac1e998edd8b8 Mon Sep 17 00:00:00 2001 From: Yaqin Li Date: Sat, 7 Sep 2024 00:07:46 +0000 Subject: [PATCH 7/8] test --- .../static/js/components/clusterconfigcomponents.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js index 6826c2a7cb..0f174e9977 100644 --- a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js +++ b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js @@ -541,8 +541,9 @@ Vue.component("hosttype-select", { props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes', 'disablebackupinstancetypes'], computed: { isVisible: function () { - console.log(!this.disablebackupinstancetypes); - return !this.disablebackupinstancetypes + console.log(this.disablebackupinstancetypes); + console.log(this.disablebackupinstancetypes === "False"); + return this.disablebackupinstancetypes === "False" } }, data: function () { @@ -550,7 +551,7 @@ Vue.component("hosttype-select", { width: this.small ? 'col-xs-4' : 'col-xs-10', formStyle: this.small ? '' : 'form-group', groupStyle: this.showhelp ? 'input-group' : '', - selectClass: this.selectsearch ? 'form-control single-select-search' : 'form-control', + selectClass: this.selectsearch ? 'form-control single-select-search' : 'form-control' } }, methods: { From 76ccd1d185ea1249e500a718bd80e84365a73836 Mon Sep 17 00:00:00 2001 From: Yaqin Li Date: Sat, 7 Sep 2024 00:14:48 +0000 Subject: [PATCH 8/8] remove console logs --- .../static/js/components/clusterconfigcomponents.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js index 0f174e9977..5668d00a0f 100644 --- a/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js +++ b/deploy-board/deploy_board/static/js/components/clusterconfigcomponents.js @@ -541,8 +541,6 @@ Vue.component("hosttype-select", { props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes', 'disablebackupinstancetypes'], computed: { isVisible: function () { - console.log(this.disablebackupinstancetypes); - console.log(this.disablebackupinstancetypes === "False"); return this.disablebackupinstancetypes === "False" } },