From 0f602825b6b6d0c4d809a5fca9ac3d8de8c3705c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Sevilla?= Date: Wed, 28 Aug 2024 13:34:58 +0200 Subject: [PATCH] Remove metadata from all documents except jobSummary (#85) * Remove metadata from documents except jobSummary Signed-off-by: Raul Sevilla * Bump kube-burner version Signed-off-by: Raul Sevilla --------- Signed-off-by: Raul Sevilla --- cmd/ocp.go | 1 - common.go | 10 +++++++++- custom-workload.go | 2 +- go.mod | 2 +- go.sum | 4 ++-- node-density-cni.go | 2 +- node-density-heavy.go | 2 +- node-density.go | 2 +- 8 files changed, 16 insertions(+), 9 deletions(-) diff --git a/cmd/ocp.go b/cmd/ocp.go index 3d78bcbc..f5c326c9 100644 --- a/cmd/ocp.go +++ b/cmd/ocp.go @@ -78,7 +78,6 @@ func openShiftCmd() *cobra.Command { workloadConfig.ConfigDir = configDir kubeClientProvider := config.NewKubeClientProvider("", "") wh = workloads.NewWorkloadHelper(workloadConfig, ocpConfig, kubeClientProvider) - wh.MetricsMetadata = make(map[string]interface{}) envVars := map[string]string{ "UUID": workloadConfig.UUID, "QPS": fmt.Sprintf("%d", QPS), diff --git a/common.go b/common.go index 79cf5bc5..543ac99d 100644 --- a/common.go +++ b/common.go @@ -15,6 +15,7 @@ package ocp import ( + "encoding/json" "fmt" "os" "strings" @@ -25,6 +26,8 @@ import ( "github.com/spf13/cobra" ) +var clusterMetadata ocpmetadata.ClusterMetadata + func setMetrics(cmd *cobra.Command, metricsProfile string) { var metricsProfiles []string profileType, _ := cmd.Root().PersistentFlags().GetString("profile-type") @@ -55,9 +58,14 @@ func GatherMetadata(wh *workloads.WorkloadHelper, alerting bool) error { return fmt.Errorf("error obtaining Prometheus information: %v", err) } } - wh.ClusterMetadata, err = wh.MetadataAgent.GetClusterMetadata() + clusterMetadata, err = wh.MetadataAgent.GetClusterMetadata() + if err != nil { + return err + } + jsonData, err := json.Marshal(clusterMetadata) if err != nil { return err } + json.Unmarshal(jsonData, &wh.Metadata) return nil } diff --git a/custom-workload.go b/custom-workload.go index 6030935e..d742dcef 100644 --- a/custom-workload.go +++ b/custom-workload.go @@ -51,7 +51,7 @@ func CustomWorkload(wh *workloads.WorkloadHelper) *cobra.Command { os.Setenv("JOB_ITERATIONS", fmt.Sprint(iterations)) } if podsPerNode > 0 { - totalPods := wh.ClusterMetadata.WorkerNodesCount * podsPerNode + totalPods := clusterMetadata.WorkerNodesCount * podsPerNode podCount, err := wh.MetadataAgent.GetCurrentPodCount() if err != nil { log.Fatal(err) diff --git a/go.mod b/go.mod index fff9575a..013c5c50 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.22.3 require ( github.com/cloud-bulldozer/go-commons v1.0.16 github.com/google/uuid v1.6.0 - github.com/kube-burner/kube-burner v1.10.5 + github.com/kube-burner/kube-burner v1.10.6 github.com/openshift/api v0.0.0-20240516090725-a20192e21ba6 github.com/openshift/client-go v0.0.0-20240510131258-f646d5f29250 github.com/praserx/ipconv v1.2.1 diff --git a/go.sum b/go.sum index 72acd109..5f7a44f7 100644 --- a/go.sum +++ b/go.sum @@ -354,8 +354,8 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kube-burner/kube-burner v1.10.5 h1:5ofqj26ROWfmjqAJsAdiRAwioOh6sNS1cIFwj+j+FvY= -github.com/kube-burner/kube-burner v1.10.5/go.mod h1:SrXPMLVcgHreF9WzjfakZ5i0Njg3p/2Im6IwFkMxFLQ= +github.com/kube-burner/kube-burner v1.10.6 h1:xd8ersHiRd8Fa/oBPRRmVUkk59G9Su5yWgQXtR6J4yw= +github.com/kube-burner/kube-burner v1.10.6/go.mod h1:SrXPMLVcgHreF9WzjfakZ5i0Njg3p/2Im6IwFkMxFLQ= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.5/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= diff --git a/node-density-cni.go b/node-density-cni.go index 30b52f80..e6f148c5 100644 --- a/node-density-cni.go +++ b/node-density-cni.go @@ -37,7 +37,7 @@ func NewNodeDensityCNI(wh *workloads.WorkloadHelper) *cobra.Command { Short: "Runs node-density-cni workload", SilenceUsage: true, PreRun: func(cmd *cobra.Command, args []string) { - totalPods := wh.ClusterMetadata.WorkerNodesCount * podsPerNode + totalPods := clusterMetadata.WorkerNodesCount * podsPerNode podCount, err := wh.MetadataAgent.GetCurrentPodCount() if err != nil { log.Fatal(err) diff --git a/node-density-heavy.go b/node-density-heavy.go index 6e7a60e1..7e2ea9c4 100644 --- a/node-density-heavy.go +++ b/node-density-heavy.go @@ -36,7 +36,7 @@ func NewNodeDensityHeavy(wh *workloads.WorkloadHelper) *cobra.Command { Short: "Runs node-density-heavy workload", SilenceUsage: true, PreRun: func(cmd *cobra.Command, args []string) { - totalPods := wh.ClusterMetadata.WorkerNodesCount * podsPerNode + totalPods := clusterMetadata.WorkerNodesCount * podsPerNode podCount, err := wh.MetadataAgent.GetCurrentPodCount() if err != nil { log.Fatal(err) diff --git a/node-density.go b/node-density.go index a0ab9f8d..e008572f 100644 --- a/node-density.go +++ b/node-density.go @@ -35,7 +35,7 @@ func NewNodeDensity(wh *workloads.WorkloadHelper) *cobra.Command { Short: "Runs node-density workload", SilenceUsage: true, PreRun: func(cmd *cobra.Command, args []string) { - totalPods := wh.ClusterMetadata.WorkerNodesCount * podsPerNode + totalPods := clusterMetadata.WorkerNodesCount * podsPerNode podCount, err := wh.MetadataAgent.GetCurrentPodCount() if err != nil { log.Fatal(err.Error())