Skip to content

Commit

Permalink
Merge pull request #3140 from spadgett/template-error
Browse files Browse the repository at this point in the history
Bug 1733806: Avoid runtime errors checking quota when processing template
  • Loading branch information
openshift-merge-robot authored Jul 29, 2019
2 parents 6a131a0 + c0d3f44 commit 8cd8bd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/scripts/services/quota.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ angular.module("openshiftConsole")
if (resource.kind === 'Pod') {
return filterQuotasForPodTemplate(resource, quotas);
}
else if (_.has(resource, "spec.template")) {
else if (_.has(resource, "spec.template.spec")) {
return filterQuotasForPodTemplate(resource.spec.template, quotas);
}
// We plan on having other resources that scopes will affect
Expand Down Expand Up @@ -156,7 +156,7 @@ angular.module("openshiftConsole")
var getResourceLimitAlerts = function(resource, quota){
var alerts = [];
var podTemplate = resource.kind === "Pod" ? resource : _.get(resource, 'spec.template');
if (!podTemplate) {
if (!podTemplate || !podTemplate.spec) {
// Didn't have a pod template, so we don't care about this resource
return alerts;
}
Expand Down
4 changes: 2 additions & 2 deletions dist/scripts/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -3790,7 +3790,7 @@ return !0;
});
});
}, S = function(e, t) {
return e ? "Pod" === e.kind ? b(e, t) : _.has(e, "spec.template") ? b(e.spec.template, t) : t : t;
return e ? "Pod" === e.kind ? b(e, t) : _.has(e, "spec.template.spec") ? b(e.spec.template, t) : t : t;
}, C = e("humanizeQuotaResource"), w = e("humanizeKind"), P = function(e, t, n) {
var r = e.status.total || e.status;
if (f(r.hard[n]) <= f(r.used[n])) {
Expand Down Expand Up @@ -3836,7 +3836,7 @@ target: "_blank"
}
}, I = function(e, t) {
var n = [], r = "Pod" === e.kind ? e : _.get(e, "spec.template");
return r ? (_.each([ "cpu", "memory", "requests.cpu", "requests.memory", "limits.cpu", "limits.memory", "pods" ], function(a) {
return r && r.spec ? (_.each([ "cpu", "memory", "requests.cpu", "requests.memory", "limits.cpu", "limits.memory", "pods" ], function(a) {
var o = t.status.total || t.status;
if (("Pod" !== e.kind || "pods" !== a) && _.has(o, [ "hard", a ]) && _.has(o, [ "used", a ])) {
var i = P(t, e, a);
Expand Down

0 comments on commit 8cd8bd0

Please sign in to comment.