diff --git a/cmd/node/add.go b/cmd/node/add.go index e13e107..d424821 100644 --- a/cmd/node/add.go +++ b/cmd/node/add.go @@ -172,7 +172,20 @@ func generateAddNodeOptions(c *cli.Context) (*corepb.AddNodeOptions, error) { "cpumem": cb, "storage": sb, } - + extraResources := c.String("extra-resources") + if extraResources != "" { + extraResourcesMap := make(map[string]any) + if err := json.Unmarshal([]byte(extraResources), &extraResourcesMap); err != nil { + return nil, fmt.Errorf("Invalid value for extra-resources: %v", err) + } + for k, v := range extraResourcesMap { + if _, ok := resources[k]; ok { + continue + } + eb, _ := json.Marshal(v) + resources[k] = eb + } + } labels := utils.SplitEquality(c.StringSlice("label")) return &corepb.AddNodeOptions{ Nodename: nodename, diff --git a/cmd/workload/deploy.go b/cmd/workload/deploy.go index 12eccaf..4ce5a9f 100644 --- a/cmd/workload/deploy.go +++ b/cmd/workload/deploy.go @@ -229,6 +229,20 @@ func generateDeployOptions(c *cli.Context) (*corepb.DeployOptions, error) { "storage": sb, } + extraResources := c.String("extra-resources") + if extraResources != "" { + extraResourcesMap := make(map[string]any) + if err := json.Unmarshal([]byte(extraResources), &extraResourcesMap); err != nil { + return nil, fmt.Errorf("Invalid value for extra-resources: %v", err) + } + for k, v := range extraResourcesMap { + if _, ok := resources[k]; ok { + continue + } + eb, _ := json.Marshal(v) + resources[k] = eb + } + } return &corepb.DeployOptions{ Name: specs.Appname, Entrypoint: &corepb.EntrypointOptions{