@spinnaker/google 0.1.13 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/autoscalingPolicy/IGceAutoscalingPolicy.d.ts +1 -1
  3. package/dist/autoscalingPolicy/components/scalingSchedules/scalingSchedules.component.d.ts +2 -0
  4. package/dist/autoscalingPolicy/components/scalingSchedules/timeZoneSelect.d.ts +13 -0
  5. package/dist/index.js +1 -1
  6. package/dist/index.js.map +1 -1
  7. package/dist/serverGroup/configure/wizard/autoScalingPolicy/autoScalingPolicySelector.component.d.ts +1 -0
  8. package/package.json +4 -4
  9. package/src/autoscalingPolicy/IGceAutoscalingPolicy.ts +1 -1
  10. package/src/autoscalingPolicy/components/metricSettings/metricSettings.component.html +85 -28
  11. package/src/autoscalingPolicy/components/metricSettings/metricSettings.component.js +18 -0
  12. package/src/autoscalingPolicy/components/scalingSchedules/scalingSchedules.component.html +84 -0
  13. package/src/autoscalingPolicy/components/scalingSchedules/scalingSchedules.component.js +59 -0
  14. package/src/autoscalingPolicy/components/scalingSchedules/standardTimezone.json +596 -0
  15. package/src/autoscalingPolicy/components/scalingSchedules/timeZoneSelect.tsx +63 -0
  16. package/src/help/gce.help.ts +8 -0
  17. package/src/serverGroup/configure/serverGroup.configure.gce.module.js +6 -0
  18. package/src/serverGroup/configure/serverGroupConfiguration.service.js +6 -0
  19. package/src/serverGroup/configure/wizard/autoScalingPolicy/autoScalingPolicy.html +20 -0
  20. package/src/serverGroup/configure/wizard/autoScalingPolicy/autoScalingPolicySelector.component.html +21 -0
  21. package/src/serverGroup/configure/wizard/autoScalingPolicy/autoScalingPolicySelector.component.js +47 -0
  22. package/src/serverGroup/configure/wizard/autoScalingPolicy/autoScalingPolicySelector.less +15 -0
  23. package/src/serverGroup/configure/wizard/cloneServerGroup.gce.controller.js +21 -3
  24. package/src/serverGroup/configure/wizard/serverGroupWizard.html +3 -0
  25. package/src/serverGroup/details/autoscalingPolicy/autoscalingPolicy.directive.js +88 -83
  26. package/src/serverGroup/details/autoscalingPolicy/modal/GceScaleInControls.tsx +13 -4
  27. package/src/serverGroup/details/autoscalingPolicy/modal/upsertAutoscalingPolicy.modal.controller.js +4 -0
  28. package/src/serverGroup/details/autoscalingPolicy/modal/upsertAutoscalingPolicy.modal.html +7 -0
  29. package/src/serverGroup/details/autoscalingPolicy/modal/upsertAutoscalingPolicy.modal.less +2 -1
@@ -0,0 +1 @@
1
+ export const GCE_AUTOSCALING_POLICY_SELECTOR_COMPONENT: "spinnaker.gce.autoScalingPolicy.selector.component";
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spinnaker/google",
3
3
  "license": "Apache-2.0",
4
- "version": "0.1.13",
4
+ "version": "0.2.0",
5
5
  "module": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
7
7
  "scripts": {
@@ -13,7 +13,7 @@
13
13
  "lib": "npm run build"
14
14
  },
15
15
  "dependencies": {
16
- "@spinnaker/core": "^0.21.0",
16
+ "@spinnaker/core": "^0.22.0",
17
17
  "@uirouter/angularjs": "1.0.26",
18
18
  "angular": "1.6.10",
19
19
  "angular-ui-bootstrap": "2.5.0",
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "devDependencies": {
29
29
  "@spinnaker/eslint-plugin": "^3.0.1",
30
- "@spinnaker/scripts": "^0.2.5",
30
+ "@spinnaker/scripts": "^0.3.0",
31
31
  "@types/angular": "1.6.26",
32
32
  "@types/angular-mocks": "1.5.10",
33
33
  "@types/angular-ui-bootstrap": "0.13.41",
@@ -37,5 +37,5 @@
37
37
  "shx": "0.3.3",
38
38
  "typescript": "4.3.5"
39
39
  },
40
- "gitHead": "966862b2caf82b5c9879cf418a7c79ec51152dfd"
40
+ "gitHead": "3efb67c7d040c3b549e9d3f589663f4e70c74390"
41
41
  }
