Skip to content

Commit

Permalink
cli: fix typos in quota_init and spec parsing (#23891)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkazmierczak authored Aug 29, 2024
1 parent 8407a9f commit 6700937
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 22 deletions.
4 changes: 2 additions & 2 deletions command/quota_apply.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ func parseQuotaResource(result *api.Resources, list *ast.ObjectList) error {
"cpu",
"memory",
"memory_max",
"devices",
"device",
}
if err := helper.CheckHCLKeys(listVal, valid); err != nil {
return multierror.Prefix(err, "resources ->")
Expand All @@ -282,7 +282,7 @@ func parseQuotaResource(result *api.Resources, list *ast.ObjectList) error {
}

// Manually parse
delete(m, "devices")
delete(m, "device")

if err := mapstructure.WeakDecode(m, result); err != nil {
return err
Expand Down
41 changes: 21 additions & 20 deletions command/quota_init.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ limit {
cpu = 2500
memory = 1000
memory_max = 1000
device {
name = "nvidia/gpu/1080ti",
device "nvidia/gpu/1080ti" {
count = 1,
}
}
Expand All @@ -134,23 +133,25 @@ limit {

var defaultJsonQuotaSpec = strings.TrimSpace(`
{
"Name": "default-quota",
"Description": "Limit the shared default namespace",
"Limits": [
{
"Region": "global",
"RegionLimit": {
"Cores": 0,
"CPU": 2500,
"MemoryMB": 1000,
"MemoryMaxMB": 1000
"Device": {
"Name": "nvidia/gpu/1080ti",
"Count": 1
},
},
"VariablesLimit": 1000
}
]
"Name": "default-quota",
"Description": "Limit the shared default namespace",
"Limits": [
{
"Region": "global",
"RegionLimit": {
"Cores": 0,
"CPU": 2500,
"MemoryMB": 1000,
"MemoryMaxMB": 1000,
"Devices": [
{
"Name": "nvidia/gpu/1080ti",
"Count": 1
}
]
},
"VariablesLimit": 1000
}
]
}
`)

0 comments on commit 6700937

Please sign in to comment.