Skip to content

Commit

Permalink
feat(provider/azure): Enable data disk for server group (#7116)
Browse files Browse the repository at this point in the history
* feat(provider/azure): Enable data disk for server group

* feat(provider/azure): Enable data disk for server group

* feat(provider/azure): Enable data disk for server group
  • Loading branch information
Neil Ye authored and maggieneterval committed Jun 14, 2019
1 parent 5cc4146 commit f650ca9
Show file tree
Hide file tree
Showing 6 changed files with 116 additions and 10 deletions.
8 changes: 8 additions & 0 deletions app/scripts/modules/azure/src/help/azure.help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,14 @@ const helpContents: { [key: string]: string } = {
} tags at most.`,
'azure.serverGroup.enableInboundNAT':
'An Azure load balancer of the basic sku will be created with adding inbound NAT port-forwarding rules to facilitate loggin on VM instances. There is no charge for creating an Azure load balancer of the basic sku. This option is disabled if Availability Zones are set which require Standard Azure Load Balancer and an extra Network Security Group with correct inbound and outbound rules configured.',
'azure.serverGroup.lun':
'Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM.',
'azure.serverGroup.diskSizeGB':
'Specifies the size of an empty data disk in gigabytes. This value cannot be larger than 1023 GB',
'azure.serverGroup.managedDisk.storageAccountType':
'You can choose between Azure managed disks types to support your workload or scenario.',
'azure.serverGroup.caching':
'Changing the default host caching policy can adversely impact the performance of your application. You should run performance tests to measure its impact. To improve the total IOPS/throughput, we recommend striping across multiple disks and using premium (SSD) disks.',
'azure.loadBalancer.dnsName':
'If there is no custom DNS label specified, a default DNS name will be created. The default value will be "GeneratedText.cloudapp.net" for Azure Application Gateway or "GeneratedText.[region].cloudapp.azure.com" for Azure Load Balancer.',
'azure.loadBalancer.probes.probeInterval':
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const angular = require('angular');
const _ = require('lodash');

import { NameUtils } from '@spinnaker/core';

Expand Down Expand Up @@ -41,6 +42,7 @@ module.exports = angular
zonesEnabled: false,
zones: [],
instanceTags: {},
dataDisks: [],
selectedProvider: 'azure',
viewState: {
instanceProfile: 'custom',
Expand Down Expand Up @@ -93,6 +95,7 @@ module.exports = angular
zones: serverGroup.zones,
zonesEnabled: serverGroup.zones && serverGroup.zones.length > 0,
instanceTags: {},
dataDisks: serverGroup.dataDisks,
sku: serverGroup.sku,
capacity: {
min: serverGroup.capacity.min,
Expand Down Expand Up @@ -123,10 +126,7 @@ module.exports = angular
if (typeof serverGroup.customScriptsSettings !== 'undefined') {
command.customScriptsSettings = {};
command.customScriptsSettings.commandToExecute = serverGroup.customScriptsSettings.commandToExecute;
if (
typeof serverGroup.customScriptsSettings.fileUris !== 'undefined' &&
serverGroup.customScriptsSettings.fileUris != ''
) {
if (!_.isEmpty(serverGroup.customScriptsSettings.fileUris)) {
azureServerGroupTransformer.parseCustomScriptsSettings(serverGroup, command);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ module.exports = angular
loadBalancerReader,
azureInstanceTypeService,
) {
var dataDiskTypes = ['Standard_LRS', 'StandardSSD_LRS', 'Premium_LRS'];
var dataDiskCachingTypes = ['None', 'ReadOnly', 'ReadWrite'];

var healthCheckTypes = ['EC2', 'ELB'],
terminationPolicies = [
'OldestInstance',
Expand All @@ -55,6 +58,8 @@ module.exports = angular
credentialsKeyedByAccount: AccountService.getCredentialsKeyedByAccount('azure'),
securityGroups: securityGroupReader.loadSecurityGroups(),
loadBalancers: loadBalancerReader.loadLoadBalancers(application.name),
dataDiskTypes: $q.when(angular.copy(dataDiskTypes)),
dataDiskCachingTypes: $q.when(angular.copy(dataDiskCachingTypes)),
})
.then(function(backingData) {
backingData.accounts = _.keys(backingData.credentialsKeyedByAccount);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="form-horizontal">
<div class="container-fluid form-horizontal">
<div class="form-group">
<div class="form-group">
<div class="col-md-4 sm-label-right">Number of Instances</div>
Expand Down Expand Up @@ -54,5 +54,78 @@
<help-field key="azure.serverGroup.enableInboundNAT"></help-field>
</div>
</div>
<div class="form-group">
<div class="col-md-4 sm-label-left">
Data Disks
</div>
<div class="col-md-11">
<table class="table table-condensed packed tags">
<thead>
<tr>
<th>
LUN
<help-field key="azure.serverGroup.lun"></help-field>
</th>
<th>
Size (GB)
<help-field key="azure.serverGroup.diskSizeGB"></help-field>
</th>
<th>
Type
<help-field key="azure.serverGroup.managedDisk.storageAccountType"></help-field>
</th>
<th>
Caching
<help-field key="azure.serverGroup.caching"></help-field>
</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="disk in adv.command.dataDisks">
<td>
<input type="number" class="form-control input-sm" ng-model="disk.lun" required min="0" />
</td>
<td>
<input type="number" class="form-control input-sm" ng-model="disk.diskSizeGB" required min="1" />
</td>
<td>
<ui-select ng-model="disk.managedDisk.storageAccountType" class="form-control input-sm" required>
<ui-select-match placeholder="Select...">{{$select.selected}}</ui-select-match>
<ui-select-choices
repeat="dataDiskType in adv.command.backingData.dataDiskTypes | filter: $select.search"
>
<span ng-bind-html="dataDiskType | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
</td>
<td>
<ui-select ng-model="disk.caching" class="form-control input-sm" required>
<ui-select-match placeholder="Select...">{{$select.selected}}</ui-select-match>
<ui-select-choices
repeat="dataDiskCachingType in adv.command.backingData.dataDiskCachingTypes | filter: $select.search"
>
<span ng-bind-html="dataDiskCachingType | highlight: $select.search"></span>
</ui-select-choices>
</ui-select>
</td>
<td>
<a class="btn btn-link sm-label" style="margin-top: 0;" ng-click="adv.removeDataDisk($index)">
<span class="glyphicon glyphicon-trash"></span>
</a>
</td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="4">
<button class="btn btn-block btn-sm add-new" ng-click="adv.addDataDisk()">
<span class="glyphicon glyphicon-plus-sign"></span> Add New Data Disk
</button>
</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,25 @@ module.exports = angular
controller: 'azureServerGroupAdvancedSettingsSelectorCtrl',
};
})
.controller('azureServerGroupAdvancedSettingsSelectorCtrl', function() {});
.controller('azureServerGroupAdvancedSettingsSelectorCtrl', function() {
this.addDataDisk = () => {
var newDataDisks = angular.copy(this.command.dataDisks);
this.command.dataDisks = newDataDisks.concat([
{
lun: 0,
managedDisk: {
storageAccountType: 'Standard_LRS',
},
diskSizeGB: 1,
caching: 'None',
createOption: 'Empty',
},
]);
};

this.removeDataDisk = index => {
var newDataDisks = angular.copy(this.command.dataDisks);
newDataDisks.splice(index, 1);
this.command.dataDisks = newDataDisks;
};
});
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const angular = require('angular');
const _ = require('lodash');

module.exports = angular
.module('spinnaker.azure.serverGroup.transformer', [])
Expand Down Expand Up @@ -94,6 +95,7 @@ module.exports = angular
capacity: command.sku.capacity,
},
instanceTags: command.instanceTags,
dataDisks: command.dataDisks,
viewState: command.viewState,
osConfig: {
customData: command.osConfig ? command.osConfig.customData : null,
Expand All @@ -116,10 +118,7 @@ module.exports = angular

if (typeof command.customScriptsSettings !== 'undefined') {
configuration.customScriptsSettings.commandToExecute = command.customScriptsSettings.commandToExecute;
if (
typeof command.customScriptsSettings.fileUris !== 'undefined' &&
command.customScriptsSettings.fileUris != ''
) {
if (!_.isEmpty(command.customScriptsSettings.fileUris)) {
parseCustomScriptsSettings(command, configuration);
}
}
Expand Down

0 comments on commit f650ca9

Please sign in to comment.