in contrib/cmd/runkperf/commands/bench/node100_pod10k.go [63:162]
func benchNode100DeploymentNPod10KRun(cliCtx *cli.Context) (*internaltypes.BenchmarkReport, error) {
ctx := context.Background()
kubeCfgPath := cliCtx.GlobalString("kubeconfig")
rgCfgFile, rgSpec, rgCfgFileDone, err := newLoadProfileFromEmbed(cliCtx,
"loadprofile/node100_pod10k.yaml")
if err != nil {
return nil, err
}
defer func() { _ = rgCfgFileDone() }()
// NOTE: The nodepool name should be aligned with ../../../../internal/manifests/loadprofile/node100_pod10k.yaml.
vcDone, err := deployVirtualNodepool(ctx, cliCtx, "node100pod10k",
100,
cliCtx.Int("cpu"),
cliCtx.Int("memory"),
cliCtx.Int("max-pods"),
)
if err != nil {
return nil, fmt.Errorf("failed to deploy virtual node: %w", err)
}
defer func() { _ = vcDone() }()
dpCtx, dpCancel := context.WithCancel(ctx)
defer dpCancel()
var wg sync.WaitGroup
wg.Add(1)
restartInterval := cliCtx.Duration("interval")
log.GetLogger(dpCtx).
WithKeyValues("level", "info").
LogKV("msg", fmt.Sprintf("the interval is %v for restaring deployments", restartInterval))
paddingBytes := cliCtx.Int("padding-bytes")
total := cliCtx.Int("deployments")
replica := 10000 / total
// NOTE: The name pattern should be aligned with ../../../../internal/manifests/loadprofile/node100_pod10k.yaml.
deploymentNamePattern := "benchmark"
rollingUpdateFn, ruCleanupFn, err := utils.DeployAndRepeatRollingUpdateDeployments(dpCtx,
kubeCfgPath, deploymentNamePattern, total, replica, paddingBytes, restartInterval)
if err != nil {
dpCancel()
return nil, fmt.Errorf("failed to setup workload: %w", err)
}
defer ruCleanupFn()
err = dumpDeploymentReplicas(ctx, kubeCfgPath, deploymentNamePattern, total)
if err != nil {
return nil, err
}
podSize, err := getDeploymentPodSize(ctx, kubeCfgPath, deploymentNamePattern)
if err != nil {
return nil, err
}
podSize = (podSize / 1024) * 1024
go func() {
defer wg.Done()
// FIXME(weifu):
//
// DeployRunnerGroup should return ready notification.
// The rolling update should run after runners.
rollingUpdateFn()
}()
rgResult, derr := utils.DeployRunnerGroup(ctx,
cliCtx.GlobalString("kubeconfig"),
cliCtx.GlobalString("runner-image"),
rgCfgFile,
cliCtx.GlobalString("runner-flowcontrol"),
cliCtx.GlobalString("rg-affinity"),
)
dpCancel()
wg.Wait()
if derr != nil {
return nil, derr
}
return &internaltypes.BenchmarkReport{
Description: fmt.Sprintf(`
Environment: 100 virtual nodes managed by kwok-controller,
Workload: Deploy %d deployments with %d pods. Rolling-update deployments one by one and the interval is %v`,
total, total*replica, restartInterval),
LoadSpec: *rgSpec,
Result: *rgResult,
Info: map[string]interface{}{
"podSizeInBytes": podSize,
"interval": restartInterval.String(),
},
}, nil
}