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()); 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(); }