Skip to content

Commit

Permalink
Add ocpMajorVersion field (kube-burner#368)
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 authored Jun 29, 2023
1 parent 65c80e2 commit bc55c6a
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 49 deletions.
67 changes: 46 additions & 21 deletions docs/ocp.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,29 +154,54 @@ $ kube-burner ocp node-density --pods-per-node=100 # Run workload

## Cluster metadata

When benchmark finishes, kube-burner will index the cluster metadata in the configured indexer. At the time of writing this document is based on the following golang struct:
When the benchmark finishes, kube-burner will index the cluster metadata in the configured indexer. At the time of writing this document is based on the following golang struct:

```golang
type clusterMetadata struct {
MetricName string `json:"metricName,omitempty"`
UUID string `json:"uuid"`
Platform string `json:"platform"`
OCPVersion string `json:"ocpVersion"`
K8SVersion string `json:"k8sVersion"`
MasterNodesType string `json:"masterNodesType"`
WorkerNodesType string `json:"workerNodesType"`
InfraNodesType string `json:"infraNodesType"`
WorkerNodesCount int `json:"workerNodesCount"`
InfraNodesCount int `json:"infraNodesCount"`
TotalNodes int `json:"totalNodes"`
SDNType string `json:"sdnType"`
Benchmark string `json:"benchmark"`
Timestamp time.Time `json:"timestamp"`
EndDate time.Time `json:"endDate"`
ClusterName string `json:"clusterName"`
Passed bool `json:"passed"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
type BenchmarkMetadata struct {
ocpmetadata.ClusterMetadata
UUID string `json:"uuid"`
Benchmark string `json:"benchmark"`
Timestamp time.Time `json:"timestamp"`
EndDate time.Time `json:"endDate"`
Passed bool `json:"passed"`
UserMetadata map[string]interface{} `json:"metadata,omitempty"`
}
```

Where metricName is hardcoded to `clusterMetadata`
Where `ocpmetadata.ClusterMetadata` is an embed struct inherited from the [go-commons library](https://github.com/cloud-bulldozer/go-commons/blob/main/ocp-metadata/types.go) which has the following fields:

```golang
// Type to store cluster metadata
type ClusterMetadata struct {
MetricName string `json:"metricName,omitempty"`
Platform string `json:"platform"`
OCPVersion string `json:"ocpVersion"`
OCPMajorVersion string `json:"ocpMajorVersion"`
K8SVersion string `json:"k8sVersion"`
MasterNodesType string `json:"masterNodesType"`
WorkerNodesType string `json:"workerNodesType"`
MasterNodesCount int `json:"masterNodesCount"`
InfraNodesType string `json:"infraNodesType"`
WorkerNodesCount int `json:"workerNodesCount"`
InfraNodesCount int `json:"infraNodesCount"`
TotalNodes int `json:"totalNodes"`
SDNType string `json:"sdnType"`
ClusterName string `json:"clusterName"`
Region string `json:"region"`
}
```

MetricName is hardcoded to `clusterMetadata`

<!-- markdownlint-disable -->
!!! Info
It's important to note that every document indexed when using an OCP wrapper workload will include an small subset of the previous fields:
```yaml
platform
ocpVersion
ocpMajorVersion
k8sVersion
totalNodes
sdnType
```
<!-- markdownlint-restore -->
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.19

require (
github.com/Masterminds/sprig/v3 v3.2.2
github.com/cloud-bulldozer/go-commons v1.0.5
github.com/cloud-bulldozer/go-commons v1.0.7
github.com/prometheus/common v0.44.0
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.9.0
Expand All @@ -25,7 +25,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/elastic/go-elasticsearch/v7 v7.13.1 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
Expand Down Expand Up @@ -58,7 +58,7 @@ require (
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
github.com/cloud-bulldozer/go-commons v1.0.5 h1:kRtXCbS4vMZP95eF156RikD67bL+UIVU/5kv6rhfVjA=
github.com/cloud-bulldozer/go-commons v1.0.5/go.mod h1:BFftIY6RQAM7HORjIwg/DClUrbKtxpnpUtlg6J8nJRs=
github.com/cloud-bulldozer/go-commons v1.0.7 h1:fYwGUDf6rUANmAkMpBsL3q5c8thkR4i5bS6VdXm9gcQ=
github.com/cloud-bulldozer/go-commons v1.0.7/go.mod h1:4EOHI/QEs0tgNK4CroFGhEPDvImjRqsJvJZRY9fpSNk=
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk=
Expand Down Expand Up @@ -159,8 +159,8 @@ github.com/go-logr/logr v0.1.0/go.mod h1:ixOQHD9gLJUVQQ2ZOR7zLEifBX6tGkNJF4QyIY7
github.com/go-logr/logr v0.2.0/go.mod h1:z6/tIYblkpsD+a4lm/fGIIU9mZ+XfAiaFtq7xTgseGU=
github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0=
github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ=
github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A=
github.com/go-logr/zapr v1.2.0/go.mod h1:Qa4Bsj2Vb+FAVeAKsLD8RLQ+YRJB8YDmOAKxaBQf7Ro=
github.com/go-openapi/jsonpointer v0.19.3/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
Expand All @@ -177,8 +177,8 @@ github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/e
github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g=
github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
Expand Down Expand Up @@ -402,13 +402,13 @@ github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9k
github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
github.com/onsi/ginkgo/v2 v2.0.0/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c=
github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk=
github.com/onsi/ginkgo/v2 v2.11.0 h1:WgqUCUt/lT6yXoQ8Wef0fsNn5cAuMK7+KT9UFRz2tcU=
github.com/onsi/gomega v0.0.0-20170829124025-dcabb60a477c/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA=
github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY=
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY=
github.com/onsi/gomega v1.18.1/go.mod h1:0q+aL8jAiMXy9hbwj2mr5GziHiwhAIQpFmmtT5hitRs=
github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E=
github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc=
github.com/opensearch-project/opensearch-go v1.1.0 h1:eG5sh3843bbU1itPRjA9QXbxcg8LaZ+DjEzQH9aLN3M=
github.com/opensearch-project/opensearch-go v1.1.0/go.mod h1:+6/XHCuTH+fwsMJikZEWsucZ4eZMma3zNSeLrTtVGbo=
github.com/openshift/custom-resource-status v1.1.2 h1:C3DL44LEbvlbItfd8mT5jWrqPfHnSOQoQf/sypqA6A4=
Expand Down Expand Up @@ -757,8 +757,8 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0 h1:EBmGv8NaZBZTWvrbjNoL6HVt+IVy3QDQpJs7VRIw3tU=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.9.0 h1:KS/R3tvhPqvJvwcKfnBHJwwthS11LRhmM5D59eEXa0s=
golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down Expand Up @@ -842,7 +842,7 @@ golang.org/x/tools v0.1.2/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.6-0.20210820212750-d4cc65f0b2ff/go.mod h1:YD9qOF0M9xpSpdWTBbzEl5e/RnCefISl8E5Noe10jFM=
golang.org/x/tools v0.1.9/go.mod h1:nABZi5QlRsZVlzPpHl034qft6wpY4eDcsTt5AaioBiU=
golang.org/x/tools v0.7.0 h1:W4OVu8VVOaIO0yzWMNdepAulS7YfoS3Zabrm8DOXXU4=
golang.org/x/tools v0.9.3 h1:Gn1I8+64MsuTb/HpH+LmQtNas23LhUVr3rYZ0eKuaMM=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
5 changes: 4 additions & 1 deletion pkg/burner/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,10 @@ func indexjobSummaryInfo(indexer *indexers.Indexer, uuid string, elapsedTime flo
}
log.Infof("Indexing metric %s", jobSummaryMetric)
log.Debugf("Indexing [%d] documents", len(metadataInfo))
resp, err := (*indexer).Index(metadataInfo, indexers.IndexingOpts{MetricName: jobSummaryMetric, JobName: jobConfig.Name})
indexingOpts := indexers.IndexingOpts{
MetricName: fmt.Sprintf("%s-%s", jobSummaryMetric, jobConfig.Name),
}
resp, err := (*indexer).Index(metadataInfo, indexingOpts)
if err != nil {
log.Error(err)
} else {
Expand Down
7 changes: 3 additions & 4 deletions pkg/measurements/pod_latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,6 @@ func (p *podLatency) stop() (int, error) {

// index sends metrics to the configured indexer
func (p *podLatency) index() {
indexingOpts := indexers.IndexingOpts{
JobName: factory.jobConfig.Name,
}
metricMap := map[string][]interface{}{
podLatencyMeasurement: p.normLatencies,
podLatencyQuantilesMeasurement: p.latencyQuantiles,
Expand All @@ -185,7 +182,9 @@ func (p *podLatency) index() {
delete(metricMap, podLatencyMeasurement)
}
for metricName, data := range metricMap {
indexingOpts.MetricName = metricName
indexingOpts := indexers.IndexingOpts{
MetricName: fmt.Sprintf("%s-%s", metricName, factory.jobConfig.Name),
}
log.Debugf("Indexing [%d] documents", len(data))
resp, err := (*factory.indexer).Index(data, indexingOpts)
if err != nil {
Expand Down
7 changes: 3 additions & 4 deletions pkg/measurements/vmi_latency.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,6 @@ func (p *vmiLatency) stop() (int, error) {

// index sends metrics to the configured indexer
func (p *vmiLatency) index() {
indexingOpts := indexers.IndexingOpts{
JobName: factory.jobConfig.Name,
}
metricMap := map[string][]interface{}{
podLatencyMeasurement: p.normLatencies,
podLatencyQuantilesMeasurement: p.latencyQuantiles,
Expand All @@ -390,7 +387,9 @@ func (p *vmiLatency) index() {
delete(metricMap, podLatencyMeasurement)
}
for metricName, data := range metricMap {
indexingOpts.MetricName = metricName
indexingOpts := indexers.IndexingOpts{
MetricName: fmt.Sprintf("%s-%s", metricName, factory.jobConfig.Name),
}
log.Debugf("Indexing [%d] documents", len(data))
resp, err := (*factory.indexer).Index(data, indexingOpts)
if err != nil {
Expand Down
11 changes: 6 additions & 5 deletions pkg/workloads/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,12 @@ func (wh *WorkloadHelper) indexMetadata() {

func (wh *WorkloadHelper) run(workload, metricsProfile string) {
metadata := map[string]interface{}{
"platform": wh.Metadata.Platform,
"ocpVersion": wh.Metadata.OCPVersion,
"k8sVersion": wh.Metadata.K8SVersion,
"totalNodes": wh.Metadata.TotalNodes,
"sdnType": wh.Metadata.SDNType,
"platform": wh.Metadata.Platform,
"ocpVersion": wh.Metadata.OCPVersion,
"ocpMajorVersion": wh.Metadata.OCPMajorVersion,
"k8sVersion": wh.Metadata.K8SVersion,
"totalNodes": wh.Metadata.TotalNodes,
"sdnType": wh.Metadata.SDNType,
}
// Combine provided userMetadata with the regular OCP metadata
for k, v := range wh.Metadata.UserMetadata {
Expand Down
4 changes: 3 additions & 1 deletion test/helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ check_files() {
fi
done
if [[ ${rc} != 0 ]]; then
echo "Content of ${TEMP_FOLDER}"
echo "Content of ${TEMP_FOLDER}:"
ls -l ${TEMP_FOLDER}
fi
}
Expand All @@ -86,6 +86,8 @@ check_file_list() {
for f in "${@}"; do
if [[ ! -f ${f} ]]; then
echo "File ${f} not found"
echo "Content of $(dirname ${f}):"
ls -l "$(dirname ${f})"
return 1
fi
if [[ $(jq .[0].metricName ${f}) == "" ]]; then
Expand Down

0 comments on commit bc55c6a

Please sign in to comment.