Skip to content

Commit 7750476

Browse files
updates
1 parent 8655376 commit 7750476

11 files changed

+293
-152
lines changed

app/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ <h1>JavaScript Required</h1>
231231
<script src="scripts/controllers/deployment.js"></script>
232232
<script src="scripts/controllers/deploymentConfig.js"></script>
233233
<script src="scripts/controllers/replicaSet.js"></script>
234+
<script src="scripts/controllers/statefulSets.js"></script>
234235
<script src="scripts/controllers/statefulSet.js"></script>
235236
<script src="scripts/controllers/services.js"></script>
236237
<script src="scripts/controllers/service.js"></script>

app/scripts/app.js

+5
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,11 @@ angular
174174
templateUrl: 'views/edit/deployment-config.html',
175175
controller: 'EditDeploymentConfigController'
176176
})
177+
.when('/project/:project/browse/stateful-sets/', {
178+
templateUrl: 'views/browse/stateful-sets.html',
179+
controller: 'StatefulSetsController',
180+
reloadOnSearch: false
181+
})
177182
.when('/project/:project/browse/stateful-sets/:statefulset', {
178183
templateUrl: 'views/browse/stateful-set.html',
179184
controller: 'StatefulSetController',

app/scripts/constants.js

+8
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ window.OPENSHIFT_CONSTANTS = {
4545
"config-maps": "dev_guide/configmaps.html",
4646
"secrets": "dev_guide/secrets.html",
4747
"deployments": "dev_guide/deployments/how_deployments_work.html",
48+
//"stateful-sets": "", // TODO: docs are in progress
4849
"pods": "architecture/core_concepts/pods_and_services.html#pods",
4950
"services": "architecture/core_concepts/pods_and_services.html#services",
5051
"routes": "architecture/core_concepts/routes.html",
@@ -115,6 +116,13 @@ window.OPENSHIFT_CONSTANTS = {
115116
"/browse/rc/"
116117
]
117118
},
119+
{
120+
label: "Stateful Sets",
121+
href: "/browse/stateful-sets",
122+
prefixes: [
123+
"/browse/stateful-sets/"
124+
]
125+
},
118126
{
119127
label: "Pods",
120128
href: "/browse/pods",

app/scripts/controllers/deployments.js

-9
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,6 @@ angular.module('openshiftConsole')
6363
.then(_.spread(function(project, context) {
6464
$scope.project = project;
6565

66-
// TODO: keep petset/stateful set here or give it its own page?
67-
// I lean toward dedicated page.
68-
watches.push(DataService.watch({
69-
resource: 'statefulsets',
70-
group: 'apps',
71-
version: 'v1beta1'
72-
}, context, function(statefulSets) {
73-
$scope.statefulSets = statefulSets.by('metadata.name');
74-
}));
7566

7667

7768
watches.push(DataService.watch("replicationcontrollers", context, function(replicationControllers, action, replicationController) {

app/scripts/controllers/statefulSet.js

+6-4
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,17 @@ angular
6363
angular.extend($scope, {
6464
statefulSet: updateEnvVars(statefulSet),
6565
projectContext: context,
66-
loaded: true
66+
loaded: true,
67+
// TODO: support scaling
68+
isScalable: function() {
69+
return false;
70+
},
71+
scale: function() {}
6772
});
6873
watches.push(DataService.watchObject(resourceGroupVersion, $scope.statefulSetName, context, function(statefulSet) {
6974
angular.extend($scope, {
7075
resourceGroupVersion: resourceGroupVersion,
7176
statefulSet: updateEnvVars(statefulSet)
72-
// TODO: support scaling
73-
// scale: function() {},
74-
// isScalable: function() { return true; }
7577
});
7678
var pods;
7779
var selector;
+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
3+
angular.module('openshiftConsole')
4+
.controller('StatefulSetsController', function($scope, $routeParams, AlertMessageService, DataService, ProjectsService) {
5+
$scope.projectName = $routeParams.project;
6+
$scope.alerts = $scope.alerts || {};
7+
$scope.emptyMessage = "Loading...";
8+
9+
// get and clear any alerts
10+
AlertMessageService.getAlerts().forEach(function(alert) {
11+
$scope.alerts[alert.name] = alert.data;
12+
});
13+
AlertMessageService.clearAlerts();
14+
15+
var watches = [];
16+
ProjectsService
17+
.get($routeParams.project)
18+
.then(_.spread(function(project, context) {
19+
$scope.project = project;
20+
21+
watches.push(DataService.watch({
22+
resource: 'statefulsets',
23+
group: 'apps',
24+
version: 'v1beta1'
25+
}, context, function(statefulSets) {
26+
angular.extend($scope, {
27+
loaded: true,
28+
statefulSets: statefulSets.by('metadata.name')
29+
});
30+
}));
31+
32+
$scope.$on('$destroy', function(){
33+
DataService.unwatchAll(watches);
34+
});
35+
36+
}));
37+
});

app/views/browse/stateful-set.html

+62-52
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ <h1>
3232
<a ng-href="{{statefulSet | editYamlURL}}" role="button">Edit YAML</a>
3333
</li>
3434
<li ng-if="resourceGroupVersion | canI : 'delete'">
35-
<!-- TODO: Warn about replicas? deleting statefulSets doesn't delete the pods -->
36-
<!-- TODO: hpa-list attrib? figure out autoscaling -->
3735
<delete-link
3836
kind="statefulSet"
3937
group="apps"
@@ -59,58 +57,73 @@ <h1>
5957
<div class="middle-content" persist-tab-state>
6058
<div class="container-fluid">
6159
<div ng-if="!loaded">Loading...</div>
60+
6261
<div class="row" ng-if="loaded">
6362
<div class="col-md-12">
6463
<uib-tabset>
6564
<uib-tab active="selectedTab.details">
6665
<uib-tab-heading>Details</uib-tab-heading>
6766

68-
<div class="resource-details">
69-
<dl class="dl-horizontal left">
70-
<dt>Status:</dt>
71-
<dd>
72-
<!-- the deploymentStatus filter seems to work fine here -->
73-
<status-icon status="statefulSet | deploymentStatus"></status-icon>
74-
{{statefulSet | deploymentStatus}}
75-
</dd>
76-
<dt>Replicas:</dt>
77-
<dd>
78-
<!--
79-
statefulSets do not have history
80-
& are always scalable unless there are HPAs involved
81-
-->
82-
<!-- TODO: DONUT -->
83-
<replicas status="statefulSet.status.replicas"
84-
spec="statefulSet.spec.replicas"
85-
disable-scaling="!isScalable()"
86-
scale-fn="scale(replicas)"
87-
deployment="statefulSet">
88-
</replicas>
89-
<!-- TODO: HPA as a follow-on PR
90-
<span ng-if="autoscalers.length">(autoscaled)</span>
91-
-->
92-
</dd>
93-
</dl>
94-
<h3>Template</h3>
95-
<pod-template
96-
pod-template="statefulSet.spec.template"
97-
detailed="true">
98-
</pod-template>
99-
100-
<h3>Storage</h3>
101-
<volumes
102-
volumes="statefulSet.spec.template.spec.volumes"
103-
namespace="projectName"
104-
can-remove="false"></volumes>
67+
<div class="row" style="max-width: 650px;">
10568

106-
<h3>Pods</h3>
107-
<pods-table
108-
pods="podsForStatefulSet"></pods-table>
69+
<div class="col-sm-4 col-sm-push-8 browse-deployment-donut">
70+
<!--
71+
TODO: scale/autoscale is a follow-on PR
72+
-->
73+
<deployment-donut
74+
deployment="statefulSet"
75+
pods="podsForStatefulSet"
76+
scalable="isScalable()"
77+
alerts="alerts">
78+
</deployment-donut>
79+
</div>
10980

110-
<annotations
111-
annotations="statefulSet.metadata.annotations"></annotations>
81+
<div class="col-sm-8 col-sm-pull-4">
82+
<dl class="dl-horizontal left">
83+
<dt>Status:</dt>
84+
<dd>
85+
<status-icon status="statefulSet | deploymentStatus"></status-icon>
86+
{{statefulSet | deploymentStatus}}
87+
</dd>
88+
<dt>Replicas:</dt>
89+
<dd>
90+
<replicas
91+
status="statefulSet.status.replicas"
92+
spec="statefulSet.spec.replicas"
93+
disable-scaling="!isScalable()"
94+
scale-fn="scale(replicas)"
95+
deployment="statefulSet">
96+
</replicas>
97+
<!-- TODO: HPA as a follow-on PR
98+
<span ng-if="autoscalers.length">(autoscaled)</span>
99+
-->
100+
</dd>
101+
</dl>
102+
<h3>Template</h3>
103+
<pod-template
104+
pod-template="statefulSet.spec.template"
105+
detailed="true">
106+
</pod-template>
107+
</div>
112108

113109
</div>
110+
111+
<div class="row">
112+
<div class="col-md-12">
113+
<h3>Storage</h3>
114+
<volumes
115+
volumes="statefulSet.spec.template.spec.volumes"
116+
namespace="projectName"
117+
can-remove="false"></volumes>
118+
119+
<h3>Pods</h3>
120+
<pods-table
121+
pods="podsForStatefulSet"></pods-table>
122+
123+
<annotations
124+
annotations="statefulSet.metadata.annotations"></annotations>
125+
</div>
126+
</div>
114127
</uib-tab>
115128

116129
<uib-tab active="selectedTab.environment" ng-if="statefulSet">
@@ -120,7 +133,7 @@ <h3>Pods</h3>
120133
<div ng-repeat="container in statefulSet.spec.template.spec.containers">
121134
<h3>Container {{container.name}} Environment Variables</h3>
122135
<p>
123-
Environment variables for statefulSets are readonly.
136+
Environment variables for stateful sets are readonly.
124137
<span ng-if="!(container.env.length)">
125138
There are no environment variables for this container.
126139
</span>
@@ -139,20 +152,18 @@ <h3>Container {{container.name}} Environment Variables</h3>
139152
</div>
140153
</uib-tab>
141154

142-
143155
<uib-tab active="selectedTab.metrics">
144156
<uib-tab-heading>Metrics</uib-tab-heading>
145157
<div class="resource-metrics">
146158
<deployment-metrics
147-
ng-if="selectedTab.metrics && podsForStatefulSet"
148-
pods="podsForStatefulSet"
149-
containers="statefulSet.spec.template.spec.containers"
150-
alerts="alerts">
159+
ng-if="selectedTab.metrics && podsForStatefulSet"
160+
pods="podsForStatefulSet"
161+
containers="statefulSet.spec.template.spec.containers"
162+
alerts="alerts">
151163
</deployment-metrics>
152164
</div>
153165
</uib-tab>
154166

155-
156167
<uib-tab active="selectedTab.events">
157168
<uib-tab-heading>Events</uib-tab-heading>
158169
<div class="resource-events">
@@ -165,7 +176,6 @@ <h3>Container {{container.name}} Environment Variables</h3>
165176
</div>
166177
</uib-tab>
167178

168-
169179
</uib-tabset>
170180
</div>
171181
</div>

app/views/browse/stateful-sets.html

+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<project-header class="top-header"></project-header>
2+
<project-page>
3+
4+
<div class="middle-section">
5+
<div class="middle-container">
6+
7+
<div class="middle-header header-toolbar">
8+
<div class="container-fluid">
9+
<breadcrumbs breadcrumbs="breadcrumbs"></breadcrumbs>
10+
<alerts alerts="alerts"></alerts>
11+
<div class="page-header page-header-bleed-right page-header-bleed-left">
12+
<h1>
13+
Stateful Sets
14+
<!-- TODO: docs are in progress
15+
<span class="page-header-link">
16+
<a ng-href="{{'stateful-sets' | helpLink}}" target="_blank">
17+
Learn More <i class="fa fa-external-link" aria-hidden="true"></i>
18+
</a>
19+
</span>
20+
-->
21+
</h1>
22+
</div>
23+
</div>
24+
</div>
25+
26+
<div class="middle-content" persist-tab-state>
27+
<div class="container-fluid">
28+
<div ng-if="!loaded">Loading...</div>
29+
<div class="row" ng-if="loaded">
30+
<div class="col-md-12">
31+
<table class="table table-bordered table-hover table-mobile">
32+
<thead>
33+
<tr>
34+
<th>Name</th>
35+
<th>Replicas</th>
36+
<th>Created</th>
37+
</tr>
38+
</thead>
39+
<tbody ng-if="(statefulSets | hashSize) == 0">
40+
<tr>
41+
<td colspan="3"><em>No stateful sets</em></td>
42+
</tr>
43+
</tbody>
44+
<tbody ng-repeat="(statefulSetName, statefulSet) in statefulSets">
45+
<tr>
46+
<td data-title="Name">
47+
<a ng-href="{{statefulSet | navigateResourceURL}}">{{statefulSet.metadata.name}}</a>
48+
</td>
49+
<td data-title="Replicas">
50+
<span ng-if="statefulSet.status.replicas !== statefulSet.spec.replicas">{{statefulSet.status.replicas}}/</span>{{statefulSet.spec.replicas}} replica<span ng-if="statefulSet.spec.replicas != 1">s</span>
51+
</td>
52+
<td data-title="Created">
53+
<span am-time-ago="statefulSet.metadata.creationTimestamp"></span>
54+
</td>
55+
</tr>
56+
</tbody>
57+
</table>
58+
</div>
59+
</div>
60+
</div>
61+
</div>
62+
63+
</div>
64+
</div>
65+
66+
</project-page>

app/views/deployments.html

+1-36
Original file line numberDiff line numberDiff line change
@@ -24,45 +24,10 @@ <h1>
2424
</div>
2525
</div><!-- /middle-header-->
2626
<div class="middle-content">
27-
<div class="container-fluid">
28-
<alerts alerts="alerts"></alerts>
29-
<!-- TODO: keep statefulSets here or put on own page? -->
30-
<div class="row">
31-
<div class="col-md-12">
32-
<h3>StatefulSets</h3>
33-
<table class="table table-bordered table-hover table-mobile">
34-
<thead>
35-
<tr>
36-
<th>Name</th>
37-
<th>Status</th>
38-
<th>Created</th>
39-
</tr>
40-
</thead>
41-
<tbody ng-repeat="(statefulSetName, statefulSet) in statefulSets">
42-
<tr>
43-
<td data-title="Name">
44-
<a ng-href="{{statefulSet | navigateResourceURL}}">{{statefulSet.metadata.name}}</a>
45-
</td>
46-
<td data-title="Status">
47-
<status-icon status="statefulSet | deploymentStatus"></status-icon>
48-
{{statefulSet | deploymentStatus}}<span ng-if="(statefulSet | deploymentStatus) === 'Active' || (statefulSet | deploymentStatus) === 'Running'">,
49-
<!--
50-
statefulSet.status.replicas vs statefulSet.spec.replicas ?
51-
-->
52-
<span ng-if="statefulSet.spec.replicas !== statefulSet.status.replicas">{{statefulSet.status.replicas}}/</span>{{statefulSet.spec.replicas}} replica<span ng-if="statefulSet.spec.replicas !== 1">s</span></span>
53-
</td>
54-
<td data-title="Created">
55-
<span am-time-ago="statefulSet.metadata.creationTimestamp"></span>
56-
</td>
57-
</tr>
58-
</tbody>
59-
</table>
60-
</div>
61-
</div>
62-
</div>
6327
<div class="container-fluid">
6428
<div class="row">
6529
<div class="col-md-12">
30+
<alerts alerts="alerts"></alerts>
6631
<h3 ng-if="(deployments | hashSize) || (replicaSets | hashSize)">Deployment Configurations</h3>
6732
<table class="table table-bordered table-hover table-mobile">
6833
<thead>

0 commit comments

Comments
 (0)