Skip to content

Commit

Permalink
Use the script configuration variable DISABLE_BACKUP_INSTANCE_TYPES t…
Browse files Browse the repository at this point in the history
…o control whether backup instance types are enabled or disabled (#1712)

* add a flag to disable the feature so that we could disable it in prod instance

* test

* test

* test

* remove console log

* test

* test

* remove console logs

---------

Co-authored-by: Yaqin Li <[email protected]>
  • Loading branch information
liyaqin1 and Yaqin Li authored Sep 11, 2024
1 parent 5d6238d commit 01f03af
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions deploy-board/deploy_board/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -534,11 +534,16 @@ Vue.component("hosttype-select", {
</span></div>\
</div>\
<div class="col-xs-1"></div>\
<div class="col-xs-3">\
<div class="col-xs-3" v-if="isVisible">\
<input type="checkbox" id="checkbox" v-bind:checked="enablemultiplehosttypes" v-on:click="enabletypeschange($event.target.checked)">\
<label for="checkbox">Enable Backup instance types</label>\
</div></div>',
props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes'],
props: ['label', 'title', 'selectoptions', 'showhelp', 'small', 'selectsearch', 'retired', 'enablemultiplehosttypes', 'disablebackupinstancetypes'],
computed: {
isVisible: function () {
return this.disablebackupinstancetypes === "False"
}
},
data: function () {
return {
width: this.small ? 'col-xs-4' : 'col-xs-10',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ <h4 class="panel-title pull-left">Capacity</h4>
@base-image-change="baseImageChange" @image-name-change="imageNameChange" @help-clicked="baseImageHelpClick" >
</baseimage-select>
<base-image-help v-show="showBaseImageHelp" v-bind:data="baseImageHelpData"></base-image-help>
<hosttype-select label="Host Type" title="Compute Capability of the host" v-model="selectedHostTypeValue" v-bind:selectoptions="hostTypeOptions" selectsearch="true"
<hosttype-select label="Host Type" title="Compute Capability of the host" v-model="selectedHostTypeValue" v-bind:selectoptions="hostTypeOptions" v-bind:disablebackupinstancetypes="disableBackupInstanceTypes" selectsearch="true"
showhelp="true" v-on:helpclick="hostTypeHelpClick" v-bind:enablemultiplehosttypes="enableMultipleHostTypes" v-on:enablemultiplehosttypesclick="selecttypes"></hosttype-select>
<hostype-help v-show="showHostTypeHelp" v-bind:data="hostTypeHelpData"></hostype-help>
<backup-hosttypes v-bind:backuphosttypes="backupHosttypes"></backup-hosttypes>
Expand Down Expand Up @@ -447,6 +447,7 @@ <h4 class="panel-title pull-left">Capacity</h4>
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",
Expand Down Expand Up @@ -556,6 +557,7 @@ <h4 class="panel-title pull-left">Capacity</h4>
puppetRepository,
hieraPaths,
deployServiceWikiUrl,
disableBackupInstanceTypes,
}),
methods: {
addConfig: function(config) {
Expand Down
9 changes: 6 additions & 3 deletions deploy-board/deploy_board/webapp/cluster_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -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, \
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 01f03af

Please sign in to comment.