diff --git a/app/scripts/controllers/monitoring.js b/app/scripts/controllers/monitoring.js index 45114d69fa..1c06fb5075 100644 --- a/app/scripts/controllers/monitoring.js +++ b/app/scripts/controllers/monitoring.js @@ -46,6 +46,9 @@ angular.module('openshiftConsole') }, { kind: "Builds" + }, + { + kind: "StatefulSets" } ]; $scope.kindSelector = { @@ -55,26 +58,30 @@ angular.module('openshiftConsole') $scope.logOptions = { pods: {}, replicationControllers: {}, - builds: {} + builds: {}, + statefulSets: {} }; $scope.logCanRun = { pods: {}, replicationControllers: {}, - builds: {} + builds: {}, + statefulSets: {} }; $scope.logEmpty = { pods: {}, replicationControllers: {}, - builds: {} + builds: {}, + statefulSets: {} }; $scope.expanded = { pods: {}, replicationControllers: {}, replicaSets: {}, - builds: {} + builds: {}, + statefulSets: {} }; var isNil = $filter('isNil'); @@ -86,7 +93,6 @@ angular.module('openshiftConsole') var ageFilteredBuilds, ageFilteredReplicationControllers, ageFilteredReplicaSets, ageFilteredPods; - // Check if the metrics service is available so we know when to show the tab. MetricsService.isAvailable().then(function(available) { $scope.metricsAvailable = available; }); @@ -105,8 +111,18 @@ angular.module('openshiftConsole') $scope.filteredReplicationControllers = KeywordService.filterForKeywords(ageFilteredReplicationControllers, filterFields, filterKeywords); $scope.filteredReplicaSets = KeywordService.filterForKeywords(ageFilteredReplicaSets, filterFields, filterKeywords); $scope.filteredBuilds = KeywordService.filterForKeywords(ageFilteredBuilds, filterFields, filterKeywords); + $scope.filteredStatefulSets = KeywordService.filterForKeywords(_.values($scope.statefulSets), filterFields, filterKeywords); }; + // TODO: logs for stateful sets will come later + // logging endpoint for stateful sets coming in the future. + // var setStatefulSetLogVars = function(set) { + // $scope.logOptions.statefulSets[set.metadata.name] = { + // container: set.spec.template.spec.containers[0].name + // }; + // $scope.logCanRun.statefulSets[set.metadata.name] = !(_.includes(['New', 'Pending', 'Unknown'], set.status.phase)); + // }; + var setPodLogVars = function(pod) { $scope.logOptions.pods[pod.metadata.name] = { container: pod.spec.containers[0].name @@ -128,6 +144,11 @@ angular.module('openshiftConsole') $scope.logCanRun.builds[build.metadata.name] = !(_.includes(['New', 'Pending', 'Error'], build.status.phase)); }; + + var filterStatefulSets = function() { + $scope.filteredStatefulSets = KeywordService.filterForKeywords(_.values($scope.statefulSets), filterFields, filterKeywords); + }; + var filterPods = function() { ageFilteredPods = _.filter($scope.pods, function(pod) { if (!$scope.filters.hideOlderResources) { @@ -237,6 +258,12 @@ angular.module('openshiftConsole') event = expanded ? 'event.resource.highlight' : 'event.resource.clear-highlight'; $rootScope.$emit(event, resource); break; + case 'StatefulSet': + expanded = !$scope.expanded.statefulSets[resource.metadata.name]; + $scope.expanded.statefulSets[resource.metadata.name] = expanded; + event = expanded ? 'event.resource.highlight' : 'event.resource.clear-highlight'; + $rootScope.$emit(event, resource); + break; } }; @@ -249,11 +276,11 @@ angular.module('openshiftConsole') }; var groupPods = function() { - if (!$scope.pods || !$scope.replicationControllers || !$scope.replicaSets) { + if (!$scope.pods || !$scope.replicationControllers || !$scope.replicaSets || !$scope.statefulSets) { return; } - var allOwners = _.toArray($scope.replicationControllers).concat(_.toArray($scope.replicaSets)); + var allOwners = _.toArray($scope.replicationControllers).concat(_.toArray($scope.replicaSets)).concat(_.toArray($scope.statefulSets)); $scope.podsByOwnerUID = LabelsService.groupBySelector($scope.pods, allOwners, { key: 'metadata.uid' }); }; @@ -273,6 +300,19 @@ angular.module('openshiftConsole') Logger.log("pods", $scope.pods); }); + DataService.watch({ + resource: 'statefulsets', + group: 'apps', + version: 'v1beta1' + }, context, function(statefulSets) { + $scope.statefulSets = statefulSets.by("metadata.name"); + groupPods(); + $scope.statefulSetsLoaded = true; + // _.each($scope.statefulSets, setStatefulSetLogVars); // TODO: enable when we have the endpoint + filterStatefulSets(); + Logger.log("statefulSets", $scope.statefulSets); + }); + DataService.watch("replicationcontrollers", context, function(replicationControllers) { $scope.replicationControllers = orderByDate(replicationControllers.by("metadata.name"), true); groupPods(); @@ -308,6 +348,7 @@ angular.module('openshiftConsole') filterBuilds(); filterDeployments(); filterReplicaSets(); + filterStatefulSets(); var search = $location.search(); search.hideOlderResources = $scope.filters.hideOlderResources ? 'true' : 'false'; $location.replace().search(search); diff --git a/app/views/monitoring.html b/app/views/monitoring.html index ebd85ec99b..a469e84d1b 100644 --- a/app/views/monitoring.html +++ b/app/views/monitoring.html @@ -56,6 +56,7 @@

+

Pods

@@ -137,6 +138,7 @@

Pods

+

Deployments

@@ -260,6 +262,73 @@

Deployments

+ +
+

Stateful Sets

+
+
+
+ + +
The current filters are hiding all stateful sets.
+ There are no stateful sets in this project. +
+
+
+
+
+ + + + + + + +
+ +
+
+
+
+ + created +
+
+ + {{set | deploymentStatus | sentenceCase}}, + {{podsByOwnerUID[set.metadata.uid] | hashSize}}/{{set.spec.replicas}} replicas +
+
+
+
+ + +
+
+
+
+
+
+ Logs are not available for stateful sets. + + To see application logs, view the logs for one of the stateful sets's + pods. + +
+ + +
+
+
+
+ +

Builds

diff --git a/dist/scripts/scripts.js b/dist/scripts/scripts.js index 6cbb65fc84..30758fda77 100644 --- a/dist/scripts/scripts.js +++ b/dist/scripts/scripts.js @@ -5098,6 +5098,8 @@ label:"Deployments", kind:"ReplicationControllers" }, { kind:"Builds" +}, { +kind:"StatefulSets" } ], c.kindSelector = { selected:_.find(c.kinds, { kind:a.kind @@ -5105,20 +5107,24 @@ kind:a.kind }, c.logOptions = { pods:{}, replicationControllers:{}, -builds:{} +builds:{}, +statefulSets:{} }, c.logCanRun = { pods:{}, replicationControllers:{}, -builds:{} +builds:{}, +statefulSets:{} }, c.logEmpty = { pods:{}, replicationControllers:{}, -builds:{} +builds:{}, +statefulSets:{} }, c.expanded = { pods:{}, replicationControllers:{}, replicaSets:{}, -builds:{} +builds:{}, +statefulSets:{} }; var q = d("isNil"); c.filters = { @@ -5130,7 +5136,7 @@ k.isAvailable().then(function(a) { c.metricsAvailable = a; }); var v = d("orderObjectsByDate"), w = [ "metadata.name" ], x = [], y = function() { -c.filteredPods = h.filterForKeywords(u, w, x), c.filteredReplicationControllers = h.filterForKeywords(s, w, x), c.filteredReplicaSets = h.filterForKeywords(t, w, x), c.filteredBuilds = h.filterForKeywords(r, w, x); +c.filteredPods = h.filterForKeywords(u, w, x), c.filteredReplicationControllers = h.filterForKeywords(s, w, x), c.filteredReplicaSets = h.filterForKeywords(t, w, x), c.filteredBuilds = h.filterForKeywords(r, w, x), c.filteredStatefulSets = h.filterForKeywords(_.values(c.statefulSets), w, x); }, z = function(a) { c.logOptions.pods[a.metadata.name] = { container:a.spec.containers[0].name @@ -5142,22 +5148,24 @@ b && (c.logOptions.replicationControllers[a.metadata.name].version = b), c.logCa }, B = function(a) { c.logOptions.builds[a.metadata.name] = {}, c.logCanRun.builds[a.metadata.name] = !_.includes([ "New", "Pending", "Error" ], a.status.phase); }, C = function() { +c.filteredStatefulSets = h.filterForKeywords(_.values(c.statefulSets), w, x); +}, D = function() { u = _.filter(c.pods, function(a) { return !c.filters.hideOlderResources || "Succeeded" !== a.status.phase && "Failed" !== a.status.phase; }), c.filteredPods = h.filterForKeywords(u, w, x); -}, D = d("isIncompleteBuild"), E = d("buildConfigForBuild"), F = d("isRecentBuild"), G = function() { +}, E = d("isIncompleteBuild"), F = d("buildConfigForBuild"), G = d("isRecentBuild"), H = function() { moment().subtract(5, "m"); r = _.filter(c.builds, function(a) { if (!c.filters.hideOlderResources) return !0; -if (D(a)) return !0; -var b = E(a); -return b ? c.latestBuildByConfig[b].metadata.name === a.metadata.name :F(a); +if (E(a)) return !0; +var b = F(a); +return b ? c.latestBuildByConfig[b].metadata.name === a.metadata.name :G(a); }), c.filteredBuilds = h.filterForKeywords(r, w, x); -}, H = d("deploymentStatus"), I = d("deploymentIsInProgress"), J = function() { +}, I = d("deploymentStatus"), J = d("deploymentIsInProgress"), K = function() { s = _.filter(c.replicationControllers, function(a) { -return !c.filters.hideOlderResources || (I(a) || "Active" === H(a)); +return !c.filters.hideOlderResources || (J(a) || "Active" === I(a)); }), c.filteredReplicationControllers = h.filterForKeywords(s, w, x); -}, K = function() { +}, L = function() { t = _.filter(c.replicaSets, function(a) { return !c.filters.hideOlderResources || _.get(a, "status.replicas"); }), c.filteredReplicaSets = h.filterForKeywords(t, w, x); @@ -5194,14 +5202,18 @@ break; case "Pod": g = !c.expanded.pods[e.metadata.name], c.expanded.pods[e.metadata.name] = g, h = g ? "event.resource.highlight" :"event.resource.clear-highlight", o.$emit(h, e); +break; + +case "StatefulSet": +g = !c.expanded.statefulSets[e.metadata.name], c.expanded.statefulSets[e.metadata.name] = g, h = g ? "event.resource.highlight" :"event.resource.clear-highlight", o.$emit(h, e); } } }, c.viewPodsForReplicaSet = function(a) { _.isEmpty(c.podsByOwnerUID[a.metadata.uid]) || l.toPodsForDeployment(a); }; -var L = function() { -if (c.pods && c.replicationControllers && c.replicaSets) { -var a = _.toArray(c.replicationControllers).concat(_.toArray(c.replicaSets)); +var M = function() { +if (c.pods && c.replicationControllers && c.replicaSets && c.statefulSets) { +var a = _.toArray(c.replicationControllers).concat(_.toArray(c.replicaSets)).concat(_.toArray(c.statefulSets)); c.podsByOwnerUID = i.groupBySelector(c.pods, a, { key:"metadata.uid" }); @@ -5209,20 +5221,26 @@ key:"metadata.uid" }; n.get(a.project).then(_.spread(function(a, d) { c.project = a, c.projectContext = d, f.watch("pods", d, function(a) { -c.podsByName = a.by("metadata.name"), c.pods = v(c.podsByName, !0), L(), c.podsLoaded = !0, _.each(c.pods, z), C(), j.log("pods", c.pods); +c.podsByName = a.by("metadata.name"), c.pods = v(c.podsByName, !0), M(), c.podsLoaded = !0, _.each(c.pods, z), D(), j.log("pods", c.pods); +}), f.watch({ +resource:"statefulsets", +group:"apps", +version:"v1beta1" +}, d, function(a) { +c.statefulSets = a.by("metadata.name"), M(), c.statefulSetsLoaded = !0, C(), j.log("statefulSets", c.statefulSets); }), f.watch("replicationcontrollers", d, function(a) { -c.replicationControllers = v(a.by("metadata.name"), !0), L(), c.replicationControllersLoaded = !0, _.each(c.replicationControllers, A), J(), j.log("replicationcontrollers", c.replicationControllers); +c.replicationControllers = v(a.by("metadata.name"), !0), M(), c.replicationControllersLoaded = !0, _.each(c.replicationControllers, A), K(), j.log("replicationcontrollers", c.replicationControllers); }), f.watch("builds", d, function(a) { -c.builds = v(a.by("metadata.name"), !0), c.latestBuildByConfig = e.latestBuildByConfig(c.builds), c.buildsLoaded = !0, _.each(c.builds, B), G(), j.log("builds", c.builds); +c.builds = v(a.by("metadata.name"), !0), c.latestBuildByConfig = e.latestBuildByConfig(c.builds), c.buildsLoaded = !0, _.each(c.builds, B), H(), j.log("builds", c.builds); }), f.watch({ group:"extensions", resource:"replicasets" }, d, function(a) { -c.replicaSets = v(a.by("metadata.name"), !0), L(), c.replicaSetsLoaded = !0, K(), j.log("replicasets", c.replicaSets); +c.replicaSets = v(a.by("metadata.name"), !0), M(), c.replicaSetsLoaded = !0, L(), j.log("replicasets", c.replicaSets); }), c.$on("$destroy", function() { f.unwatchAll(p); }), c.$watch("filters.hideOlderResources", function() { -C(), G(), J(), K(); +D(), H(), K(), L(), C(); var a = b.search(); a.hideOlderResources = c.filters.hideOlderResources ? "true" :"false", b.replace().search(a); }), c.$watch("kindSelector.selected.kind", function() { diff --git a/dist/scripts/templates.js b/dist/scripts/templates.js index 0d03385481..5023be22fe 100644 --- a/dist/scripts/templates.js +++ b/dist/scripts/templates.js @@ -10805,6 +10805,63 @@ angular.module('openshiftConsoleTemplates', []).run(['$templateCache', function( "
\n" + "
\n" + "\n" + + "
\n" + + "

Stateful Sets

\n" + + "
\n" + + "
\n" + + "
\n" + + "\n" + + "\n" + + "
0\">The current filters are hiding all stateful sets.
\n" + + "There are no stateful sets in this project.\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "\n" + + "created \n" + + "
\n" + + "
\n" + + "\n" + + "{{set | deploymentStatus | sentenceCase}},\n" + + "{{podsByOwnerUID[set.metadata.uid] | hashSize}}/{{set.spec.replicas}} replicas\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "\n" + + "\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + + "Logs are not available for stateful sets.\n" + + "\n" + + "To see application logs, view the logs for one of the stateful sets's\n" + + "pods.\n" + + "\n" + + "
\n" + + "\n" + + "\n" + + "
\n" + + "
\n" + + "
\n" + + "
\n" + "
\n" + "

Builds

\n" + "
\n" +