Skip to content

Commit

Permalink
metrics-profile flag implementation
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Sep 26, 2024
1 parent 1078970 commit ebd8acb
Show file tree
Hide file tree
Showing 11 changed files with 32 additions and 17 deletions.
4 changes: 3 additions & 1 deletion cluster-density.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
var churnDelay, churnDuration time.Duration
var churnDeletionStrategy string
var podReadyThreshold time.Duration
var metricsProfiles []string
cmd := &cobra.Command{
Use: variant,
Short: fmt.Sprintf("Runs %v workload", variant),
Expand Down Expand Up @@ -60,7 +61,7 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
log.Errorf("image-registry deployment is not deployed")
}
}
setMetrics(cmd, "metrics-aggregated.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
Expand All @@ -73,6 +74,7 @@ func NewClusterDensity(wh *workloads.WorkloadHelper, variant string) *cobra.Comm
cmd.Flags().IntVar(&churnPercent, "churn-percent", 10, "Percentage of job iterations that kube-burner will churn each round")
cmd.Flags().StringVar(&churnDeletionStrategy, "churn-deletion-strategy", "default", "Churn deletion strategy to use")
cmd.Flags().BoolVar(&svcLatency, "service-latency", false, "Enable service latency measurement")
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics-aggregated.yml"}, "Comma separated list of metrics profiles to use")
cmd.MarkFlagRequired("iterations")
return cmd
}
7 changes: 2 additions & 5 deletions common.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,13 @@ import (

var clusterMetadata ocpmetadata.ClusterMetadata

func setMetrics(cmd *cobra.Command, metricsProfile string) {
var metricsProfiles []string
func setMetrics(cmd *cobra.Command, metricsProfiles []string) {
profileType, _ := cmd.Root().PersistentFlags().GetString("profile-type")
switch ProfileType(profileType) {
case Reporting:
metricsProfiles = []string{"metrics-report.yml"}
case Regular:
metricsProfiles = []string{metricsProfile}
case Both:
metricsProfiles = []string{"metrics-report.yml", metricsProfile}
metricsProfiles = append(metricsProfiles, "metrics-report.yml")
}
os.Setenv("METRICS", strings.Join(metricsProfiles, ","))
}
Expand Down
4 changes: 3 additions & 1 deletion crd-scale.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
// NewCrdScale holds the crd-scale workload
func NewCrdScale(wh *workloads.WorkloadHelper) *cobra.Command {
var iterations int
var metricsProfiles []string
cmd := &cobra.Command{
Use: "crd-scale",
Short: "Runs crd-scale workload",
Expand All @@ -33,11 +34,12 @@ func NewCrdScale(wh *workloads.WorkloadHelper) *cobra.Command {
os.Setenv("JOB_ITERATIONS", fmt.Sprint(iterations))
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics-aggregated.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
cmd.Flags().IntVar(&iterations, "iterations", 0, "Number of CRDs to create")
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics-aggregated.yml"}, "Comma separated list of metrics profiles to use")
cmd.MarkFlagRequired("iterations")
return cmd
}
4 changes: 3 additions & 1 deletion egressip.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ func NewEgressIP(wh *workloads.WorkloadHelper, variant string) *cobra.Command {
var iterations, addressesPerIteration int
var externalServerIP string
var podReadyThreshold time.Duration
var metricsProfiles []string
cmd := &cobra.Command{
Use: variant,
Short: fmt.Sprintf("Runs %v workload", variant),
Expand All @@ -160,14 +161,15 @@ func NewEgressIP(wh *workloads.WorkloadHelper, variant string) *cobra.Command {
generateEgressIPs(iterations, addressesPerIteration, externalServerIP)
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics-egressip.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
cmd.Flags().DurationVar(&podReadyThreshold, "pod-ready-threshold", 2*time.Minute, "Pod ready timeout threshold")
cmd.Flags().IntVar(&iterations, "iterations", 0, fmt.Sprintf("%v iterations", variant))
cmd.Flags().StringVar(&externalServerIP, "external-server-ip", "", "External server IP address")
cmd.Flags().IntVar(&addressesPerIteration, "addresses-per-iteration", 1, fmt.Sprintf("%v iterations", variant))
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics-egressip.yml"}, "Comma separated list of metrics profiles to use")
cmd.MarkFlagRequired("iterations")
cmd.MarkFlagRequired("external-server-ip")
return cmd
Expand Down
4 changes: 3 additions & 1 deletion networkpolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func NewNetworkPolicy(wh *workloads.WorkloadHelper, variant string) *cobra.Comma
var churn bool
var churnDelay, churnDuration time.Duration
var churnDeletionStrategy string
var metricsProfiles []string
cmd := &cobra.Command{
Use: variant,
Short: fmt.Sprintf("Runs %v workload", variant),
Expand All @@ -42,7 +43,7 @@ func NewNetworkPolicy(wh *workloads.WorkloadHelper, variant string) *cobra.Comma
os.Setenv("CHURN_DELETION_STRATEGY", churnDeletionStrategy)
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
Expand All @@ -53,6 +54,7 @@ func NewNetworkPolicy(wh *workloads.WorkloadHelper, variant string) *cobra.Comma
cmd.Flags().DurationVar(&churnDelay, "churn-delay", 2*time.Minute, "Time to wait between each churn")
cmd.Flags().IntVar(&churnPercent, "churn-percent", 10, "Percentage of job iterations that kube-burner will churn each round")
cmd.Flags().StringVar(&churnDeletionStrategy, "churn-deletion-strategy", "default", "Churn deletion strategy to use")
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics.yml"}, "Comma separated list of metrics profiles to use")
cmd.MarkFlagRequired("iterations")
return cmd
}
4 changes: 3 additions & 1 deletion node-density-cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ func NewNodeDensityCNI(wh *workloads.WorkloadHelper) *cobra.Command {
var namespacedIterations, svcLatency bool
var podReadyThreshold time.Duration
var iterationsPerNamespace int
var metricsProfiles []string
cmd := &cobra.Command{
Use: "node-density-cni",
Short: "Runs node-density-cni workload",
Expand All @@ -49,7 +50,7 @@ func NewNodeDensityCNI(wh *workloads.WorkloadHelper) *cobra.Command {
os.Setenv("SVC_LATENCY", strconv.FormatBool(svcLatency))
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
Expand All @@ -58,5 +59,6 @@ func NewNodeDensityCNI(wh *workloads.WorkloadHelper) *cobra.Command {
cmd.Flags().BoolVar(&namespacedIterations, "namespaced-iterations", true, "Namespaced iterations")
cmd.Flags().IntVar(&iterationsPerNamespace, "iterations-per-namespace", 1000, "Iterations per namespace")
cmd.Flags().BoolVar(&svcLatency, "service-latency", false, "Enable service latency measurement")
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics.yml"}, "Comma separated list of metrics profiles to use")
return cmd
}
4 changes: 3 additions & 1 deletion node-density-heavy.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func NewNodeDensityHeavy(wh *workloads.WorkloadHelper) *cobra.Command {
var podReadyThreshold, probesPeriod time.Duration
var namespacedIterations bool
var iterationsPerNamespace int
var metricsProfiles []string
cmd := &cobra.Command{
Use: "node-density-heavy",
Short: "Runs node-density-heavy workload",
Expand All @@ -49,7 +50,7 @@ func NewNodeDensityHeavy(wh *workloads.WorkloadHelper) *cobra.Command {
os.Setenv("ITERATIONS_PER_NAMESPACE", fmt.Sprint(iterationsPerNamespace))
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
Expand All @@ -58,5 +59,6 @@ func NewNodeDensityHeavy(wh *workloads.WorkloadHelper) *cobra.Command {
cmd.Flags().IntVar(&podsPerNode, "pods-per-node", 245, "Pods per node")
cmd.Flags().BoolVar(&namespacedIterations, "namespaced-iterations", true, "Namespaced iterations")
cmd.Flags().IntVar(&iterationsPerNamespace, "iterations-per-namespace", 1000, "Iterations per namespace")
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics.yml"}, "Comma separated list of metrics profiles to use")
return cmd
}
4 changes: 3 additions & 1 deletion node-density.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewNodeDensity(wh *workloads.WorkloadHelper) *cobra.Command {
var podsPerNode int
var podReadyThreshold time.Duration
var containerImage string
var metricsProfiles []string
cmd := &cobra.Command{
Use: "node-density",
Short: "Runs node-density workload",
Expand All @@ -45,12 +46,13 @@ func NewNodeDensity(wh *workloads.WorkloadHelper) *cobra.Command {
os.Setenv("CONTAINER_IMAGE", containerImage)
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
cmd.Flags().IntVar(&podsPerNode, "pods-per-node", 245, "Pods per node")
cmd.Flags().DurationVar(&podReadyThreshold, "pod-ready-threshold", 15*time.Second, "Pod ready timeout threshold")
cmd.Flags().StringVar(&containerImage, "container-image", "gcr.io/google_containers/pause:3.1", "Container image")
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics.yml"}, "Comma separated list of metrics profiles to use")
return cmd
}
6 changes: 3 additions & 3 deletions pvc-density.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var dynamicStorageProvisioners = map[string]string{
func NewPVCDensity(wh *workloads.WorkloadHelper) *cobra.Command {

var iterations int
var storageProvisioners []string
var storageProvisioners, metricsProfiles []string
var claimSize string
var containerImage string
provisioner := "aws"
Expand All @@ -64,7 +64,7 @@ func NewPVCDensity(wh *workloads.WorkloadHelper) *cobra.Command {
os.Setenv("STORAGE_PROVISIONER", fmt.Sprint(dynamicStorageProvisioners[provisioner]))
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
Expand All @@ -73,6 +73,6 @@ func NewPVCDensity(wh *workloads.WorkloadHelper) *cobra.Command {
cmd.Flags().StringVar(&provisioner, "provisioner", provisioner, fmt.Sprintf("[%s]", strings.Join(storageProvisioners, " ")))
cmd.Flags().StringVar(&claimSize, "claim-size", "256Mi", "claim-size=256Mi")
cmd.Flags().StringVar(&containerImage, "container-image", "gcr.io/google_containers/pause:3.1", "Container image")

cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics.yml"}, "Comma separated list of metrics profiles to use")
return cmd
}
4 changes: 3 additions & 1 deletion udn-density-l3-pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ func NewUDNDensityL3Pods(wh *workloads.WorkloadHelper) *cobra.Command {
var churn bool
var churnDelay, churnDuration, podReadyThreshold time.Duration
var churnDeletionStrategy string
var metricsProfiles []string
cmd := &cobra.Command{
Use: "udn-density-l3-pods",
Short: "Runs node-density-udn workload",
Expand All @@ -45,7 +46,7 @@ func NewUDNDensityL3Pods(wh *workloads.WorkloadHelper) *cobra.Command {
os.Setenv("POD_READY_THRESHOLD", fmt.Sprintf("%v", podReadyThreshold))
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
Expand All @@ -57,5 +58,6 @@ func NewUDNDensityL3Pods(wh *workloads.WorkloadHelper) *cobra.Command {
cmd.Flags().StringVar(&churnDeletionStrategy, "churn-deletion-strategy", "default", "Churn deletion strategy to use")
cmd.Flags().IntVar(&iterations, "iterations", 0, "Iterations")
cmd.Flags().DurationVar(&podReadyThreshold, "pod-ready-threshold", 1*time.Minute, "Pod ready timeout threshold")
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics.yml"}, "Comma separated list of metrics profiles to use")
return cmd
}
4 changes: 3 additions & 1 deletion web-burner.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ func NewWebBurner(wh *workloads.WorkloadHelper, variant string) *cobra.Command {
var bfd, crd, icni, probe, sriov bool
var bridge string
var podReadyThreshold time.Duration
var metricsProfiles []string
cmd := &cobra.Command{
Use: variant,
Short: fmt.Sprintf("Runs %v workload", variant),
Expand All @@ -44,7 +45,7 @@ func NewWebBurner(wh *workloads.WorkloadHelper, variant string) *cobra.Command {
os.Setenv("SRIOV", fmt.Sprint(sriov))
},
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, "metrics.yml")
setMetrics(cmd, metricsProfiles)
wh.Run(cmd.Name())
},
}
Expand All @@ -57,5 +58,6 @@ func NewWebBurner(wh *workloads.WorkloadHelper, variant string) *cobra.Command {
cmd.Flags().BoolVar(&probe, "probe", false, "Enable readiness probes")
cmd.Flags().BoolVar(&sriov, "sriov", true, "Enable SRIOV")
cmd.Flags().StringVar(&bridge, "bridge", "br-ex", "Data-plane bridge")
cmd.Flags().StringSliceVar(&metricsProfiles, "metrics-profiles", []string{"metrics.yml"}, "Comma separated list of metrics profiles to use")
return cmd
}

0 comments on commit ebd8acb

Please sign in to comment.