Skip to content

Commit 45f56f9

Browse files
committed
Merge pull request #772 from maciaszczykm/daemon-sets-frontend
Add frontend for Daemon Set
2 parents 819be16 + e727489 commit 45f56f9

File tree

50 files changed

+957
-60
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+957
-60
lines changed

build/i18n.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ function extractForLanguage(langKey) {
3636
let translationBundle = path.join(conf.paths.base, `i18n/messages-${langKey}.xtb`);
3737
let codeSource = path.join(conf.paths.serve, '*.js');
3838
let command = `java -jar ${conf.paths.xtbgenerator} --lang ${langKey}` +
39-
` --xtb_output_file ${translationBundle}` + ` --js ${codeSource}`;
39+
` --xtb_output_file ${translationBundle} --js ${codeSource}`;
4040
if (fileExists(translationBundle)) {
4141
command = `${command} --translations_file ${translationBundle}`;
4242
}

src/app/backend/dashboard.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ var (
4141
func main() {
4242
pflag.CommandLine.AddGoFlagSet(flag.CommandLine)
4343
pflag.Parse()
44-
flag.CommandLine.Parse(make([]string,0)) // Init for glog calls in kubernetes packages
44+
flag.CommandLine.Parse(make([]string, 0)) // Init for glog calls in kubernetes packages
4545

4646
log.Printf("Starting HTTP server on port %d", *argPort)
4747

src/app/backend/resource/daemonset/daemonsetcommon.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ package daemonset
1616

1717
import (
1818
"github.com/kubernetes/dashboard/resource/common"
19-
// "github.com/kubernetes/dashboard/resource/event"
2019
"k8s.io/kubernetes/pkg/api"
2120
"k8s.io/kubernetes/pkg/api/unversioned"
2221
"k8s.io/kubernetes/pkg/apis/extensions"

src/app/backend/resource/pod/poddetail.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,26 @@ import (
2828
// This means it is PodDetail plus additional augumented data we can get
2929
// from other sources (like services that target it).
3030
type PodDetail struct {
31-
ObjectMeta common.ObjectMeta `json:"objectMeta"`
32-
TypeMeta common.TypeMeta `json:"typeMeta"`
31+
ObjectMeta common.ObjectMeta `json:"objectMeta"`
32+
TypeMeta common.TypeMeta `json:"typeMeta"`
3333

3434
// Container images of the Pod.
3535
ContainerImages []string `json:"containerImages"`
3636

3737
// Status of the Pod. See Kubernetes API for reference.
38-
PodPhase api.PodPhase `json:"podPhase"`
38+
PodPhase api.PodPhase `json:"podPhase"`
3939

4040
// IP address of the Pod.
41-
PodIP string `json:"podIP"`
41+
PodIP string `json:"podIP"`
4242

4343
// Name of the Node this Pod runs on.
44-
NodeName string `json:"nodeName"`
44+
NodeName string `json:"nodeName"`
4545

4646
// Count of containers restarts.
47-
RestartCount int32 `json:"restartCount"`
47+
RestartCount int32 `json:"restartCount"`
4848

4949
// Pod metrics.
50-
Metrics *PodMetrics `json:"metrics"`
50+
Metrics *PodMetrics `json:"metrics"`
5151
}
5252

5353
// GetPodDetail returns the details (PodDetail) of a named Pod from a particular
@@ -70,4 +70,4 @@ func GetPodDetail(client k8sClient.Interface, heapsterClient client.HeapsterClie
7070

7171
podDetail := ToPodDetail(pod, metrics)
7272
return &podDetail, nil
73-
};
73+
}

src/app/backend/resource/workload/workloads.go

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919

2020
"github.com/kubernetes/dashboard/client"
2121
"github.com/kubernetes/dashboard/resource/common"
22+
"github.com/kubernetes/dashboard/resource/daemonset"
2223
"github.com/kubernetes/dashboard/resource/deployment"
2324
"github.com/kubernetes/dashboard/resource/pod"
2425
"github.com/kubernetes/dashboard/resource/replicaset"
@@ -35,6 +36,8 @@ type Workloads struct {
3536
ReplicationControllerList replicationcontroller.ReplicationControllerList `json:"replicationControllerList"`
3637

3738
PodList pod.PodList `json:"podList"`
39+
40+
DaemonSetList daemonset.DaemonSetList `json:"daemonSetList"`
3841
}
3942

4043
// GetWorkloads returns a list of all workloads in the cluster.
@@ -45,11 +48,12 @@ func GetWorkloads(client k8sClient.Interface,
4548
channels := &common.ResourceChannels{
4649
ReplicationControllerList: common.GetReplicationControllerListChannel(client, nsQuery, 1),
4750
ReplicaSetList: common.GetReplicaSetListChannel(client.Extensions(), nsQuery, 1),
51+
DaemonSetList: common.GetDaemonSetListChannel(client.Extensions(), nsQuery, 1),
4852
DeploymentList: common.GetDeploymentListChannel(client.Extensions(), nsQuery, 1),
49-
ServiceList: common.GetServiceListChannel(client, nsQuery, 3),
50-
PodList: common.GetPodListChannel(client, nsQuery, 4),
51-
EventList: common.GetEventListChannel(client, nsQuery, 3),
52-
NodeList: common.GetNodeListChannel(client, nsQuery, 3),
53+
ServiceList: common.GetServiceListChannel(client, nsQuery, 4),
54+
PodList: common.GetPodListChannel(client, nsQuery, 5),
55+
EventList: common.GetEventListChannel(client, nsQuery, 4),
56+
NodeList: common.GetNodeListChannel(client, nsQuery, 4),
5357
}
5458

5559
return GetWorkloadsFromChannels(channels, heapsterClient)
@@ -64,7 +68,8 @@ func GetWorkloadsFromChannels(channels *common.ResourceChannels,
6468
deploymentChan := make(chan *deployment.DeploymentList)
6569
rcChan := make(chan *replicationcontroller.ReplicationControllerList)
6670
podChan := make(chan *pod.PodList)
67-
errChan := make(chan error, 4)
71+
dsChan := make(chan *daemonset.DaemonSetList)
72+
errChan := make(chan error, 5)
6873

6974
go func() {
7075
rcList, err := replicationcontroller.GetReplicationControllerListFromChannels(channels)
@@ -90,6 +95,12 @@ func GetWorkloadsFromChannels(channels *common.ResourceChannels,
9095
podChan <- podList
9196
}()
9297

98+
go func() {
99+
dsList, err := daemonset.GetDaemonSetListFromChannels(channels)
100+
errChan <- err
101+
dsChan <- dsList
102+
}()
103+
93104
rcList := <-rcChan
94105
err := <-errChan
95106
if err != nil {
@@ -114,11 +125,18 @@ func GetWorkloadsFromChannels(channels *common.ResourceChannels,
114125
return nil, err
115126
}
116127

128+
dsList := <-dsChan
129+
err = <-errChan
130+
if err != nil {
131+
return nil, err
132+
}
133+
117134
workloads := &Workloads{
118135
ReplicaSetList: *rsList,
119136
ReplicationControllerList: *rcList,
120137
DeploymentList: *deploymentList,
121138
PodList: *podList,
139+
DaemonSetList: *dsList,
122140
}
123141

124142
return workloads, nil

src/app/externs/backendapi.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,27 @@ backendApi.Service;
358358
*/
359359
backendApi.ServiceList;
360360

361+
/**
362+
* @typedef {{
363+
* objectMeta: !backendApi.ObjectMeta,
364+
* typeMeta: !backendApi.TypeMeta,
365+
* labelSelector: !Object<string, string>,
366+
* containerImages: !Array<string>,
367+
* podInfo: !backendApi.PodInfo,
368+
* pods: !backendApi.PodList,
369+
* serviceList: !backendApi.ServiceList,
370+
* hasMetrics: boolean
371+
* }}
372+
*/
373+
backendApi.DaemonSet;
374+
375+
/**
376+
* @typedef {{
377+
* daemonSets: !Array<backendApi.DaemonSet>
378+
* }}
379+
*/
380+
backendApi.DaemonSetList;
381+
361382
/**
362383
* @typedef {{
363384
* host: string,

src/app/frontend/common/components/actionbar/actionbar_module.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import {actionbarComponent} from './actionbar_component';
16-
import {actionbarDeleteItemComponent} from './actionbardeleteitem_component';
1715
import {breadcrumbsComponent} from './../breadcrumbs/breadcrumbs_component';
1816
import {BreadcrumbsService} from './../breadcrumbs/breadcrumbs_service';
17+
import {actionbarComponent} from './actionbar_component';
18+
import {actionbarDeleteItemComponent} from './actionbardeleteitem_component';
19+
1920
import resourceModule from 'common/resource/resource_module';
2021

2122
/**

src/app/frontend/common/components/endpoint/endpoint_module.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15-
import {internalEndpointComponent} from './internalendpoint_component';
1615
import {externalEndpointComponent} from './externalendpoint_component';
16+
import {internalEndpointComponent} from './internalendpoint_component';
1717

1818
/**
1919
* Module containing endpoint components.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!--
2+
Copyright 2015 Google Inc. All Rights Reserved.
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
http://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
-->
16+
17+
<div layout="column">
18+
<md-content>
19+
<md-tabs md-border-bottom md-dynamic-height>
20+
<md-tab label="Overview">
21+
<kd-daemon-set-info daemon-set="::ctrl.daemonSetDetail"></kd-daemon-set-info>
22+
<kd-content-card>
23+
<kd-title>Pods</kd-title>
24+
<kd-content>
25+
<kd-pod-card-list pod-list="::ctrl.daemonSetDetail.pods"
26+
logs-href-fn="::ctrl.getPodLogsHref(pod)">
27+
</kd-pod-card-list>
28+
</kd-content>
29+
</kd-content-card>
30+
</md-tab>
31+
<md-tab label="Events">
32+
<kd-event-card-list events="::ctrl.daemonSetDetail.eventList.events"></kd-event-card-list>
33+
</md-tab>
34+
</md-tabs>
35+
</md-content>
36+
</div>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Copyright 2015 Google Inc. All Rights Reserved.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
/**
16+
* @final
17+
*/
18+
export class DaemonSetDetailController {
19+
/**
20+
* @param {!backendApi.DaemonSet} daemonSetDetail
21+
* @ngInject
22+
*/
23+
constructor(daemonSetDetail) {
24+
/** @export {!backendApi.DaemonSet} */
25+
this.daemonSetDetail = daemonSetDetail;
26+
}
27+
}

0 commit comments

Comments
 (0)