提交 a35ccfc4 编写于 作者: B bryk

Show pod status and handle pods that are not running

Previously podst that weren't in the phase of success were displayed incorrecty in lots of places.
上级 643832d0
......@@ -60,6 +60,9 @@ type ReplicaSetPod struct {
// Name of the Pod.
Name string `json:"name"`
// Status of the Pod. See Kubernetes API for reference.
PodPhase api.PodPhase `json:"podPhase"`
// Time the Pod has started. Empty if not started.
StartTime *unversioned.Time `json:"startTime"`
......@@ -155,6 +158,7 @@ func GetReplicaSetDetail(client *client.Client, namespace, name string) (*Replic
for _, pod := range pods.Items {
podDetail := ReplicaSetPod{
Name: pod.Name,
PodPhase: pod.Status.Phase,
StartTime: pod.Status.StartTime,
PodIP: pod.Status.PodIP,
NodeName: pod.Spec.NodeName,
......
......@@ -132,6 +132,7 @@ backendApi.ReplicaSetSpec;
* @typedef {{
* name: string,
* startTime: ?string,
* status: string,
* podIP: string,
* nodeName: string,
* restartCount: number
......@@ -181,7 +182,7 @@ backendApi.PodContainer;
/**
* @typedef {{
* name: string,
* startTime: string,
* startTime: ?string,
* totalRestartCount: number,
* podContainers: !Array<!backendApi.PodContainer>
* }}
......
......@@ -35,12 +35,19 @@ limitations under the License.
</md-option>
</md-select>
</div>
<span class="kd-logs-toolbar-text" flex>Running since {{ctrl.podCreationTime}}</span>
<span class="kd-logs-toolbar-text" flex>
<span ng-if="ctrl.podCreationTime">
Running since {{ctrl.podCreationTime | date:'short'}}
</span>
<span ng-if="!ctrl.podCreationTime">
Not running
</span>
</span>
<span flex></span>
<md-button class="kd-icon-button" id="colorText"
ng-click="ctrl.onTextColorChange()">
<md-icon md-font-library="material-icons"
ng-class=ctrl.getStyleClass()>
ng-class="ctrl.getStyleClass()">
format_color_text
</md-icon>
</md-button>
......
......@@ -56,9 +56,9 @@ export default class LogsToolbarController {
/**
* Pod creation time.
* @export {string}
* @export {?string}
*/
this.podCreationTime = new Date(Date.parse(this.pod.startTime)).toLocaleString();
this.podCreationTime = this.pod.startTime;
/**
* Namespace.
......
......@@ -103,6 +103,14 @@ limitations under the License.
Pod
</kd-sorted-header>
</th>
<th class="kd-replicasetdetail-table-header">
<kd-sorted-header currently-selected-column="ctrl.sortPodsBy"
currently-selected-order="ctrl.podsOrder"
column-name="status"
tooltip="Status of the pod">
Status
</kd-sorted-header>
</th>
<th class="kd-replicasetdetail-table-header">
<kd-sorted-header currently-selected-column="ctrl.sortPodsBy"
currently-selected-order="ctrl.podsOrder"
......@@ -162,11 +170,19 @@ limitations under the License.
<tr ng-repeat="pod in ctrl.replicaSetDetail.pods | orderBy:ctrl.sortPodsBy:ctrl.podsOrder">
<td class="kd-replicasetdetail-table-cell">{{pod.name}}</td>
<td class="kd-replicasetdetail-table-cell">
{{pod.restartCount}}<!-- TODO(maciaszczykm): Add info about last restart date. -->
{{::pod.podPhase}}
</td>
<td class="kd-replicasetdetail-table-cell">
{{pod.startTime | relativeTime}}
<md-tooltip>{{pod.startTime | date:'short'}}</md-tooltip>
{{::pod.restartCount}}<!-- TODO(maciaszczykm): Add info about last restart date. -->
</td>
<td class="kd-replicasetdetail-table-cell">
<span ng-if="::pod.startTime">
{{::pod.startTime | relativeTime}}
<md-tooltip>{{::(pod.startTime | date:'short')}}</md-tooltip>
</span>
<span ng-if="::!pod.startTime">
-
</span>
</td>
<td class="kd-replicasetdetail-table-cell">
0.4 CPU<!-- TODO(maciaszczykm): Fill with data and plot. -->
......@@ -174,8 +190,22 @@ limitations under the License.
<td class="kd-replicasetdetail-table-cell">
12 MB<!-- TODO(maciaszczykm): Fill with data and plot. -->
</td>
<td class="kd-replicasetdetail-table-cell">{{pod.podIP}}</td>
<td class="kd-replicasetdetail-table-cell">{{pod.nodeName}}</td>
<td class="kd-replicasetdetail-table-cell">
<span ng-if="::pod.podIP">
{{::pod.podIP}}
</span>
<span ng-if="::!pod.podIP">
-
</span>
</td>
<td class="kd-replicasetdetail-table-cell">
<span ng-if="::pod.nodeName">
{{::pod.nodeName}}
</span>
<span ng-if="::!pod.nodeName">
-
</span>
</td>
<td class="kd-replicasetdetail-table-cell">
<span>
Logs<i class="material-icons kd-replicasetdetail-table-icon">arrow_drop_down</i>
......
......@@ -32,8 +32,13 @@ limitations under the License.
<div class="kd-menu-logs-item kd-menu-logs-item-since">
<a ng-href="{{::ctrl.getLogsHref(pod.name, pod.podContainers[0].name)}}"
ng-if="::ctrl.podContainerExists(pod)">
{{pod.startTime | date:"short"}}<i
class="material-icons kd-menu-logs-link-icon">open_in_new</i>
<span ng-if="::pod.startTime">
{{pod.startTime | date:"short"}}
</span>
<span ng-if="::!pod.startTime">
Not running
</span>
<i class="material-icons kd-menu-logs-link-icon">open_in_new</i>
</a>
<span ng-if="::!ctrl.podContainerExists(pod)">-</span>
</div>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册