diff --git a/src/backend/controllers/kubernetes/service/service.go b/src/backend/controllers/kubernetes/service/service.go
index cb0b88902..500d6e090 100644
--- a/src/backend/controllers/kubernetes/service/service.go
+++ b/src/backend/controllers/kubernetes/service/service.go
@@ -7,12 +7,12 @@ import (
"github.com/Qihoo360/wayne/src/backend/client"
"github.com/Qihoo360/wayne/src/backend/controllers/base"
+ "github.com/Qihoo360/wayne/src/backend/controllers/common"
"github.com/Qihoo360/wayne/src/backend/models"
"github.com/Qihoo360/wayne/src/backend/models/response"
"github.com/Qihoo360/wayne/src/backend/resources/service"
"github.com/Qihoo360/wayne/src/backend/util/logs"
"github.com/Qihoo360/wayne/src/backend/workers/webhook"
- "github.com/Qihoo360/wayne/src/backend/controllers/common"
)
type KubeServiceController struct {
@@ -131,7 +131,6 @@ func (c *KubeServiceController) Deploy() {
// add service predeploy
common.ServicePreDeploy(&kubeService, clusterModel, namespaceModel)
-
publishHistory := &models.PublishHistory{
Type: models.PublishTypeService,
ResourceId: int64(serviceId),
diff --git a/src/backend/models/namespace.go b/src/backend/models/namespace.go
index 180252142..6713748ac 100644
--- a/src/backend/models/namespace.go
+++ b/src/backend/models/namespace.go
@@ -9,7 +9,6 @@ import (
"github.com/Qihoo360/wayne/src/backend/util/hack"
"github.com/Qihoo360/wayne/src/backend/util/logs"
-
)
const (
diff --git a/src/frontend/src/app/admin/admin-routing.module.ts b/src/frontend/src/app/admin/admin-routing.module.ts
index 936929aa3..ba7e288e2 100644
--- a/src/frontend/src/app/admin/admin-routing.module.ts
+++ b/src/frontend/src/app/admin/admin-routing.module.ts
@@ -75,6 +75,7 @@ import { KubeConfigmapComponent } from './kubernetes/configmap/kube-configmap.co
import { KubeSecretComponent } from './kubernetes/secret/kube-secret.component';
import { KubeIngressComponent } from './kubernetes/ingress/kube-ingress.component';
import { KubeStatefulsetComponent } from './kubernetes/statefulset/kube-statefulset.component';
+import { KubeDaemonsetComponent } from './kubernetes/daemonset/kube-daemonset.component';
const routes: Routes = [
@@ -169,6 +170,8 @@ const routes: Routes = [
{path: 'kubernetes/ingress/:cluster', component: KubeIngressComponent},
{path: 'kubernetes/statefulset', component: KubeStatefulsetComponent},
{path: 'kubernetes/statefulset/:cluster', component: KubeStatefulsetComponent},
+ {path: 'kubernetes/daemonset', component: KubeDaemonsetComponent},
+ {path: 'kubernetes/daemonset/:cluster', component: KubeDaemonsetComponent},
...ADMINROUTES
]
}
diff --git a/src/frontend/src/app/admin/admin.module.ts b/src/frontend/src/app/admin/admin.module.ts
index adc5bc405..9093638f5 100644
--- a/src/frontend/src/app/admin/admin.module.ts
+++ b/src/frontend/src/app/admin/admin.module.ts
@@ -55,6 +55,7 @@ import { KubeConfigmapModule } from './kubernetes/configmap/kube-configmap.modul
import { KubeSecretModule } from './kubernetes/secret/kube-secret.module';
import { KubeIngressModule } from './kubernetes/ingress/kube-ingress.module';
import { KubeStatefulsetModule } from './kubernetes/statefulset/kube-statefulset.module';
+import { KubeDaemonsetModule } from './kubernetes/daemonset/kube-daemonset.module';
@NgModule({
imports: [
@@ -102,7 +103,8 @@ import { KubeStatefulsetModule } from './kubernetes/statefulset/kube-statefulset
KubeConfigmapModule,
KubeSecretModule,
KubeIngressModule,
- KubeStatefulsetModule
+ KubeStatefulsetModule,
+ KubeDaemonsetModule
],
providers: [
AdminAuthCheckGuard,
diff --git a/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.component.html b/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.component.html
new file mode 100644
index 000000000..18a2cfe49
--- /dev/null
+++ b/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.component.html
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.NAME' | translate}}
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.LABEL' | translate}}
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.IMAGES' | translate}}
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.STATUS' | translate}}
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.AGE' | translate}}
+
+
+
+
+ {{ns}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.component.ts b/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.component.ts
new file mode 100644
index 000000000..4fe5dffa8
--- /dev/null
+++ b/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.component.ts
@@ -0,0 +1,65 @@
+import { Component, OnDestroy, OnInit, ViewChild } from '@angular/core';
+import { ActivatedRoute, Router } from '@angular/router';
+import { MessageHandlerService } from '../../../shared/message-handler/message-handler.service';
+import { ClusterService } from '../../../shared/client/v1/cluster.service';
+import { AuthService } from '../../../shared/auth/auth.service';
+import { AceEditorComponent } from '../../../shared/ace-editor/ace-editor.component';
+import { KubernetesClient } from '../../../shared/client/v1/kubernetes/kubernetes';
+import { KubeResourceDaemonSet } from '../../../shared/shared.const';
+import { KubernetesNamespacedResource } from '../../../shared/base/kubernetes-namespaced/kubernetes-namespaced-resource';
+import { DeletionDialogComponent } from '../../../shared/deletion-dialog/deletion-dialog.component';
+import { MigrationComponent } from './migration/migration.component';
+import { ListDaemonsetComponent } from './list-daemonset/list-daemonset.component';
+
+const showState = {
+ 'name': {hidden: false},
+ 'label': {hidden: false},
+ 'containers': {hidden: false},
+ 'status': {hidden: false},
+ 'age': {hidden: false},
+};
+
+@Component({
+ selector: 'wayne-kube-daemonset',
+ templateUrl: './kube-daemonset.component.html'
+})
+
+export class KubeDaemonsetComponent extends KubernetesNamespacedResource implements OnInit, OnDestroy {
+ @ViewChild(ListDaemonsetComponent)
+ listResourceComponent: ListDaemonsetComponent;
+
+ @ViewChild(AceEditorComponent)
+ aceEditorModal: AceEditorComponent;
+
+ @ViewChild(DeletionDialogComponent)
+ deletionDialogComponent: DeletionDialogComponent;
+
+ @ViewChild(MigrationComponent)
+ migrationComponent: MigrationComponent;
+
+ constructor(public kubernetesClient: KubernetesClient,
+ public route: ActivatedRoute,
+ public router: Router,
+ public clusterService: ClusterService,
+ public authService: AuthService,
+ public messageHandlerService: MessageHandlerService) {
+ super(kubernetesClient, route, router, clusterService, authService, messageHandlerService);
+ super.registResourceType('daemonset');
+ super.registKubeResource(KubeResourceDaemonSet);
+ super.registShowSate(showState);
+ }
+
+ ngOnInit() {
+ super.ngOnInit();
+ }
+
+ ngOnDestroy(): void {
+ super.ngOnDestroy();
+ }
+
+
+ migration(obj: any) {
+ this.migrationComponent.openModal(this.cluster, obj);
+ }
+
+}
diff --git a/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.module.ts b/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.module.ts
new file mode 100644
index 000000000..b6a3f5d3e
--- /dev/null
+++ b/src/frontend/src/app/admin/kubernetes/daemonset/kube-daemonset.module.ts
@@ -0,0 +1,31 @@
+import { NgModule } from '@angular/core';
+import { SharedModule } from '../../../shared/shared.module';
+import { ReactiveFormsModule } from '@angular/forms';
+import { KubeDaemonsetComponent } from './kube-daemonset.component';
+import { KubernetesClient } from '../../../shared/client/v1/kubernetes/kubernetes';
+import { DeletionDialogModule } from '../../../shared/deletion-dialog/deletion-dialog.module';
+import { MigrationComponent } from './migration/migration.component';
+import { ListDaemonsetComponent } from './list-daemonset/list-daemonset.component';
+
+@NgModule({
+ imports: [
+ SharedModule,
+ ReactiveFormsModule,
+ DeletionDialogModule
+ ],
+ providers: [
+ KubernetesClient
+ ],
+ exports: [
+ KubeDaemonsetComponent,
+ ListDaemonsetComponent
+ ],
+ declarations: [
+ KubeDaemonsetComponent,
+ ListDaemonsetComponent,
+ MigrationComponent
+ ]
+})
+
+export class KubeDaemonsetModule {
+}
diff --git a/src/frontend/src/app/admin/kubernetes/daemonset/list-daemonset/list-daemonset.component.html b/src/frontend/src/app/admin/kubernetes/daemonset/list-daemonset/list-daemonset.component.html
new file mode 100644
index 000000000..bcc7c6121
--- /dev/null
+++ b/src/frontend/src/app/admin/kubernetes/daemonset/list-daemonset/list-daemonset.component.html
@@ -0,0 +1,63 @@
+
+
+
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.NAME' | translate}}
+
+
+
+
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.LABEL' | translate}}
+
+
+
+
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.IMAGES' | translate}}
+
+
+
+
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.STATUS' | translate}}
+
+
+
+
+ {{'ADMIN.KUBERNETES.DAEMONSET.LIST.AGE' | translate}}
+
+
+
+
+
+
+
+
+
+
+ {{ obj.metadata.name }}
+
+
+
+
+
+
+
+ {{obj.status.numberReady ? obj.status.numberReady : 0 }}/{{obj.status.desiredNumberScheduled}}
+
+
+
+ {{ obj.metadata.creationTimestamp | relativeTime}}
+
+
+
+
+
+
diff --git a/src/frontend/src/app/admin/kubernetes/daemonset/list-daemonset/list-daemonset.component.ts b/src/frontend/src/app/admin/kubernetes/daemonset/list-daemonset/list-daemonset.component.ts
new file mode 100644
index 000000000..577aa73d3
--- /dev/null
+++ b/src/frontend/src/app/admin/kubernetes/daemonset/list-daemonset/list-daemonset.component.ts
@@ -0,0 +1,24 @@
+import { Component, EventEmitter, Input, Output } from '@angular/core';
+import { KubernetesNamespacedListResource } from '../../../../shared/base/kubernetes-namespaced/kubernetes-namespaced-list-resource';
+import { TplDetailService } from '../../../../shared/tpl-detail/tpl-detail.service';
+
+@Component({
+ selector: 'wayne-list-daemonset',
+ templateUrl: './list-daemonset.component.html'
+})
+
+export class ListDaemonsetComponent extends KubernetesNamespacedListResource {
+ @Input() resources: any[];
+ @Input() showState: object;
+
+ @Output() migration = new EventEmitter();
+
+ constructor(public tplDetailService: TplDetailService) {
+ super(tplDetailService);
+ }
+
+
+ migrationResource(obj: any) {
+ this.migration.emit(obj);
+ }
+}
diff --git a/src/frontend/src/app/admin/kubernetes/daemonset/migration/migration.component.html b/src/frontend/src/app/admin/kubernetes/daemonset/migration/migration.component.html
new file mode 100644
index 000000000..488f54eea
--- /dev/null
+++ b/src/frontend/src/app/admin/kubernetes/daemonset/migration/migration.component.html
@@ -0,0 +1,32 @@
+
+ 迁移资源
+
+
+
+
diff --git a/src/frontend/src/app/admin/kubernetes/daemonset/migration/migration.component.ts b/src/frontend/src/app/admin/kubernetes/daemonset/migration/migration.component.ts
new file mode 100644
index 000000000..5ab6b59e1
--- /dev/null
+++ b/src/frontend/src/app/admin/kubernetes/daemonset/migration/migration.component.ts
@@ -0,0 +1,64 @@
+import { Component, OnInit } from '@angular/core';
+import { AppService } from '../../../../shared/client/v1/app.service';
+import { AceEditorService } from '../../../../shared/ace-editor/ace-editor.service';
+import { MessageHandlerService } from '../../../../shared/message-handler/message-handler.service';
+import { MigrationResource } from '../../../../shared/base/kubernetes-namespaced/migration-resource';
+import { KubernetesClient } from '../../../../shared/client/v1/kubernetes/kubernetes';
+import { KubeResourceDaemonSet } from '../../../../shared/shared.const';
+import { DaemonSetService } from '../../../../shared/client/v1/daemonset.service';
+import { DaemonSetTplService } from '../../../../shared/client/v1/daemonsettpl.service';
+import { DaemonSet } from '../../../../shared/model/v1/daemonset';
+import { DaemonSetTemplate } from '../../../../shared/model/v1/daemonsettpl';
+
+@Component({
+ selector: 'kube-migration',
+ templateUrl: 'migration.component.html'
+})
+export class MigrationComponent extends MigrationResource implements OnInit {
+
+ constructor(private daemonSetService: DaemonSetService,
+ private daemonSetTplService: DaemonSetTplService,
+ public appService: AppService,
+ public kubernetesClient: KubernetesClient,
+ public aceEditorService: AceEditorService,
+ public messageHandlerService: MessageHandlerService) {
+ super(kubernetesClient, appService, aceEditorService, messageHandlerService);
+ super.registKubeResource(KubeResourceDaemonSet);
+ }
+
+ ngOnInit(): void {
+ super.ngOnInit();
+ }
+
+ onSubmit() {
+ if (this.isSubmitOnGoing) {
+ return;
+ }
+ this.isSubmitOnGoing = true;
+ const resource = new DaemonSet();
+ resource.name = this.obj.metadata.name;
+ resource.appId = this.selectedApp.id;
+ this.daemonSetService.create(resource).subscribe(
+ resp => {
+ const data = resp.data;
+ const tpl = new DaemonSetTemplate();
+ tpl.name = this.obj.metadata.name;
+ tpl.daemonSetId = data.id;
+ tpl.template = JSON.stringify(this.obj);
+ tpl.description = 'migration from kubernetes. ';
+ this.daemonSetTplService.create(tpl, this.selectedApp.id).subscribe(
+ () => {
+ this.messageHandlerService.showSuccess('资源创建成功!请前往前台手动发布到相应机房!');
+ },
+ error => {
+ this.messageHandlerService.handleError(error);
+ });
+ },
+ error => {
+ this.messageHandlerService.handleError(error);
+ }
+ );
+ this.modalOpened = false;
+ }
+
+}
diff --git a/src/frontend/src/app/admin/sidenav/sidenav.component.html b/src/frontend/src/app/admin/sidenav/sidenav.component.html
index 4b3d372d3..fa3dabe2e 100644
--- a/src/frontend/src/app/admin/sidenav/sidenav.component.html
+++ b/src/frontend/src/app/admin/sidenav/sidenav.component.html
@@ -49,6 +49,13 @@
StatefulSet
+
+
+ DaemonSet
+