Skip to content

Commit

Permalink
fix(kubernetes): fixes autoscaler details, copying autoscaler in clon…
Browse files Browse the repository at this point in the history
…e stage
  • Loading branch information
danielpeach committed Apr 13, 2017
1 parent f5b331d commit aa5339a
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 10 deletions.
Expand Up @@ -53,8 +53,8 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv
viewState: {
mode: defaults.mode || 'create',
disableStrategySelection: true,
useAutoscaler: false,
},
useAutoscaler: false,
capacity: {
min: 1,
desired: 1,
Expand Down Expand Up @@ -103,6 +103,7 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv

command.viewState = {
mode: mode,
useAutoscaler: !!command.scalingPolicy,
};

if (!command.capacity) {
Expand Down Expand Up @@ -223,6 +224,7 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv
mode: 'editPipeline',
submitButtonLabel: 'Done',
requiresTemplateSelection: true,
useAutoscaler: false,
}
};
}
Expand All @@ -243,6 +245,7 @@ module.exports = angular.module('spinnaker.kubernetes.clusterCommandBuilder.serv
mode: 'editPipeline',
contextImages: contextImages,
submitButtonLabel: 'Done',
useAutoscaler: !!command.scalingPolicy,
};

if (!_.has(command, 'scalingPolicy.cpuUtilization.target')) {
Expand Down
Expand Up @@ -76,7 +76,7 @@ module.exports = angular.module('spinnaker.serverGroup.configure.kubernetes.clon

wizardSubFormValidation
.config({ scope: $scope, form: 'form' })
.register({ page: 'location', subForm: 'basicSettings'})
.register({page: 'location', subForm: 'basicSettings'})
.register({page: 'advanced-settings', subForm: 'advancedSettings'});
}

Expand Down
Expand Up @@ -6,10 +6,10 @@
<help-field key="kubernetes.serverGroup.autoscaling.enabled"></help-field>
</div>
<div class="col-md-2">
<input type="checkbox" name="details" ng-model="command.useAutoscaler"/>
<input type="checkbox" name="details" ng-model="command.viewState.useAutoscaler"/>
</div>
</div>
<div ng-show="!command.useAutoscaler">
<div ng-show="!command.viewState.useAutoscaler">
<div class="form-group">
<div class="col-md-2 col-md-offset-3"></div>
</div>
Expand All @@ -22,7 +22,7 @@
</div>
</div>
</div>
<div ng-show="command.useAutoscaler">
<div ng-show="command.viewState.useAutoscaler">
<div class="form-group">
<div class="col-md-2 col-md-offset-3">Min</div>
<div class="col-md-2">Max</div>
Expand Down Expand Up @@ -53,7 +53,7 @@
</div>
<div class="col-md-3">
<div class="input-group">
<!-- Current utilization is based on requested CPU: it can be lager than 100% -->
<!-- Current utilization is based on requested CPU: it can be larger than 100% -->
<input type="number" class="form-control input-sm" name="details" ng-model="command.scalingPolicy.cpuUtilization.target"
min="0" />
<span class="input-group-addon">%</span>
Expand Down
Expand Up @@ -139,9 +139,9 @@ <h4 class="text-center" ng-if="serverGroup.isDisabled">[SERVER GROUP IS DISABLED
<dt>Target CPU</dt>
<dd>{{serverGroup.deployDescription.scalingPolicy.cpuUtilization.target}}%</dd>
<dt>Current CPU</dt>
<dd>{{serverGroup.autoscalerStatus.currentCpuUtilization}}%</dd>
<dt>Latest Rescale</dt>
<dd>{{serverGroup.autoscalerStatus.lastScaleTime | relativeTime}}</dd>
<dd>{{serverGroup.autoscalerStatus.currentCpuUtilization !== null ? serverGroup.autoscalerStatus.currentCpuUtilization : '- '}}%</dd>
<dt ng-if="serverGroup.autoscalerStatus.lastScaleTime">Latest Rescale</dt>
<dd ng-if="serverGroup.autoscalerStatus.lastScaleTime">{{serverGroup.autoscalerStatus.lastScaleTime | relativeTime}}</dd>
</div>
</dl>
</collapsible-section>
Expand Down
2 changes: 1 addition & 1 deletion app/scripts/modules/kubernetes/serverGroup/transformer.js
Expand Up @@ -30,7 +30,7 @@ module.exports = angular
delete array[index].imageId;
});

if (!command.useAutoscaler) {
if (!base.viewState.useAutoscaler) {
delete command.scalingPolicy;
delete command.capacity;
}
Expand Down

0 comments on commit aa5339a

Please sign in to comment.