mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 20:50:24 +00:00
Update pods for v1beta3 api
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
app.controller('ListPodsCtrl', [
|
||||
'$scope',
|
||||
'$routeParams',
|
||||
'k8sApi',
|
||||
'k8sv1Beta3Api',
|
||||
'lodash',
|
||||
'$location',
|
||||
function($scope, $routeParams, k8sApi, lodash, $location) {
|
||||
@@ -46,7 +46,7 @@ app.controller('ListPodsCtrl', [
|
||||
$scope.loading = false;
|
||||
};
|
||||
|
||||
function getPodName(pod) { return _.has(pod.labels, 'name') ? pod.labels.name : pod.id; }
|
||||
function getPodName(pod) { return _.has(pod.metadata.labels, 'name') ? pod.metadata.labels.name : pod.metadata.name; }
|
||||
|
||||
$scope.content = [];
|
||||
|
||||
@@ -66,34 +66,34 @@ app.controller('ListPodsCtrl', [
|
||||
data.items.forEach(function(pod) {
|
||||
var _containers = '', _images = '', _labels = '', _uses = '';
|
||||
|
||||
if (pod.desiredState.manifest) {
|
||||
Object.keys(pod.desiredState.manifest.containers)
|
||||
if (pod.spec) {
|
||||
Object.keys(pod.spec.containers)
|
||||
.forEach(function(key) {
|
||||
_containers += ', ' + pod.desiredState.manifest.containers[key].name;
|
||||
_images += ', ' + pod.desiredState.manifest.containers[key].image;
|
||||
_containers += ', ' + pod.spec.containers[key].name;
|
||||
_images += ', ' + pod.spec.containers[key].image;
|
||||
});
|
||||
}
|
||||
|
||||
if (pod.labels) {
|
||||
Object.keys(pod.labels)
|
||||
if (pod.metadata.labels) {
|
||||
Object.keys(pod.metadata.labels)
|
||||
.forEach(function(key) {
|
||||
if (key == 'name') {
|
||||
_labels += ', ' + pod.labels[key];
|
||||
_labels += ', ' + pod.metadata.labels[key];
|
||||
}
|
||||
if (key == 'uses') {
|
||||
_uses += ', ' + pod.labels[key];
|
||||
_uses += ', ' + pod.metadata.labels[key];
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$scope.content.push({
|
||||
pod: pod.id,
|
||||
ip: pod.currentState.podIP,
|
||||
pod: pod.metadata.name,
|
||||
ip: pod.status.podIP,
|
||||
containers: _fixComma(_containers),
|
||||
images: _fixComma(_images),
|
||||
host: pod.currentState.host,
|
||||
host: pod.spec.host,
|
||||
labels: _fixComma(_labels) + ':' + _fixComma(_uses),
|
||||
status: pod.currentState.status
|
||||
status: pod.status.phase
|
||||
});
|
||||
|
||||
});
|
||||
@@ -103,8 +103,8 @@ app.controller('ListPodsCtrl', [
|
||||
|
||||
$scope.getPodRestarts = function(pod) {
|
||||
var r = null;
|
||||
var container = _.first(pod.desiredState.manifest.containers);
|
||||
if (container) r = pod.currentState.info[container.name].restartCount;
|
||||
var container = _.first(pod.spec.containers);
|
||||
if (container) r = pod.status.containerStatuses[container.name].restartCount;
|
||||
return r;
|
||||
};
|
||||
|
||||
@@ -112,7 +112,7 @@ app.controller('ListPodsCtrl', [
|
||||
|
||||
$scope.podStatusClass = function(pod) {
|
||||
|
||||
var s = pod.currentState.status.toLowerCase();
|
||||
var s = pod.status.phase.toLowerCase();
|
||||
|
||||
if (s == 'running' || s == 'succeeded')
|
||||
return null;
|
||||
|
@@ -7,7 +7,7 @@ app.controller('PodCtrl', [
|
||||
'$scope',
|
||||
'$interval',
|
||||
'$routeParams',
|
||||
'k8sApi',
|
||||
'k8sv1Beta3Api',
|
||||
'$rootScope',
|
||||
function($scope, $interval, $routeParams, k8sApi, $rootScope) {
|
||||
'use strict';
|
||||
|
@@ -8,47 +8,44 @@
|
||||
</div>
|
||||
|
||||
<div class="heading">
|
||||
<span class="label">Pod:</span>
|
||||
<span>{{pod.id}}</span>
|
||||
<span class="label">Name:</span>
|
||||
<span>{{pod.metadata.name}}</span>
|
||||
</div>
|
||||
|
||||
|
||||
<table>
|
||||
<table class="align-top">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="name">Status</td>
|
||||
<td class="value">
|
||||
{{pod.currentState.status}} on <a ng-href="#/dashboard/groups/host/selector/host={{pod.currentState.host}}">{{pod.currentState.host}}</a>
|
||||
{{pod.status.phase}} on <a ng-href="#/dashboard/groups/host/selector/host={{pod.spec.host}}">{{pod.spec.host}}</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name">Created</td>
|
||||
<td class="value">
|
||||
{{pod.creationTimestamp | date:'medium'}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name">Pod Networking</td>
|
||||
<td class="value">
|
||||
{{pod.currentState.podIP}}
|
||||
<span ng-repeat="container in pod.desiredState.manifest.containers">
|
||||
<span ng-repeat="port in container.ports">
|
||||
: {{port.containerPort}}
|
||||
</span>
|
||||
</span>
|
||||
{{pod.metadata.creationTimestamp | date:'medium'}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name">Host Networking</td>
|
||||
<td class="value">
|
||||
{{pod.currentState.hostIP}}
|
||||
<span ng-repeat="container in pod.desiredState.manifest.containers">
|
||||
<span ng-repeat="port in container.ports">
|
||||
:{{port.hostPort}}
|
||||
{{pod.spec.host}}/{{pod.status.hostIP}}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="name">Pod Networking</td>
|
||||
<td class="value">
|
||||
{{pod.status.podIP}}
|
||||
<span ng-repeat="container in pod.spec.containers">
|
||||
<span ng-repeat="port in container.ports">
|
||||
<span ng-show="port.containerPort">
|
||||
{{port.name}}: {{port.containerPort}}{{$last ? '' : ', '}}
|
||||
</span>
|
||||
</span>
|
||||
</span>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -56,7 +53,7 @@
|
||||
<tr>
|
||||
<td class="name">Labels</td>
|
||||
<td class="value">
|
||||
<div ng-repeat="(label, value) in pod.labels">
|
||||
<div ng-repeat="(label, value) in pod.metadata.labels">
|
||||
{{label}}: {{value}}
|
||||
</div>
|
||||
</td>
|
||||
@@ -70,15 +67,38 @@
|
||||
<tr>
|
||||
<td>Name</td>
|
||||
<td>Image</td>
|
||||
<td>Ready</td>
|
||||
<td>Restarts</td>
|
||||
<td>State</td>
|
||||
</tr>
|
||||
<tr ng-repeat="container in pod.desiredState.manifest.containers">
|
||||
<tr ng-repeat="container in pod.status.containerStatuses">
|
||||
<td>{{container.name}}</td>
|
||||
<td>{{container.image}}</td>
|
||||
<td>{{pod.currentState.info[container.name].restartCount}}</td>
|
||||
<td>{{container.ready}}</td>
|
||||
<td>{{container.restartCount}}</td>
|
||||
<td>
|
||||
<div ng-show="container.state.running">
|
||||
<div class="run-state">Running</div>
|
||||
<div class="run-messages">Started: {{container.state.running.startedAt | date:'medium'}}</div>
|
||||
</div>
|
||||
<div ng-show="container.state.waiting">
|
||||
<div class="run-state">Wating</div>
|
||||
<div class="run-messages" ng-show="container.state.waiting.reason">Reason: {{container.state.waiting.reason}}</div>
|
||||
</div>
|
||||
<div ng-show="container.state.termination">
|
||||
<div class="run-state">Terminated</div>
|
||||
<div class="run-messages" ng-show="container.state.termination.reason">Reason: {{container.state.termination.reason}}</div>
|
||||
<div class="run-messages" ng-show="container.state.termination.message">Message: {{container.state.termination.message}}</div>
|
||||
<div class="run-messages">Exit Code: {{container.state.termination.exitCode}}</div>
|
||||
<div class="run-messages" ng-show="container.state.termination.signal">Signal: {{container.state.termination.signal}}</div>
|
||||
<div class="run-messages">Started: {{container.state.termination.startedAt | date:'medium'}}</div>
|
||||
<div class="run-messages">Finished: {{container.state.termination.finishedAt | date:'medium'}}</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
Reference in New Issue
Block a user