Kubernetes Web View to list and view all Kubernetes resources https://kube-web-view.readthedocs.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

162 lines
6.8 KiB

{% extends "base.html" %}
{% block title %}{{ resource.name }} ({{resource.kind}}{% if namespace and resource.kind != 'Namespace': %} in {{namespace}}{% endif %}){% endblock %}
{% block content %}
<nav class="breadcrumb" aria-label="breadcrumbs">
<ul>
<li><a href="/clusters/{{ cluster }}">{{ cluster }}</a></li>
{% if namespace and resource.kind != 'Namespace': %}
<li><a href="/clusters/{{ cluster }}/namespaces/{{ namespace }}">{{ namespace }}</a></li>
<li><a href="/clusters/{{ cluster }}/namespaces/{{ namespace }}/{{ resource.endpoint }}">{{ resource.endpoint }}</a></li>
{% else: %}
<li><a href="/clusters/{{ cluster }}/{{ resource.endpoint }}">{{ resource.endpoint }}</a></li>
{% endif %}
<li class="is-active"><a href="#">{{ resource.name }}</a></li>
</ul>
</nav>
<h1 class="title">{{ resource.name }}
<span class="links">
<a
{% if namespace: %}
href="/clusters/{{ cluster }}/namespaces/{{ namespace }}/{{ resource.endpoint }}/{{ resource.name }}?download=yaml"
{% else: %}
href="/clusters/{{ cluster }}/{{ resource.endpoint }}/{{ resource.name }}?download=yaml"
{% endif %}
title="Download resource object as YAML"
class="button is-{{ theme.button_class }}">
<span class="icon"><i class="fas fa-file-download"></i></span>
</a>
{% for link in links: %}
<a href="{{ link.href }}"
class="button {{ link.class }}"
title="{{ link.title }}">
<span class="icon"><i class="fas fa-{{ link.icon }}"></i></span>
</a>
{% endfor %}
</span>
<span class="meta">
created {{ resource.metadata.creationTimestamp.replace('T', ' ').replace('Z', '') }},
version {{ resource.metadata.resourceVersion }}
</span>
</h1>
<div class="tabs is-small">
<ul>
<li {% if view != 'yaml': %} class="is-active" {% endif %}><a href="?">Default</a></li>
<li {% if view == 'yaml': %} class="is-active" {% endif %}><a href="?view=yaml">YAML</a></li>
{% if resource.kind in ('Pod', 'Deployment', 'ReplicaSet', 'DaemonSet', 'StatefulSet'): %}
<li><a href="/clusters/{{ cluster }}/namespaces/{{ resource.metadata.namespace }}/{{ resource.endpoint }}/{{ resource.name }}/logs">Logs</a></li>
{% endif %}
</ul>
</div>
{% if view == 'yaml': %}
{% include "partials/yaml.html" %}
{% else: %}
<div class="section">
{% for key, val in resource.labels.items()|sort: %}
{% if namespace: %}
<a href="/clusters/{{ cluster }}/namespaces/{{ namespace }}/{{ resource.endpoint }}?selector={{key}}={{val}}"><span class="tag is-link">{{ key }}: {{ val }}</span></a>
{% else: %}
<a href="/clusters/{{ cluster }}/{{ resource.endpoint }}?selector={{key}}={{val}}"><span class="tag is-link">{{ key }}: {{ val }}</span></a>
{% endif %}
{% endfor %}
</div>
<div class="section">
{% for key, val in resource.annotations.items()|sort: %}
<span class="tag">{{ key }}: {{ val|truncate(40) }}</span>
{% endfor %}
</div>
{% if owners: %}
<div class="section">
Owner{{ 's' if owners|length > 1 }}:
{% for owner in owners: %}
{% if owner.namespaced: %}
<a href="/clusters/{{ cluster }}/namespaces/{{ namespace }}/{{ owner.class.endpoint }}/{{ owner.name }}">{{ owner.name }} ({{ owner.class.kind }})</a>
{% else: %}
<a href="/clusters/{{ cluster }}/{{ owner.class.endpoint }}/{{ owner.name }}">{{ owner.name }} ({{ owner.class.kind }})</a>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% for key, val in resource.obj.items()|sort: %}
{% if key not in ('metadata', 'apiVersion', 'kind'): %}
<div class="section collapsible" data-name="{{ key }}">
<h4 class="title is-5">{{ key|capitalize }}</h4>
<div class="content">
{{ val|yaml|highlight(config=config, cluster=cluster, namespace=namespace, resource=resource)|safe }}
</div>
</div>
{% endif %}
{% endfor %}
{% if resource.kind == "Namespace": %}
<div class="section">
<a href="/clusters/{{ cluster }}/namespaces/{{ namespace }}/all">Show all objects in this namespace</a>
</div>
<div class="section">
<a href="/clusters/{{ cluster }}/namespaces/{{ namespace }}/_resource-types">Show Resource Types in this namespace</a>
</div>
{% endif %}
{% if table: %}
<div class="section collapsible" data-name="pods">
<h4 class="title is-5">Pods</h4>
<table class="table is-striped">
<tr>
{% if not namespace: %}
<th>Namespace</th>
{% endif %}
{% for column in table.columns: %}
<th title="{{ column.description }}"><a href="{{ rel_url.update_query(sort=column.name) }}">{{ column.name }}</a></th>
{% endfor %}
<th><a href="{{ rel_url.update_query(sort='Created') }}">Created</th>
</tr>
{% for row in table.rows: %}
<tr>
{% if not namespace: %}
<td><a href="/clusters/{{ table.obj.cluster.name }}/namespaces/{{ row.object.metadata.namespace }}">{{ row.object.metadata.namespace }}</a></td>
{% endif %}
{% for cell in row.cells: %}
{% if loop.first: %}
{% if row.object.metadata.namespace: %}
<td><a href="/clusters/{{ table.obj.cluster.name }}/namespaces/{{ row.object.metadata.namespace }}/{{ table.api_obj_class.endpoint }}/{{ row.object.metadata.name }}">{{ cell }}</a></td>
{% else: %}
<td><a href="/clusters/{{ table.obj.cluster.name }}/{{ table.api_obj_class.endpoint }}/{{ row.object.metadata.name }}">{{ cell }}</a></td>
{% endif %}
{% else: %}
<td class="{{ get_cell_class(table, loop.index0, cell) }}"
{% if table.columns[loop.index0].name in ('Age', 'First Seen'): %}
style="color:{{ age_color(row.object.metadata.creationTimestamp, days=1) }}"
{% endif %}
>
{% if table.columns[loop.index0].name == 'Node': %}
<a href="/clusters/{{ table.obj.cluster.name }}/nodes/{{ cell }}">{{ cell if cell is not none}}</a>
{% else: %}
{{ cell if cell is not none}}
{% endif %}
</td>
{% endif %}
{% endfor %}
<td style="color:{{ age_color(row.object.metadata.creationTimestamp, days=1) }}">{{ row.object.metadata.creationTimestamp.replace('T', ' ').replace('Z', '') }}</td>
</tr>
{% else: %}
<tr>
<td colspan="{{ table.columns|length + 1 }}">No {{ table.api_obj_class.kind }} objects {% if namespace and not is_all_namespaces:%} in namespace "{{ namespace }}"{% endif %} found.</td>
</tr>
{% endfor %}
</table>
</div>
{% endif %}
<div class="section collapsible" data-name="events">
{% include "partials/events.html" %}
</div>
{% endif %}
{% endblock %}