Skip to content

Commit 9c356c9

Browse files
committed
add default quota
1 parent d65c3a5 commit 9c356c9

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

pkg/controller/queuejob/queuejob_controller_ex.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,15 +1261,21 @@ func (qjm *XController) ScheduleNext() {
12611261
// All non-quota submission AWs will consume quota from default node.
12621262

12631263
//Find if AW has label named "quota_context"
1264-
allLabels := qj.Labels
1264+
allLabels := qj.DeepCopy().Labels
12651265
quotaSetForAw := false
12661266
for labelk, _ := range allLabels {
12671267
if labelk == "quota_context" {
12681268
quotaSetForAw = true
12691269
}
12701270
}
1271+
//When label "quota_context" not found add it
1272+
//this will only work for quota tree and not quota forest
12711273
if quotaSetForAw == false {
1272-
qj.Labels["quota_context"] = "default"
1274+
if len(allLabels) == 0 {
1275+
allLabels = make(map[string]string)
1276+
}
1277+
allLabels["quota_context"] = "default"
1278+
qj.SetLabels(allLabels)
12731279
if err := qjm.updateEtcd(qj, "ScheduleNext - setDefaultQuota"); err == nil {
12741280
klog.V(3).Infof("[ScheduleNext] Default quota added to AW %v", qj.Name)
12751281
}

test/e2e-kuttl/quota-forest/01-install.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,10 @@ spec:
5454
hardLimit: true
5555
requests:
5656
cpu: 900
57-
memory: 300
57+
memory: 300
58+
- name: default
59+
quotas:
60+
hardLimit: true
61+
requests:
62+
cpu: 1075
63+
memory: 1045

0 commit comments

Comments
 (0)