Skip to content

Commit

Permalink
add backup instance stuff when creating a new cluster (#1714)
Browse files Browse the repository at this point in the history
* add backup instance stuff when creating a new cluster

* add backup info

---------

Co-authored-by: Yaqin Li <[email protected]>
  • Loading branch information
liyaqin1 and Yaqin Li committed Sep 12, 2024
1 parent 01f03af commit ccba4a7
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
17 changes: 15 additions & 2 deletions deploy-board/deploy_board/templates/configs/new_capacity.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ <h4 class="panel-title pull-left pointer-cursor">Basic Settings</h4>
<label>This is for CMP docker with cpu architecture x86_64 only hosts. For other types, please click the Advanced Settings on the left. </label>
</div>
<label-input label="Capacity" placeholder="# of instances" v-model="instanceCount"></label-input>
<hosttype-select label="Host Type" title="Compute Capability of the host" v-model="selectedHostTypeValue" v-bind:selectoptions="hostTypeOptions" selectsearch="true"></hosttype-select>
<hosttype-select label="Host Type" title="Compute Capability of the host" v-model="selectedHostTypeValue" v-bind:selectoptions="hostTypeOptions" selectsearch="true"
v-bind:disablebackupinstancetypes="disableBackupInstanceTypes" v-bind:enablemultiplehosttypes="enableMultipleHostTypes" v-on:enablemultiplehosttypesclick="selecttypes"></hosttype-select>
<backup-hosttypes v-bind:backuphosttypes="backupHosttypes"></backup-hosttypes>
<label-select label="Security Zone" title="Security zone to control inbound/outboud traffic" v-model="selectedSecurityZoneValue" v-bind:selectoptions="securityZoneOptions"></label-select>
<placements-select label="Placements" title="Placements" v-bind:assignpublicip="assignPublicIP"
v-bind:selectoptions="placements" v-on:assignpublicipclick="selectpublicip"></placements-select>
Expand Down Expand Up @@ -103,6 +105,7 @@ <h4 class="panel-title pull-left pointer-cursor">Basic Settings</h4>

var placements = getDefaultPlacement(capacityCreationInfo);
var hostTypes = getDefaultHostType(capacityCreationInfo.hostTypes, capacityCreationInfo.defaultHostType, capacityCreationInfo.defaultARMHostType);
const disableBackupInstanceTypes = `{{ disable_backup_instance_types}}`;

var capacitySetting = new Vue({
el:"#capacityPanel",
Expand Down Expand Up @@ -138,6 +141,9 @@ <h4 class="panel-title pull-left pointer-cursor">Basic Settings</h4>
}
}),
showStatefulHelp: false,
disableBackupInstanceTypes,
enableMultipleHostTypes: false,
backupHosttypes: "None",
},
methods:{
validateInput: function(clusterInfo){
Expand Down Expand Up @@ -202,6 +208,7 @@ <h4 class="panel-title pull-left pointer-cursor">Basic Settings</h4>
clusterInfo['hostType'] = this.selectedHostTypeValue;
clusterInfo['securityZone'] = this.selectedSecurityZoneValue;
clusterInfo['statefulStatus'] = this.selectedStatefulStatus;
clusterInfo['enableMultipleHostTypes'] = this.enableMultipleHostTypes;
if (this.selectedPlacements != null){
clusterInfo['placement'] = this.selectedPlacements.join(',');
}
Expand Down Expand Up @@ -244,6 +251,10 @@ <h4 class="panel-title pull-left pointer-cursor">Basic Settings</h4>
this.assignPublicIP = assignPublicIP;
this.placements = placements.getSimpleList(assignPublicIP, null);
},
selecttypes: function(value){
this.enableMultipleHostTypes = value;
this.backupHosttypes = getBackupIds(capacityCreationInfo.hostTypesMapping, capacityCreationInfo.hostTypes, capacitySetting.selectedHostTypeValue, this.enableMultipleHostTypes);
},
updateAwsRole: function(value){
this.awsRole = value
},
Expand Down Expand Up @@ -279,7 +290,9 @@ <h4 class="panel-title pull-left pointer-cursor">Basic Settings</h4>
$('.single-select-search').chosen({
"width": "100%"
}).change(function() {
capacitySetting.selectedHostTypeValue = $('.single-select-search').val()
capacitySetting.selectedHostTypeValue = $('.single-select-search').val();
capacitySetting.backupHosttypes = "None";
capacitySetting.enableMultipleHostTypes = false;
});

$(".chosen-select").chosen({
Expand Down
18 changes: 16 additions & 2 deletions deploy-board/deploy_board/templates/configs/new_capacity_adv.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,9 @@ <h4 class="panel-title pull-left">Capacity</h4>
</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"
showhelp="true" v-on:helpclick="hostTypeHelpClick"></hosttype-select>
showhelp="true" v-on:helpclick="hostTypeHelpClick" v-bind:disablebackupinstancetypes="disableBackupInstanceTypes" 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>
<label-select label="Security Zone" title="Security zone to control inbound/outboud traffic" showhelp="true" v-model="selectedSecurityZoneValue"
v-bind:selectoptions="securityZones" v-on:helpclick="securityZoneHelpClick"></label-select>
<securityzone-help v-show="showSecurityZoneHelp" v-bind:data="securityZoneHelpData"></securityzone-help>
Expand Down Expand Up @@ -123,6 +124,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 @@ -220,6 +222,9 @@ <h4 class="panel-title pull-left">Capacity</h4>
hieraPaths,
puppetRepository,
deployServiceWikiUrl,
disableBackupInstanceTypes,
enableMultipleHostTypes: false,
backupHosttypes: "None",
},
methods: {
addConfig: function (config) {
Expand Down Expand Up @@ -417,6 +422,8 @@ <h4 class="panel-title pull-left">Capacity</h4>
capacitySetting.hostTypeOptions = hostTypes.getOptions();
capacitySetting.selectedHostTypeValue = hostTypes.getSelectedId();
capacityCreationInfo.hostTypes = data;
capacitySetting.enableMultipleHostTypes = false;
capacitySetting.backupHosttypes = "None";
//Schedule this to nextTick that calls after next DOM refresh
//as JQuery chosen call must happen after DOM updates finished
Vue.nextTick(function(){
Expand Down Expand Up @@ -499,6 +506,10 @@ <h4 class="panel-title pull-left">Capacity</h4>
this.assignPublicIP = assignPublicIP
this.placements = placements.getFullList(assignPublicIP, null)
},
selecttypes: function(value){
this.enableMultipleHostTypes = value;
this.backupHosttypes = getBackupIds(info.hostTypesMapping, capacityCreationInfo.hostTypes, capacitySetting.selectedHostTypeValue, this.enableMultipleHostTypes);
},
validateInput: function (clusterInfo) {
//Validate input data.
var count = clusterInfo['capacity'];
Expand Down Expand Up @@ -613,6 +624,7 @@ <h4 class="panel-title pull-left">Capacity</h4>
clusterInfo['replacementTimeout'] = this.replacementTimeout;
clusterInfo['statefulStatus'] = this.selectedStatefulStatus;
clusterInfo['accountId'] = this.currentAccountId;
clusterInfo['enableMultipleHostTypes'] = this.enableMultipleHostTypes;
if (this.selectedPlacements != null && this.selectedPlacements.length>0){
clusterInfo['placement'] = this.selectedPlacements.join(',');
}
Expand Down Expand Up @@ -712,7 +724,9 @@ <h4 class="panel-title pull-left">Capacity</h4>
$('.single-select-search').chosen({
"width": "100%"
}).change(function() {
capacitySetting.selectedHostTypeValue = $('.single-select-search').val()
capacitySetting.selectedHostTypeValue = $('.single-select-search').val();
capacitySetting.backupHosttypes = "None";
capacitySetting.enableMultipleHostTypes = false;
});

$(".chosen-select").chosen({ "width": "100%" })
Expand Down
6 changes: 4 additions & 2 deletions deploy-board/deploy_board/webapp/cluster_view.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get(self, request, name, stage):
request, DEFAULT_ARCH)
for host_type in host_types:
host_type['mem'] = float(host_type['mem']) / 1024

host_types_mapping = hosttypesmapping_helper.get_fulllist(request)
security_zones = securityzones_helper.get_by_provider_and_cell_name(
request, None, DEFAULT_PROVIDER, DEFAULT_CELL)
placements = placements_helper.get_by_provider_and_cell_name(
Expand All @@ -59,6 +59,7 @@ def get(self, request, name, stage):
capacity_creation_info = {
'environment': env,
'hostTypes': host_types,
'hostTypesMapping': host_types_mapping,
'securityZones': security_zones,
'placements': placements,
'baseImages': default_base_image,
Expand Down Expand Up @@ -137,7 +138,7 @@ def get(self, request, name, stage):
request, DEFAULT_ARCH)
for host_type in host_types:
host_type['mem'] = float(host_type['mem']) / 1024

host_types_mapping = hosttypesmapping_helper.get_fulllist(request)
security_zones = securityzones_helper.get_by_provider_and_cell_name(
request, None, DEFAULT_PROVIDER, DEFAULT_CELL)
placements = placements_helper.get_by_provider_and_cell_name(
Expand All @@ -157,6 +158,7 @@ def get(self, request, name, stage):
capacity_creation_info = {
'environment': env,
'hostTypes': host_types,
'hostTypesMapping': host_types_mapping,
'securityZones': security_zones,
'placements': placements,
'cells': cells,
Expand Down

0 comments on commit ccba4a7

Please sign in to comment.