Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions contrib/cmd/runkperf/commands/bench/list_configmaps.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,14 @@ func benchListConfigmapsRun(cliCtx *cli.Context) (*internaltypes.BenchmarkReport
cmSize := cliCtx.Int("size")
cmGroupSize := cliCtx.Int("group-size")

err = utils.CreateConfigmaps(ctx, kubeCfgPath, cmAmount, cmSize, cmGroupSize, benchConfigmapNamespace, 0)
err = utils.CreateConfigmaps(ctx, kubeCfgPath, benchConfigmapNamespace, "runkperf-bench", cmAmount, cmSize, cmGroupSize, 0)
if err != nil {
return nil, err
}

defer func() {
// Delete the configmaps after the benchmark
err = utils.DeleteConfigmaps(ctx, kubeCfgPath, benchConfigmapNamespace, 0)
err = utils.DeleteConfigmaps(ctx, kubeCfgPath, benchConfigmapNamespace, "runkperf-bench", 0)
if err != nil {
log.GetLogger(ctx).WithKeyValues("level", "error").
LogKV("msg", fmt.Sprintf("Failed to delete configmaps: %v", err))
Expand Down
13 changes: 7 additions & 6 deletions contrib/utils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -544,13 +544,14 @@ func CreateTempFileWithContent(data []byte) (_name string, _cleanup func() error
}

// Creates configmaps for benchmark.
func CreateConfigmaps(ctx context.Context, kubeCfgPath string,
cmAmount int, cmSize int, cmGroupSize int, namespace string, timeout time.Duration) error {
func CreateConfigmaps(ctx context.Context, kubeCfgPath, namespace, namePattern string,
cmAmount, cmSize, cmGroupSize int, timeout time.Duration) error {
args := []string{"data", "configmap"}
if kubeCfgPath != "" {
args = append(args, fmt.Sprintf("--kubeconfig=%s", kubeCfgPath))
}
args = append(args, fmt.Sprintf("--namespace=%s", namespace), "add", "runkperf-bench")

args = append(args, fmt.Sprintf("--namespace=%s", namespace), "add", namePattern)
args = append(args, fmt.Sprintf("--total=%d", cmAmount))
args = append(args, fmt.Sprintf("--size=%d", cmSize))
args = append(args, fmt.Sprintf("--group-size=%d", cmGroupSize))
Expand All @@ -561,12 +562,12 @@ func CreateConfigmaps(ctx context.Context, kubeCfgPath string,
}

// Delete configmaps for benchmark.
func DeleteConfigmaps(ctx context.Context, kubeCfgPath string, namespace string, timeout time.Duration) error {
func DeleteConfigmaps(ctx context.Context, kubeCfgPath, namespace, namePattern string, timeout time.Duration) error {
args := []string{"data", "configmap"}
if kubeCfgPath != "" {
args = append(args, "--kubeconfig=%s", kubeCfgPath)
args = append(args, fmt.Sprintf("--kubeconfig=%s", kubeCfgPath))
}
args = append(args, fmt.Sprintf("--namespace=%s", namespace), "delete", "runkperf-bench")
args = append(args, fmt.Sprintf("--namespace=%s", namespace), "delete", namePattern)

_, err := runCommand(ctx, timeout, "runkperf", args)
return err
Expand Down
Loading