Skip to content

Commit dca8bda

Browse files
author
wilhelmguo
authored
Merge pull request #372 from wilhelmguo/feature/add_template_default_values
Add template default values
2 parents 70efd82 + 3280d1e commit dca8bda

File tree

7 files changed

+46
-14
lines changed

7 files changed

+46
-14
lines changed

src/frontend/src/app/portal/cronjob/create-edit-cronjobtpl/create-edit-cronjobtpl.component.html

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,25 @@ <h3 class="header-title" id="创建计划任务模版">{{'CRONJOB.CREATE_TMP' |
6464
</div>
6565
</label>
6666
</div>
67+
<div class="form-group form-group-padding">
68+
<label class="clr-col-md-3 form-group-label-override">保留成功 Job 数
69+
<a role="tooltip" aria-haspopup="true" class="tooltip tooltip-lg">
70+
<clr-icon shape="info-circle" size="24"></clr-icon>
71+
<span class="tooltip-content">允许保留的成功的任务个数</span>
72+
</a>
73+
</label>
74+
<input type="number" name="successfulJobsHistoryLimit"
75+
[(ngModel)]="kubeResource.spec.successfulJobsHistoryLimit">
76+
<label class="clr-col-md-3 form-group-label-override" style="color: #000">保留失败 Job 数
77+
<a role="tooltip" aria-haspopup="true" class="tooltip tooltip-lg">
78+
<clr-icon shape="info-circle" size="24"></clr-icon>
79+
<span class="tooltip-content">允许保留的失败的任务个数</span>
80+
</a>
81+
</label>
82+
<input type="number" name="failedJobsHistoryLimit"
83+
[(ngModel)]="kubeResource.spec.failedJobsHistoryLimit">
84+
</div>
85+
6786
<div class="form-group form-group-padding">
6887
<label class="clr-col-md-3 form-group-label-override">失败重试次数
6988
<a role="tooltip" aria-haspopup="true" class="tooltip tooltip-lg">
@@ -79,9 +98,11 @@ <h3 class="header-title" id="创建计划任务模版">{{'CRONJOB.CREATE_TMP' |
7998
<span class="tooltip-content">标志任务结束需要成功运行的容器组个数</span>
8099
</a>
81100
</label>
82-
<input type="text" name="completions"
101+
<input type="number" name="completions"
83102
[(ngModel)]="kubeResource.spec.jobTemplate.spec.completions">
84103
</div>
104+
105+
85106
<div class="form-group form-group-padding">
86107
<label class="clr-col-md-3 form-group-label-override">允许并发数
87108
<a role="tooltip" aria-haspopup="true" class="tooltip tooltip-lg">
@@ -97,7 +118,7 @@ <h3 class="header-title" id="创建计划任务模版">{{'CRONJOB.CREATE_TMP' |
97118
<span class="tooltip-content">{{'CRONJOB.MAX_EXECUTE_TIME_MESSAGE' | translate}}</span>
98119
</a>
99120
</label>
100-
<input type="text" name="activeDeadlineSeconds"
121+
<input type="number" name="activeDeadlineSeconds"
101122
[(ngModel)]="kubeResource.spec.jobTemplate.spec.activeDeadlineSeconds">
102123
</div>
103124

src/frontend/src/app/portal/cronjob/create-edit-cronjobtpl/create-edit-cronjobtpl.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,7 @@ export class CreateEditCronjobTplComponent extends ContainerTpl implements OnIni
215215
container.resources.limits = {'memory': '', 'cpu': ''};
216216
container.env = [];
217217
container.envFrom = [];
218+
container.imagePullPolicy = 'IfNotPresent';
218219
return container;
219220
}
220221

src/frontend/src/app/portal/cronjob/list-job/list-job.component.html

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,6 @@ <h3 class="modal-title">
4343
{{kubeObj.spec.schedule}}
4444
</div>
4545
</div>
46-
<div class="clr-row group">
47-
<div class="clr-col-sm-3" style="font-weight:600">
48-
执行中的任务数
49-
</div>
50-
<div class="clr-col-sm-9">
51-
{{kubeObj.status.active?.lenght}}
52-
</div>
53-
</div>
5446
<div class="clr-row group">
5547
<div class="clr-col-sm-3" style="font-weight:600">
5648
最大执行时间
@@ -83,12 +75,20 @@ <h3 class="modal-title">
8375
{{kubeObj.spec.jobTemplate.spec.parallelism}}
8476
</div>
8577
</div>
78+
<div class="clr-row group">
79+
<div class="clr-col-sm-3" style="font-weight:600">
80+
已激活任务数
81+
</div>
82+
<div class="clr-col-sm-9">
83+
{{ kubeObj.status.active?.length }}
84+
</div>
85+
</div>
8686
<div class="clr-row group">
8787
<div class="clr-col-sm-3" style="font-weight:600">
8888
最后调度时间
8989
</div>
9090
<div class="clr-col-sm-9">
91-
{{kubeObj.status.lastScheduleTime}}
91+
{{kubeObj.status.lastScheduleTime | date:'yyyy-MM-dd HH:mm:ss' }}
9292
</div>
9393
</div>
9494
</section>

src/frontend/src/app/portal/daemonset/create-edit-daemonsettpl/create-edit-daemonsettpl.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ export class CreateEditDaemonSetTplComponent extends ContainerTpl implements OnI
344344
container.resources.limits = {'memory': '', 'cpu': ''};
345345
container.env = [];
346346
container.envFrom = [];
347+
container.imagePullPolicy = 'IfNotPresent';
347348
return container;
348349
}
349350

src/frontend/src/app/portal/deployment/create-edit-deploymenttpl/create-edit-deploymenttpl.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ export class CreateEditDeploymentTplComponent extends ContainerTpl implements On
175175
container.resources.limits = {'memory': '', 'cpu': ''};
176176
container.env = [];
177177
container.envFrom = [];
178+
container.imagePullPolicy = 'IfNotPresent';
178179
return container;
179180
}
180181

src/frontend/src/app/portal/statefulset/create-edit-statefulsettpl/create-edit-statefulsettpl.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -329,6 +329,7 @@ export class CreateEditStatefulsettplComponent extends ContainerTpl implements O
329329
container.resources.limits = {'memory': '', 'cpu': ''};
330330
container.env = [];
331331
container.envFrom = [];
332+
container.imagePullPolicy = 'IfNotPresent';
332333
return container;
333334
}
334335

src/frontend/src/app/shared/default-models/cronjob.const.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,26 @@ export const defaultCronJob = `{
1010
}
1111
},
1212
"spec": {
13+
"activeDeadlineSeconds": 30,
14+
"parallelism": 1,
15+
"completions": 1,
16+
"backoffLimit": 6,
1317
"template": {
1418
"metadata": {
1519
"labels": {
1620
}
1721
},
1822
"spec": {
19-
"restartPolicy":"Never",
23+
"restartPolicy": "Never",
2024
"containers": []
2125
}
2226
}
2327
}
2428
},
2529
"concurrencyPolicy": "Allow",
26-
"schedule": "*/1 * * * *"
30+
"schedule": "*/1 * * * *",
31+
"successfulJobsHistoryLimit": 3,
32+
"failedJobsHistoryLimit": 1
2733
}
28-
}`;
34+
}
35+
`;

0 commit comments

Comments
 (0)