@@ -18,5 +18,5 @@ export interface IGceAutoscalingCpuUtilization {
18
18
 
19
19
  export enum GcePredictiveMethod {
20
20
  NONE = 'NONE',
21
- STANDARD = 'STANDARD',
21
+ STANDARD = 'OPTIMIZE_AVAILABILITY',
22
22
  }
@@ -3,7 +3,7 @@
3
3
  <ng-form name="cpuUtilization">
4
4
  <div ng-if="$ctrl.showMetric('cpuUtilization')">
5
5
  <div class="row">
6
- <div class="col-md-3 sm-label-right">
6
+ <div class="col-md-4 sm-label-right">
7
7
  Utilization Target (%)
8
8
  <help-field key="gce.serverGroup.scalingPolicy.cpuUtilization"></help-field>
9
9
  </div>
@@ -97,12 +97,13 @@
97
97
  <collapsible-section heading="Custom Metric Utilizations" expanded="true" subsection="true">
98
98
  <div class="section-body" ng-repeat="custom in $ctrl.policy.customMetricUtilizations track by $index">
99
99
  <hr ng-if="$index > 0" />
100
+
100
101
  <div class="row">
101
102
  <div class="col-md-3 sm-label-right">Metric Identifier</div>
102
- <div class="col-md-2 content-fields">
103
+ <div class="col-md-3 content-fields">
103
104
  <input class="form-control input-sm" required ng-model="custom.metric" />
104
105
  </div>
105
- <div class="col-md-offset-5 col-md-1">
106
+ <div class="col-md-offset-4 col-md-1">
106
107
  <button class="btn btn-sm btn-default" ng-click="$ctrl.deleteMetric('customMetricUtilizations', $index)">
107
108
  <span class="glyphicon glyphicon-trash visible-lg-inline"></span>
108
109
  <span class="visible-lg-inline">Delete</span>
@@ -110,32 +111,86 @@
110
111
  </div>
111
112
  </div>
112
113
  <div class="row">
113
- <div class="col-md-3 sm-label-right">
114
- Utilization Target
115
- <help-field key="gce.serverGroup.scalingPolicy.customMetricUtilizations"></help-field>
114
+ <div class="col-md-3 sm-label-right">Additional Filter Expression</div>
115
+ <div class="col-md-3 content-fields">
116
+ <input class="form-control input-sm" ng-model="custom.additionalFilter" />
116
117
  </div>
117
- <div class="col-md-2 content-fields">
118
- <input
119
- type="number"
120
- name="utilizationTarget"
121
- class="form-control input-sm"
122
- required
123
- ng-model="custom.utilizationTarget"
124
- />
125
- </div>
126
- <div class="col-md-2">
118
+ </div>
119
+
120
+ <div class="row">
121
+ <div class="col-md-3 sm-label-right">Metric Export Scope</div>
122
+ <div class="col-md-3">
127
123
  <select
128
124
  class="form-control input-sm"
129
- style="margin: 0px"
130
- ng-options="value as displayValue for (value, displayValue) in $ctrl.targetTypesToDisplayMap"
131
- ng-model="custom.utilizationTargetType"
125
+ ng-options="value as displayValue for (value, displayValue) in $ctrl.metricScopeTypesToDisplayMap"
126
+ ng-model="custom.metricExportScope"
132
127
  required
133
- >
134
- <option value="">-- Target Type --</option>
135
- </select>
128
+ ></select>
136
129
  </div>
137
- <div class="col-md-5 error-message" ng-if="custom.utilizationTarget <= 0">
138
- Utilization target must be greater than 0.0.
130
+ </div>
131
+
132
+ <div ng-if="$ctrl.isSingleTimeSeriesPerGroup('SINGLE_TIME_SERIES_PER_GROUP', $index)">
133
+ <div class="row">
134
+ <div class="col-md-3 sm-label-right">Scaling Policy</div>
135
+ <div class="col-md-3">
136
+ <select
137
+ class="form-control input-sm"
138
+ ng-options="value as displayValue for (value, displayValue) in $ctrl.scalingpolicyTypesToDisplayMap"
139
+ ng-model="custom.scalingpolicy"
140
+ required
141
+ ></select>
142
+ </div>
143
+ </div>
144
+
145
+ <div ng-if="$ctrl.isScalingPolicySingleInstanceAssignment('SINGLE_INSTANCE_ASSIGNMENT', $index)">
146
+ <div class="row">
147
+ <div class="col-md-3 sm-label-right">Single Instance Assignment</div>
148
+ <div class="col-md-3 content-fields">
149
+ <input
150
+ type="number"
151
+ name="singleInstanceAssignment"
152
+ class="form-control input-sm"
153
+ required
154
+ ng-model="custom.singleInstaceAssignment"
155
+ min="0"
156
+ />
157
+ </div>
158
+ </div>
159
+ </div>
160
+ </div>
161
+ <div
162
+ ng-if="
163
+ !$ctrl.isScalingPolicySingleInstanceAssignment('SINGLE_INSTANCE_ASSIGNMENT', $index) ||
164
+ !$ctrl.isSingleTimeSeriesPerGroup('SINGLE_TIME_SERIES_PER_GROUP', $index)
165
+ "
166
+ >
167
+ <div class="row">
168
+ <div class="col-md-3 sm-label-right">
169
+ Utilization Target
170
+ <help-field key="gce.serverGroup.scalingPolicy.customMetricUtilizations"></help-field>
171
+ </div>
172
+ <div class="col-md-3 content-fields">
173
+ <input
174
+ type="number"
175
+ name="utilizationTarget"
176
+ class="form-control input-sm"
177
+ required
178
+ ng-model="custom.utilizationTarget"
179
+ />
180
+ </div>
181
+ <div class="col-md-3">
182
+ <select
183
+ class="form-control input-sm"
184
+ ng-options="value as displayValue for (value, displayValue) in $ctrl.targetTypesToDisplayMap"
185
+ ng-model="custom.utilizationTargetType"
186
+ required
187
+ >
188
+ <option value="">-- Target Type --</option>
189
+ </select>
190
+ </div>
191
+ <div class="col-md-5 error-message" ng-if="custom.utilizationTarget <= 0">
192
+ Utilization target must be greater than 0.0.
193
+ </div>
139
194
  </div>
140
195
  </div>
141
196
  </div>
@@ -143,9 +198,11 @@
143
198
  <span class="glyphicon glyphicon-plus-sign"></span> Add custom metric
144
199
  </button>
145
200
  </collapsible-section>
146
- <div class="col-md-12" ng-if="$ctrl.showNoMetricsWarning()">
147
- <div class="alert alert-warning text-center">
148
- <i class="fa fa-exclamation-triangle pull-left"></i>
149
- <span>At least one metric is required.</span>
201
+ <div class="row">
202
+ <div class="col-md-12" ng-if="$ctrl.showNoMetricsWarning()">
203
+ <div class="alert alert-warning text-center">
204
+ <i class="fa fa-exclamation-triangle pull-left"></i>
205
+ <span>At least one metric is required.</span>
206
+ </div>
150
207
  </div>
151
208
  </div>
@@ -30,6 +30,16 @@ module(GOOGLE_AUTOSCALINGPOLICY_COMPONENTS_METRICSETTINGS_METRICSETTINGS_COMPONE
30
30
  DELTA_PER_MINUTE: 'Delta / minute',
31
31
  };
32
32
 
33
+ this.metricScopeTypesToDisplayMap = {
34
+ TIME_SERIES_PER_INSTANCE: 'Time series per instance',
35
+ SINGLE_TIME_SERIES_PER_GROUP: 'Single time series per group',
36
+ };
37
+
38
+ this.scalingpolicyTypesToDisplayMap = {
39
+ UTILIZATION_TARGET: 'Utilization target',
40
+ SINGLE_INSTANCE_ASSIGNMENT: 'singleInstanceAssignment',
41
+ };
42
+
33
43
  this.addMetric = (metricType) => {
34
44
  if (multipleAllowedFor[metricType]) {
35
45
  this.policy[metricType] = this.policy[metricType] || [];
@@ -54,6 +64,14 @@ module(GOOGLE_AUTOSCALINGPOLICY_COMPONENTS_METRICSETTINGS_METRICSETTINGS_COMPONE
54
64
  return !emptyOrUndefined(metric);
55
65
  };
56
66
 
67
+ this.isSingleTimeSeriesPerGroup = (scopeType, index) => {
68
+ if (this.policy.customMetricUtilizations[index].metricExportScope === scopeType) return true;
69
+ };
70
+
71
+ this.isScalingPolicySingleInstanceAssignment = (policyType, index) => {
72
+ if (this.policy.customMetricUtilizations[index].scalingpolicy === policyType) return true;
73
+ };
74
+
57
75
  this.showNoMetricsWarning = () => {
58
76
  return _.every(
59
77
  metricTypes.map((type) => {
@@ -0,0 +1,84 @@
1
+ <ng-form name="scalingSchedulesForm">
2
+ <div class="section-body" ng-repeat="schedule in $ctrl.policy.scalingSchedules track by $index">
3
+ <ng-form name="scalingSchedule">
4
+ <hr ng-if="$index > 0" />
5
+
6
+ <div class="row">
7
+ <div class="col-md-3 sm-label-right">Name</div>
8
+ <div class="col-md-3 content-fields">
9
+ <input class="form-control input-sm" required ng-model="schedule.scheduleName" />
10
+ </div>
11
+ <div class="col-md-offset-4 col-md-1">
12
+ <button class="btn btn-sm btn-default" ng-click="$ctrl.deleteSchedule('scalingSchedules', $index)">
13
+ <span class="glyphicon glyphicon-trash visible-lg-inline"></span>
14
+ <span class="visible-lg-inline">Delete</span>
15
+ </button>
16
+ </div>
17
+ </div>
18
+ <div class="row">
19
+ <div class="col-md-3 sm-label-right">Description</div>
20
+ <div class="col-md-3 content-fields">
21
+ <input class="form-control input-sm" ng-model="schedule.scheduleDescription" />
22
+ </div>
23
+ </div>
24
+ <div class="row">
25
+ <div class="col-md-3 sm-label-right">Enabled</div>
26
+ <input type="checkbox" class="col-md-1" ng-model="schedule.enabled" value="{schedule.enabled}" />
27
+ </div>
28
+ <div class="row">
29
+ <div class="col-md-3 sm-label-right">Minimum required instances</div>
30
+ <div class="col-md-3 content-fields">
31
+ <input
32
+ type="number"
33
+ name="minimumRequiredInstances"
34
+ class="form-control input-sm"
35
+ min="0"
36
+ required
37
+ ng-model="schedule.minimumRequiredInstances"
38
+ />
39
+ </div>
40
+ </div>
41
+ <div class="row">
42
+ <div class="col-md-3 sm-label-right">
43
+ CRON Expression
44
+ <help-field key="gce.serverGroup.scalingPolicy.cronExpression"></help-field>
45
+ </div>
46
+ <div class="col-md-3 content-fields">
47
+ <input class="form-control input-sm" required ng-model="schedule.scheduleCron" />
48
+ </div>
49
+ </div>
50
+ <div class="row">
51
+ <div class="col-md-3 sm-label-right">Time Zone</div>
52
+ <div class="col-md-3">
53
+ <gce-timezone-select
54
+ available-timezones="$ctrl.timezones"
55
+ selected-timezone="$ctrl.policy.scalingSchedules[$index].timezone"
56
+ select-timezone="$ctrl.selectTimezone"
57
+ target="$index"
58
+ ></gce-timezone-select>
59
+ </div>
60
+ </div>
61
+ <div class="row">
62
+ <div class="col-md-3 sm-label-right">Duration (seconds)</div>
63
+ <div class="col-md-3 content-fields">
64
+ <input
65
+ type="number"
66
+ name="duration"
67
+ class="form-control input-sm"
68
+ required
69
+ ng-model="schedule.duration"
70
+ min="301"
71
+ />
72
+ </div>
73
+ <div class="col-md-4 error-message" ng-if="scalingSchedule.duration.$error.min">
74
+ Must be greater than 300 seconds.
75
+ </div>
76
+ </div>
77
+ </ng-form>
78
+ </div>
79
+ <div class="schedule-container">
80
+ <button class="add-new col-md-12" ng-click="$ctrl.addSchedule('scalingSchedules')">
81
+ <span class="glyphicon glyphicon-plus-sign"></span> Add Scaling Schedule
82
+ </button>
83
+ </div>
84
+ </ng-form>
@@ -0,0 +1,59 @@
1
+ 'use strict';
2
+
3
+ import { module } from 'angular';
4
+ import _ from 'lodash';
5
+ import timezones from './standardTimezone.json';
6
+
7
+ export const GOOGLE_AUTOSCALINGPOLICY_COMPONENTS_SCALINGSCHEDULES_SCALINGSCHEDULES_COMPONENT =
8
+ 'spinnaker.deck.gce.autoscalingPolicy.scalingSchedules.component';
9
+ export const name = GOOGLE_AUTOSCALINGPOLICY_COMPONENTS_SCALINGSCHEDULES_SCALINGSCHEDULES_COMPONENT; // for backwards compatibility
10
+ module(GOOGLE_AUTOSCALINGPOLICY_COMPONENTS_SCALINGSCHEDULES_SCALINGSCHEDULES_COMPONENT, []).component(
11
+ 'gceAutoscalingPolicyScalingSchedules',
12
+ {
13
+ bindings: {
14
+ policy: '=',
15
+ updatePolicy: '<',
16
+ },
17
+ templateUrl: require('./scalingSchedules.component.html'),
18
+ controller: function () {
19
+ const multipleAllowedFor = {
20
+ scalingSchedules: true,
21
+ };
22
+
23
+ this.timezones = timezones;
24
+
25
+ this.addSchedule = (scheduleType) => {
26
+ if (multipleAllowedFor[scheduleType]) {
27
+ this.policy[scheduleType] = this.policy[scheduleType] || [];
28
+ this.policy[scheduleType].push({});
29
+ } else if (emptyOrUndefined(this.policy[scheduleType])) {
30
+ this.policy[scheduleType] = {};
31
+ }
32
+ };
33
+
34
+ this.deleteSchedule = (scheduleType, index) => {
35
+ if (multipleAllowedFor[scheduleType]) {
36
+ this.policy[scheduleType].splice(index, 1);
37
+ } else {
38
+ // sending an empty object to the API deletes the policy.
39
+ this.policy[scheduleType] = {};
40
+ }
41
+ };
42
+
43
+ this.selectTimezone = (timezone, index) => {
44
+ const { scalingSchedules } = this.policy;
45
+ const schedule = scalingSchedules[index];
46
+ scalingSchedules[index] = { ...schedule, timezone };
47
+
48
+ this.updatePolicy({
49
+ ...this.policy,
50
+ scalingSchedules: [...scalingSchedules],
51
+ });
52
+ };
53
+
54
+ function emptyOrUndefined(value) {
55
+ return _.isEqual(value, {}) || _.isUndefined(value);
56
+ }
57
+ },
58
+ },
59
+ );