From 071eee0e6a7a35d5ffaae02e54f3cbe92ee2b3df Mon Sep 17 00:00:00 2001 From: BennieMeng Date: Thu, 11 Apr 2019 11:11:40 +0800 Subject: [PATCH 1/2] fix: deployment strategy changeto rollingupdate error --- .../create-edit-deploymenttpl.component.html | 4 ++-- .../create-edit-deploymenttpl.component.ts | 8 ++++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.html b/src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.html index b6430ee5b..9063211a9 100644 --- a/src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.html +++ b/src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.html @@ -23,12 +23,12 @@

+ [(ngModel)]="kubeResource.spec.strategy.type" checked (change)="strategyTypeChange()">
+ [(ngModel)]="kubeResource.spec.strategy.type" (change)="strategyTypeChange()">
diff --git a/src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.ts b/src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.ts index c528a9fb9..34e9a74a3 100644 --- a/src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.ts +++ b/src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.ts @@ -164,6 +164,14 @@ export class CreateEditDeploymentTplComponent extends ContainerTpl implements On return cpuLimit; } + strategyTypeChange() { + if (this.kubeResource.spec.strategy.type === 'RollingUpdate' && !this.kubeResource.spec.strategy.rollingUpdate) { + this.kubeResource.spec.strategy.rollingUpdate = new RollingUpdateDeployment(); + this.kubeResource.spec.strategy.rollingUpdate.maxSurge = '20%'; + this.kubeResource.spec.strategy.rollingUpdate.maxUnavailable = 1; + } + } + initDefault() { this.kubeResource = JSON.parse(defaultDeployment); this.kubeResource.spec.template.spec.containers.push(this.defaultContainer()); From 00c147b809265bd3394a3a005113052cb3e3e832 Mon Sep 17 00:00:00 2001 From: BennieMeng Date: Fri, 12 Apr 2019 18:55:30 +0800 Subject: [PATCH 2/2] frontend: change log copy command deployments to deployment --- .../src/app/portal/pod-logging/pod-logging.component.ts | 3 ++- src/frontend/src/app/shared/list-pod/list-pod.component.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/app/portal/pod-logging/pod-logging.component.ts b/src/frontend/src/app/portal/pod-logging/pod-logging.component.ts index f3c827aee..bbce58381 100644 --- a/src/frontend/src/app/portal/pod-logging/pod-logging.component.ts +++ b/src/frontend/src/app/portal/pod-logging/pod-logging.component.ts @@ -93,7 +93,8 @@ export class PodLoggingComponent implements OnInit, OnDestroy { this.messageHandlerService.showInfo('缺少机房信息,请联系管理员'); } const command = this.selectedPod ? - `kubetool log --source ${this.logSource === undefined ? '' : this.logSource} --${this.resourceType} ` + + `kubetool log --source ${this.logSource === undefined ? '' : this.logSource}` + + ` --${this.resourceType === 'deployments' ? 'deployment' : this.resourceType} ` + `${this.resourceName} --pod=${this.selectedPod.metadata.name} --container=${this.selectedContainer} --layout=log` : ''; this.copyService.copy(command); this.switchCopyButton(); diff --git a/src/frontend/src/app/shared/list-pod/list-pod.component.ts b/src/frontend/src/app/shared/list-pod/list-pod.component.ts index e7058d7c2..7b6b32398 100644 --- a/src/frontend/src/app/shared/list-pod/list-pod.component.ts +++ b/src/frontend/src/app/shared/list-pod/list-pod.component.ts @@ -200,7 +200,8 @@ export class ListPodComponent implements OnDestroy { this.messageHandlerService.showInfo('缺少机房信息,请联系管理员'); } const kubeToolCmd = `kubetool log --source ${this.logSource === undefined ? '' : this.logSource} ` + - ` --${this.resourceType} ${this.resourceName} --pod=${pod.metadata.name} --layout=log`; + ` --${this.resourceType === 'deployments' ? 'deployment' : this.resourceType} ${this.resourceName}` + + ` --pod=${pod.metadata.name} --layout=log`; this.copyService.copy(kubeToolCmd); this.switchCopyButton(); }