Update pods for v1beta3 api

This commit is contained in:
BC Broussard
2015-05-20 18:50:58 -07:00
parent e847b2d4f7
commit 040a4cfa8c
6 changed files with 216 additions and 156 deletions

View File

@@ -1467,7 +1467,7 @@ app.controller('ListMinionsCtrl', [
app.controller('ListPodsCtrl', [
'$scope',
'$routeParams',
'k8sApi',
'k8sv1Beta3Api',
'lodash',
'$location',
function($scope, $routeParams, k8sApi, lodash, $location) {
@@ -1510,7 +1510,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 = [];
@@ -1530,34 +1530,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
});
});
@@ -1567,8 +1567,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;
};
@@ -1576,7 +1576,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;
@@ -1848,7 +1848,7 @@ app.controller('PodCtrl', [
'$scope',
'$interval',
'$routeParams',
'k8sApi',
'k8sv1Beta3Api',
'$rootScope',
function($scope, $interval, $routeParams, k8sApi, $rootScope) {
'use strict';