Skip to content

Commit

Permalink
Remove metadata from all documents except jobSummary (#85)
Browse files Browse the repository at this point in the history
* Remove metadata from documents except jobSummary

Signed-off-by: Raul Sevilla <[email protected]>

* Bump kube-burner version

Signed-off-by: Raul Sevilla <[email protected]>

---------

Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 authored Aug 28, 2024
1 parent a41e2c4 commit 0f60282
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 9 deletions.
1 change: 0 additions & 1 deletion cmd/ocp.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
10 changes: 9 additions & 1 deletion common.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package ocp

import (
"encoding/json"
"fmt"
"os"
"strings"
Expand All @@ -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")
Expand Down Expand Up @@ -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
}
2 changes: 1 addition & 1 deletion custom-workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down
2 changes: 1 addition & 1 deletion node-density-cni.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion node-density-heavy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion node-density.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down

0 comments on commit 0f60282

Please sign in to comment.