Skip to content

Commit

Permalink
[PERFSCALE-3594] Refactor udn-density-pods (#152)
Browse files Browse the repository at this point in the history
* Refactor udn-density-pods

This PR refactors udn_l2 & udn_l3 code.
Adds conditional check to choose between udn_l2.yml/udn_l3.yml

Signed-off-by: Krishna Harsha Voora <krvoora@redhat.com>

* Simplify the code, introduce mode

Signed-off-by: Krishna Harsha Voora <krvoora@redhat.com>

* Minor nits/updates

Signed-off-by: Krishna Harsha Voora <krvoora@redhat.com>

* Add logging for L3/L2

Signed-off-by: Krishna Harsha Voora <krvoora@redhat.com>

---------

Signed-off-by: Krishna Harsha Voora <krvoora@redhat.com>
  • Loading branch information
krishvoor authored Nov 25, 2024
1 parent 1ebd009 commit 67ad7fe
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 195 deletions.
59 changes: 0 additions & 59 deletions cmd/config/udn-density-l3-pods/deployment-client.yml

This file was deleted.

57 changes: 0 additions & 57 deletions cmd/config/udn-density-l3-pods/deployment-server.yml

This file was deleted.

65 changes: 0 additions & 65 deletions cmd/config/udn-density-l3-pods/udn-density-l3-pods.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ metricsEndpoints:
{{ end }}

jobs:
- name: udn-density-l2-pods
namespace: udn-density-l2-pods
- name: udn-density-pods
namespace: udn-density-pods
jobIterations: {{.JOB_ITERATIONS}}
qps: {{.QPS}}
burst: {{.BURST}}
Expand All @@ -50,9 +50,13 @@ jobs:
pod-security.kubernetes.io/audit: privileged
pod-security.kubernetes.io/warn: privileged
objects:

- objectTemplate: udn.yml
{{ if eq .ENABLE_LAYER_3 "true"}}
- objectTemplate: udn_l3.yml
replicas: 1
{{ else }}
- objectTemplate: udn_l2.yml
replicas: 1
{{ end }}

- objectTemplate: deployment-server.yml
replicas: 3
Expand Down
File renamed without changes.
File renamed without changes.
18 changes: 8 additions & 10 deletions udn-density-pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ import (
"time"

"github.com/kube-burner/kube-burner/pkg/workloads"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

// NewUDNDensityPods holds udn-density-pods workload
func NewUDNDensityPods(wh *workloads.WorkloadHelper) *cobra.Command {
var churnPercent, churnCycles, iterations int
var churn, l2, l3 bool
var churn, l3 bool
var churnDelay, churnDuration, podReadyThreshold time.Duration
var churnDeletionStrategy string
var metricsProfiles []string
Expand All @@ -48,21 +49,19 @@ func NewUDNDensityPods(wh *workloads.WorkloadHelper) *cobra.Command {
Run: func(cmd *cobra.Command, args []string) {
setMetrics(cmd, metricsProfiles)
// Disable l3 when the user chooses l2
if l2 {
l3 = false
}
if l3 {
rc = wh.Run("udn-density-l3-pods")
}
if l2 {
rc = wh.Run("udn-density-l2-pods")
log.Info("Layer 3 is enabled")
os.Setenv("ENABLE_LAYER_3", "true")
} else {
log.Info("Layer 2 is enabled")
os.Setenv("ENABLE_LAYER_3", "false")
}
rc = wh.Run("udn-density-pods")
},
PostRun: func(cmd *cobra.Command, args []string) {
os.Exit(rc)
},
}
cmd.Flags().BoolVar(&l2, "layer2", false, "Layer2 UDN test")
cmd.Flags().BoolVar(&l3, "layer3", true, "Layer3 UDN test")
cmd.Flags().BoolVar(&churn, "churn", true, "Enable churning")
cmd.Flags().IntVar(&churnCycles, "churn-cycles", 0, "Churn cycles to execute")
Expand All @@ -73,6 +72,5 @@ func NewUDNDensityPods(wh *workloads.WorkloadHelper) *cobra.Command {
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-profile", []string{"metrics.yml"}, "Comma separated list of metrics profiles to use")
cmd.MarkFlagsMutuallyExclusive("layer2", "layer3")
return cmd
}

0 comments on commit 67ad7fe

Please sign in to comment.