{% macro color(failing, total) %} {% if failing == 0 %} is-success {% else %} {% if (failing / total) <= 0.1 %} is-warning {% else %} is-danger {% endif %} {% endif %} {% endmacro %} {% macro percentage(failing, total) %} {{ ((total - failing) / total) | round }} {% endmacro %} {% macro statistic(resource_name, failing, total) %} {% set success = total - failing %}

{{ resource_name | capitalize }}

{{ success }}/{{ total }}

{{ percentage(failing, total) }}
{% endmacro %} {% macro pods_table(pods) %}
{% for pod in pods %} {% if pod.init_done %} {% else %} {% endif %} {% if pod.init_done %} {% else %} {% endif %} {% endfor %}
Name Ready Status Reason Restarts
{{ pod.k8s.metadata.name }}{{ pod.running_containers }}/{{ (pod.containers | length) }}Init:{{ pod.runned_init_containers }}/{{ (pod.init_containers | length) }}{{ pod.k8s.status.phase }} {{ pod.k8s.status.reason }}{{ pod.restart_count }}{{ pod.init_restart_count }}
{% endmacro %} {% macro key_value_description_list(title, dict) %}
{{ title | capitalize }}:
{% if dict %} {% for key, value in dict.items() %} {% if loop.first %}
{% endif %}
{{ key }}:
{{ value }}
{% if loop.last %}
{% endif %} {% endfor %} {% endif %}
{% endmacro %} {% macro description(k8s) %}

Description

{% if k8s.spec.type %}
Type:
{{ k8s.spec.type }}
{% if (k8s.spec.type | lower) == "clusterip" %}
Headless:
{% if (k8s.spec.cluster_ip | lower) == "none" %}Yes{% else %}No{% endif %}
{% endif %} {% endif %} {{ key_value_description_list('Labels', k8s.metadata.labels) | indent(width=6) }} {{ key_value_description_list('Annotations', k8s.metadata.annotations) | indent(width=6) }} {% if k8s.spec.selector %} {% if k8s.spec.selector.match_labels %} {{ key_value_description_list('Selector', k8s.spec.selector.match_labels) | indent(width=6) }} {% else %} {{ key_value_description_list('Selector', k8s.spec.selector.to_dict()) | indent(width=6) }} {% endif %} {% endif %} {% if k8s.phase %}
Status:
{{ k8s.phase }}
{% endif %} {% if k8s.metadata.owner_references %}
Controlled By:
{{ k8s.metadata.owner_references[0].kind }}/{{ k8s.metadata.owner_references[0].name }}
{% endif %}
{% endmacro %} {% macro pods_container(pods, parent, has_title=True) %}
{% if has_title %}

Pods

{% endif %} {% if (pods | length) > 0 %} {{ pods_table(pods) | indent(width=2) }} {% else %}
{{ parent }} has no pods!
{% endif %}
{% endmacro %} {% macro two_level_breadcrumb(title, name) %}
{% endmacro %} {% macro pod_parent_summary(title, name, failed_pods, pods) %} {{ summary(title, name, [{'title': 'Pod', 'failing': failed_pods, 'total': (pods | length)}]) }} {% endmacro %} {% macro number_ok(number, none_value, total=None) %} {% if number %} {% if total and number < total %} {{ number }} {% else %} {{ number }} {% endif %} {% else %} {{ none_value }} {% endif %} {% endmacro %} {% macro summary(title, name, statistics) %}

{{ title | capitalize }} {{ name }} Summary

{% endmacro %} {% macro events(events) %} {% if events %}

Events

{% for event in events %} {% endfor %}
Type Count Reason Message
{{ event.type }} {{ event.count }} {{ event.reason }} {{ event.message }}
{% endif %} {% endmacro %} Tests results - {% block title %}{% endblock %} {% block more_head %}{% endblock %} {% block content %}{% endblock %}