Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ <h3 class="header-title" id="创建模版">
<label class="clr-col-md-3 form-group-label-override required">{{'TEMPLATE.UPDATE_WAY' | translate}}</label>
<div class="radio-inline">
<input type="radio" name="statefulSetStrategyType" id="statefulSetStrategyType1" value="RollingUpdate"
[(ngModel)]="kubeResource.spec.strategy.type" checked>
[(ngModel)]="kubeResource.spec.strategy.type" checked (change)="strategyTypeChange()">
<label for="statefulSetStrategyType1">{{'TEMPLATE.SCROLL_UPDATE' | translate}}</label>
</div>
<div class="radio-inline">
<input type="radio" name="statefulSetStrategyType" id="statefulSetStrategyType2" value="Recreate"
[(ngModel)]="kubeResource.spec.strategy.type">
[(ngModel)]="kubeResource.spec.strategy.type" (change)="strategyTypeChange()">
<label for="statefulSetStrategyType2">{{'TEMPLATE.REBUILD' | translate}}</label>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
3 changes: 2 additions & 1 deletion src/frontend/src/app/shared/list-pod/list-pod.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down