Skip to content

Commit b2678fc

Browse files
committed
add default quota
1 parent 92e065f commit b2678fc

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

pkg/controller/queuejob/queuejob_controller_ex.go

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

12721272
//Find if AW has label named "quota_context"
1273-
allLabels := qj.Labels
1273+
allLabels := qj.DeepCopy().Labels
12741274
quotaSetForAw := false
12751275
for labelk, _ := range allLabels {
12761276
if labelk == "quota_context" {
12771277
quotaSetForAw = true
12781278
}
12791279
}
1280+
//When label "quota_context" not found add it
1281+
//this will only work for quota tree and not quota forest
12801282
if quotaSetForAw == false {
1281-
qj.Labels["quota_context"] = "default"
1283+
if len(allLabels) == 0 {
1284+
allLabels = make(map[string]string)
1285+
}
1286+
allLabels["quota_context"] = "default"
1287+
qj.SetLabels(allLabels)
12821288
if err := qjm.updateEtcd(qj, "ScheduleNext - setDefaultQuota"); err == nil {
12831289
klog.V(3).Infof("[ScheduleNext] Default quota added to AW %v", qj.Name)
12841290
}

test/e2e-kuttl/install-quota-subtree.yaml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,5 +53,16 @@ spec:
5353
quotas:
5454
hardLimit: true
5555
requests:
56+
<<<<<<< HEAD:test/e2e-kuttl/install-quota-subtree.yaml
5657
cpu: 900m
57-
memory: 300Mi
58+
memory: 300Mi
59+
=======
60+
cpu: 900
61+
memory: 300
62+
- name: default
63+
quotas:
64+
hardLimit: true
65+
requests:
66+
cpu: 1075
67+
memory: 1045
68+
>>>>>>> 9c356c9f (add default quota):test/e2e-kuttl/quota-forest/01-install.yaml

0 commit comments

Comments
 (0)