Skip to content
This repository has been archived by the owner on Oct 3, 2020. It is now read-only.

Commit

Permalink
avoid division by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
hjacobs committed Apr 19, 2020
1 parent b0a72ac commit bf7b895
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kube_resource_report/templates/elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{% if component.recommendation.cpu > component.requests.cpu: %}
<div class="recommendation-exceeds" title="Recommendation: {{ component.recommendation.cpu|round(3) }} CPUs"></div>
{% else: %}
<div class="recommendation" style="left:{{ component.recommendation.cpu * 100 / component.requests.cpu }}%" title="Recommendation: {{ component.recommendation.cpu|round(3) }} CPUs"></div>
<div class="recommendation" style="left:{{ component.recommendation.cpu * 100 / (component.requests.cpu + 0.001) }}%" title="Recommendation: {{ component.recommendation.cpu|round(3) }} CPUs"></div>
{% endif %}
{% endif %}
<progress class="progress" value="{{ component.requests.cpu }}" max="{{ component.requests.cpu }}"></progress>
Expand All @@ -25,7 +25,7 @@
{% if component.recommendation.memory > component.requests.memory: %}
<div class="recommendation-exceeds" title="Recommendation: {{ component.recommendation.memory|memory('MiB') }} MiB"></div>
{% else: %}
<div class="recommendation" style="left:{{ component.recommendation.memory * 100 / component.requests.memory }}%" title="Recommendation: {{ component.recommendation.memory|memory('MiB') }} MiB"></div>
<div class="recommendation" style="left:{{ component.recommendation.memory * 100 / (component.requests.memory + 1) }}%" title="Recommendation: {{ component.recommendation.memory|memory('MiB') }} MiB"></div>
{% endif %}
{% endif %}
<progress class="progress" value="{{ component.requests.memory }}" max="{{ component.requests.memory }}"></progress>
Expand Down

0 comments on commit bf7b895

Please sign in to comment.