@@ -3109,40 +3109,44 @@ controller: "SetHomePageModalController"
3109
3109
}
3110
3110
};
3111
3111
} ]), angular.module("openshiftConsole").factory("HPAService", [ "$filter", "$q", "LimitRangesService", "MetricsService", function(e, t, n, r) {
3112
- var a = function(e, t, n) {
3112
+ var a = e("annotation"), o = function(e, t, n) {
3113
3113
return _.every(n, function(n) {
3114
3114
return _.get(n, [ "resources", t, e ]);
3115
3115
});
3116
- }, o = function(e, t) {
3117
- return a(e, "requests", t);
3118
3116
}, i = function(e, t) {
3119
- return a(e, "limits", t);
3120
- }, s = function(e, t, r) {
3117
+ return o(e, "requests", t);
3118
+ }, s = function(e, t) {
3119
+ return o(e, "limits", t);
3120
+ }, c = function(e, t, r) {
3121
3121
return !!n.getEffectiveLimitRange(r, e, "Container")[t];
3122
- }, c = function(e, t) {
3123
- return s(e, "defaultRequest", t);
3124
3122
}, l = function(e, t) {
3125
- return s(e, "defaultLimit", t);
3126
- }, u = function(e, t, r) {
3127
- return !!n.hasClusterResourceOverrides(r) || (!(!o("cpu", e) && !c("cpu", t)) || !(!i("cpu", e) && !l("cpu", t)));
3128
- }, d = e("humanizeKind"), m = e("hasDeploymentConfig"), p = function(e) {
3123
+ return c(e, "defaultRequest", t);
3124
+ }, u = function(e, t) {
3125
+ return c(e, "defaultLimit", t);
3126
+ }, d = function(e, t, r) {
3127
+ return !!n.hasClusterResourceOverrides(r) || (!(!i("cpu", e) && !l("cpu", t)) || !(!s("cpu", e) && !u("cpu", t)));
3128
+ }, m = e("humanizeKind"), p = e("hasDeploymentConfig"), f = function(e) {
3129
3129
if (!e) return {
3130
3130
message: "Metrics might not be configured by your cluster administrator. Metrics are required for autoscaling.",
3131
3131
reason: "MetricsNotAvailable"
3132
3132
};
3133
- }, f = function(e, t, n) {
3133
+ }, g = function(e, t, n) {
3134
3134
var r, a = _.get(e, "spec.template.spec.containers", []);
3135
- if (!u (a, t, n)) return r = d (e.kind), {
3135
+ if (!d (a, t, n)) return r = m (e.kind), {
3136
3136
message: "This " + r + " does not have any containers with a CPU request set. Autoscaling will not work without a CPU request.",
3137
3137
reason: "NoCPURequest"
3138
3138
};
3139
- }, g = function(e) {
3139
+ }, v = function(e) {
3140
+ return _.some(e, function(e) {
3141
+ return a(e, "autoscaling.alpha.kubernetes.io/metrics");
3142
+ });
3143
+ }, h = function(e) {
3140
3144
if (_.size(e) > 1) return {
3141
3145
message: "More than one autoscaler is scaling this resource. This is not recommended because they might compete with each other. Consider removing all but one autoscaler.",
3142
3146
reason: "MultipleHPA"
3143
3147
};
3144
- }, v = function(e, t) {
3145
- if ("ReplicationController" === e.kind && m (e) && _.some(t, function() {
3148
+ }, y = function(e, t) {
3149
+ if ("ReplicationController" === e.kind && p (e) && _.some(t, function() {
3146
3150
return _.some(t, function(e) {
3147
3151
return "ReplicationController" === _.get(e, "spec.scaleTargetRef.kind");
3148
3152
});
@@ -3152,15 +3156,19 @@ reason: "DeploymentHasHPA"
3152
3156
};
3153
3157
};
3154
3158
return {
3155
- hasCPURequest: u,
3159
+ usesV2Metrics: function(e) {
3160
+ return v([ e ]);
3161
+ },
3162
+ hasCPURequest: d,
3156
3163
filterHPA: function(e, t, n) {
3157
3164
return _.filter(e, function(e) {
3158
3165
return e.spec.scaleTargetRef.kind === t && e.spec.scaleTargetRef.name === n;
3159
3166
});
3160
3167
},
3161
3168
getHPAWarnings: function(e, n, a, o) {
3162
3169
return !e || _.isEmpty(n) ? t.when([]) : r.isAvailable().then(function(t) {
3163
- return _.compact([ p(t), f(e, a, o), g(n), v(e, n) ]);
3170
+ var r = v(n);
3171
+ return _.compact([ f(t), !r && g(e, a, o), h(n), y(e, n) ]);
3164
3172
});
3165
3173
},
3166
3174
groupHPAs: function(e) {
@@ -7699,7 +7707,7 @@ return {
7699
7707
name: t,
7700
7708
value: e
7701
7709
};
7702
- }), "HorizontalPodAutoscaler" === n.kind) e.targetKind = _.get(a, "spec.scaleTargetRef.kind"), e.targetName = _.get(a, "spec.scaleTargetRef.name"), _.assign(e.autoscaling, {
7710
+ }), e.usesV2Metrics = c.usesV2Metrics(a), "HorizontalPodAutoscaler" === n.kind) e.targetKind = _.get(a, "spec.scaleTargetRef.kind"), e.targetName = _.get(a, "spec.scaleTargetRef.name"), _.assign(e.autoscaling, {
7703
7711
minReplicas: _.get(a, "spec.minReplicas"),
7704
7712
maxReplicas: _.get(a, "spec.maxReplicas"),
7705
7713
targetCPU: _.get(a, "spec.targetCPUUtilizationPercentage")
@@ -10259,13 +10267,14 @@ restrict: "E",
10259
10267
scope: {
10260
10268
autoscaling: "=model",
10261
10269
showNameInput: "=?",
10262
- nameReadOnly: "=?"
10270
+ nameReadOnly: "=?",
10271
+ showRequestInput: "=?"
10263
10272
},
10264
10273
templateUrl: "views/directives/osc-autoscaling.html",
10265
- link: function(t) {
10274
+ link: function(t, r, a ) {
10266
10275
t.nameValidation = n;
10267
- var r = e.DEFAULT_HPA_CPU_TARGET_PERCENT, a = _.get(t, "autoscaling.targetCPU");
10268
- _.isNil(a ) && r && _.set(t, "autoscaling.targetCPU", r );
10276
+ var o = e.DEFAULT_HPA_CPU_TARGET_PERCENT, i = _.get(t, "autoscaling.targetCPU");
10277
+ _.isNil(i ) && o && _.set(t, "autoscaling.targetCPU", o), "showRequestInput" in a || (t.showRequestInput = !0 );
10269
10278
}
10270
10279
};
10271
10280
} ]), angular.module("openshiftConsole").directive("oscSecrets", [ "$uibModal", "$filter", "APIService", "DataService", "SecretsService", function(e, t, n, r, a) {
0 commit comments