Skip to content

Commit

Permalink
Integrating indexers from go-commons (kube-burner#296)
Browse files Browse the repository at this point in the history
* integrating indexers in go-commons

* modifying go version to the latest

* fixing linting erros

* making it compatible with go-commons indexers

* fixing index type casting issue

* fix linting erros

* Update pkg/measurements/pod_latency.go

Co-authored-by: Raúl Sevilla <[email protected]>

* Update pkg/measurements/vmi_latency.go

Co-authored-by: Raúl Sevilla <[email protected]>

---------

Co-authored-by: Raúl Sevilla <[email protected]>
  • Loading branch information
vishnuchalla and rsevilla87 authored May 3, 2023
1 parent 410079b commit 7de818f
Show file tree
Hide file tree
Showing 21 changed files with 132 additions and 340 deletions.
14 changes: 9 additions & 5 deletions cmd/kube-burner/kube-burner.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
"github.com/cloud-bulldozer/kube-burner/pkg/util/metrics"
"github.com/cloud-bulldozer/kube-burner/pkg/version"

"github.com/cloud-bulldozer/kube-burner/pkg/indexers"
"github.com/cloud-bulldozer/go-commons/indexers"
"github.com/cloud-bulldozer/kube-burner/pkg/prometheus"

uid "github.com/satori/go.uuid"
Expand Down Expand Up @@ -250,11 +250,13 @@ func importCmd() *cobra.Command {
if err != nil {
log.Fatal(err.Error())
}
indexer, err := indexers.NewIndexer(configSpec)
indexerConfig := configSpec.GlobalConfig.IndexerConfig
log.Infof("📁 Creating indexer: %s", indexerConfig.Type)
indexer, err := indexers.NewIndexer(indexerConfig)
if err != nil {
log.Fatal(err.Error())
}
err = metrics.ImportTarball(tarball, indexer)
err = metrics.ImportTarball(tarball, indexer, indexerConfig.MetricsDirectory)
if err != nil {
log.Fatal(err.Error())
}
Expand Down Expand Up @@ -291,7 +293,9 @@ func alertCmd() *cobra.Command {
}
}
if configSpec.GlobalConfig.IndexerConfig.Enabled {
indexer, err = indexers.NewIndexer(configSpec)
indexerConfig := configSpec.GlobalConfig.IndexerConfig
log.Infof("📁 Creating indexer: %s", indexerConfig.Type)
indexer, err = indexers.NewIndexer(indexerConfig)
if err != nil {
log.Fatal(err.Error())
}
Expand All @@ -308,7 +312,7 @@ func alertCmd() *cobra.Command {
}
startTime := time.Unix(start, 0)
endTime := time.Unix(end, 0)
if alertM, err = alerting.NewAlertManager(alertProfile, uuid, configSpec.GlobalConfig.IndexerConfig.DefaultIndex, indexer, p); err != nil {
if alertM, err = alerting.NewAlertManager(alertProfile, uuid, configSpec.GlobalConfig.IndexerConfig.Index, indexer, p); err != nil {
log.Fatalf("Error creating alert manager: %s", err)
}
rc := alertM.Evaluate(startTime, endTime)
Expand Down
11 changes: 5 additions & 6 deletions cmd/kube-burner/ocp.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ import (
"strings"
"time"

log "github.com/sirupsen/logrus"

"github.com/cloud-bulldozer/kube-burner/pkg/config"
"github.com/cloud-bulldozer/go-commons/indexers"
"github.com/cloud-bulldozer/kube-burner/pkg/discovery"
"github.com/cloud-bulldozer/kube-burner/pkg/workloads"
uid "github.com/satori/go.uuid"
log "github.com/sirupsen/logrus"
"github.com/spf13/cobra"
)

Expand All @@ -41,7 +40,7 @@ func openShiftCmd() *cobra.Command {
Long: `This subcommand is meant to be used against OpenShift clusters and serve as a shortcut to trigger well-known workloads`,
}
var wh workloads.WorkloadHelper
var indexingType config.IndexerType
var indexingType indexers.IndexerType
var indexing bool
esServer := ocpCmd.PersistentFlags().String("es-server", "", "Elastic Search endpoint")
localIndexing := ocpCmd.PersistentFlags().Bool("local-indexing", false, "Enable local indexing")
Expand All @@ -62,9 +61,9 @@ func openShiftCmd() *cobra.Command {
if *esServer != "" || *localIndexing {
indexing = true
if *esServer != "" {
indexingType = config.ElasticIndexer
indexingType = indexers.ElasticIndexer
} else {
indexingType = config.LocalIndexer
indexingType = indexers.LocalIndexer
}
}
envVars := map[string]string{
Expand Down
8 changes: 5 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ go 1.19

require (
github.com/Masterminds/sprig/v3 v3.2.2
github.com/elastic/go-elasticsearch/v7 v7.13.1
github.com/cloud-bulldozer/go-commons v1.0.0
github.com/prometheus/client_golang v1.15.0
github.com/prometheus/common v0.42.0
github.com/satori/go.uuid v1.2.0
github.com/sirupsen/logrus v1.8.1
github.com/spf13/cast v1.3.1
github.com/sirupsen/logrus v1.9.0
github.com/spf13/cobra v1.6.1
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8
gopkg.in/yaml.v3 v3.0.1
Expand All @@ -34,6 +33,7 @@ require (
github.com/PuerkitoBio/purell v1.1.1 // indirect
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 // indirect
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.8.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-openapi/jsonpointer v0.19.5 // indirect
Expand All @@ -58,10 +58,12 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/opensearch-project/opensearch-go v1.1.0 // indirect
github.com/openshift/custom-resource-status v1.1.2 // indirect
github.com/pborman/uuid v1.2.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/cast v1.3.1 // indirect
github.com/spf13/pflag v1.0.5 // indirect
golang.org/x/crypto v0.0.0-20220315160706-3147a52a75dd // indirect
golang.org/x/net v0.7.0 // indirect
Expand Down
12 changes: 11 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/asaskevich/govalidator v0.0.0-20190424111038-f61b66f89f4a/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY=
github.com/aws/aws-sdk-go v1.42.27/go.mod h1:OGr6lGMAKGlG9CVrYnWYDKIyb829c6EVBRjxqjmPepc=
github.com/benbjohnson/clock v1.0.3/go.mod h1:bGMdMPoPVvcYyt1gHDf4J2KE153Yf9BuiUKYMaxlTDM=
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
Expand All @@ -113,6 +114,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.0 h1:YOWLH/aN/PN5MDaVrhktzeTM1SsU8XHIHfdKjwLLM8c=
github.com/cloud-bulldozer/go-commons v1.0.0/go.mod h1:HLdZZlRpv8bWVkq1g9AyLE7bpsbAbau5Uqfw/fM9bLE=
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 @@ -334,6 +337,8 @@ github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo=
github.com/jonboulle/clockwork v0.2.2/go.mod h1:Pkfl5aHPm1nk2H9h0bjmnJD/BcgbGXUBGnn1kMkgxc8=
github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY=
Expand Down Expand Up @@ -428,6 +433,8 @@ github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1y
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.20.1 h1:PA/3qinGoukvymdIDV8pii6tiZgC8kbmJO6Z5+b002Q=
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=
github.com/openshift/custom-resource-status v1.1.2/go.mod h1:DB/Mf2oTeiAmVVX1gN+NEqweonAPY0TKUwADizj8+ZA=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
Expand Down Expand Up @@ -490,8 +497,9 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM=
Expand Down Expand Up @@ -674,6 +682,7 @@ golang.org/x/net v0.0.0-20210825183410-e898025ed96a/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211209124913-491a49abca63/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
Expand Down Expand Up @@ -779,6 +788,7 @@ golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
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.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
Expand Down
16 changes: 11 additions & 5 deletions pkg/alerting/alert_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ import (
"text/template"
"time"

"github.com/prometheus/common/model"
log "github.com/sirupsen/logrus"

"github.com/cloud-bulldozer/kube-burner/pkg/indexers"
"github.com/cloud-bulldozer/go-commons/indexers"
"github.com/cloud-bulldozer/kube-burner/pkg/prometheus"
"github.com/cloud-bulldozer/kube-burner/pkg/util"
"github.com/prometheus/common/model"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v3"
)

Expand Down Expand Up @@ -205,5 +204,12 @@ func parseMatrix(value model.Value, description string, severity severityLevel)

func (a *AlertManager) index(alertSet []interface{}) {
log.Info("Indexing alerts")
(*a.indexer).Index(alertSet, indexers.IndexingOpts{MetricName: alertMetricName})
log.Infof("Indexing metric %s", alertMetricName)
log.Debugf("Indexing [%d] documents", len(alertSet))
resp, err := (*a.indexer).Index(alertSet, indexers.IndexingOpts{MetricName: alertMetricName})
if err != nil {
log.Error(err)
} else {
log.Info(resp)
}
}
11 changes: 6 additions & 5 deletions pkg/burner/job.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import (
"fmt"
"time"

"github.com/cloud-bulldozer/go-commons/indexers"
"github.com/cloud-bulldozer/kube-burner/pkg/alerting"
"github.com/cloud-bulldozer/kube-burner/pkg/config"
"github.com/cloud-bulldozer/kube-burner/pkg/indexers"
"github.com/cloud-bulldozer/kube-burner/pkg/measurements"
"github.com/cloud-bulldozer/kube-burner/pkg/prometheus"
"github.com/cloud-bulldozer/kube-burner/pkg/util"
Expand Down Expand Up @@ -81,6 +81,7 @@ func Run(configSpec config.Spec, uuid string, prometheusClients []*prometheus.Pr
var rc int
var prometheusJobList []prometheus.Job
res := make(chan int, 1)
globalConfig := configSpec.GlobalConfig
log.Infof("🔥 Starting kube-burner (%s@%s) with UUID %s", version.Version, version.GitCommit, uuid)
go func() {
var innerRC int
Expand Down Expand Up @@ -159,14 +160,14 @@ func Run(configSpec config.Spec, uuid string, prometheusClients []*prometheus.Pr
}
log.Infof("Job %s took %.2f seconds", job.Config.Name, elapsedTime)
}
if configSpec.GlobalConfig.IndexerConfig.Enabled {
if globalConfig.IndexerConfig.Enabled {
for _, job := range jobList {
elapsedTime := job.End.Sub(job.Start).Seconds()
indexjobSummaryInfo(indexer, uuid, elapsedTime, job.Config, job.Start, metadata)
}
}
// We initialize cleanup as soon as the benchmark finishes
if configSpec.GlobalConfig.GC {
if globalConfig.GC {
go CleanupNamespaces(context.TODO(), v1.ListOptions{LabelSelector: fmt.Sprintf("kube-burner-uuid=%v", uuid)}, false)
}
for idx, prometheusClient := range prometheusClients {
Expand All @@ -178,7 +179,7 @@ func Run(configSpec config.Spec, uuid string, prometheusClients []*prometheus.Pr
}
prometheusClient.JobList = prometheusJobList
// If prometheus is enabled query metrics from the start of the first job to the end of the last one
if configSpec.GlobalConfig.IndexerConfig.Enabled {
if globalConfig.IndexerConfig.Enabled {
metrics.ScrapeMetrics(prometheusClient, indexer)
metrics.HandleTarball(configSpec)
}
Expand All @@ -192,7 +193,7 @@ func Run(configSpec config.Spec, uuid string, prometheusClients []*prometheus.Pr
log.Errorf("%v timeout reached", timeout)
rc = rcTimeout
}
if configSpec.GlobalConfig.GC {
if globalConfig.GC {
// Use timeout/4 to garbage collect namespaces
ctx, cancel := context.WithTimeout(context.Background(), timeout/4)
defer cancel()
Expand Down
12 changes: 10 additions & 2 deletions pkg/burner/metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ import (
"fmt"
"time"

"github.com/cloud-bulldozer/go-commons/indexers"
"github.com/cloud-bulldozer/kube-burner/pkg/config"
"github.com/cloud-bulldozer/kube-burner/pkg/indexers"
"github.com/cloud-bulldozer/kube-burner/pkg/version"
log "github.com/sirupsen/logrus"
)

type jobSummary struct {
Expand Down Expand Up @@ -48,5 +49,12 @@ func indexjobSummaryInfo(indexer *indexers.Indexer, uuid string, elapsedTime flo
Version: fmt.Sprintf("%v@%v", version.Version, version.GitCommit),
},
}
(*indexer).Index(metadataInfo, indexers.IndexingOpts{MetricName: jobSummaryMetric, JobName: jobConfig.Name})
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})
if err != nil {
log.Error(err)
} else {
log.Info(resp)
}
}
3 changes: 2 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"path/filepath"
"time"

"github.com/cloud-bulldozer/go-commons/indexers"
mtypes "github.com/cloud-bulldozer/kube-burner/pkg/measurements/types"
"github.com/cloud-bulldozer/kube-burner/pkg/util"
log "github.com/sirupsen/logrus"
Expand All @@ -42,7 +43,7 @@ var configSpec = Spec{
GC: false,
RequestTimeout: 15 * time.Second,
Measurements: []mtypes.Measurement{},
IndexerConfig: IndexerConfig{
IndexerConfig: indexers.IndexerConfig{
Enabled: false,
InsecureSkipVerify: false,
MetricsDirectory: "collected-metrics",
Expand Down
35 changes: 2 additions & 33 deletions pkg/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package config
import (
"time"

"github.com/cloud-bulldozer/go-commons/indexers"
mtypes "github.com/cloud-bulldozer/kube-burner/pkg/measurements/types"
)

Expand All @@ -32,16 +33,6 @@ const (
PatchJob JobType = "patch"
)

// IndexerType type of indexer
type IndexerType string

const (
// Elastic indexer that send metrics to the configures ES instance
ElasticIndexer IndexerType = "elastic"
// Local indexer that writes metrics to local directory
LocalIndexer IndexerType = "local"
)

// Spec configuration root
type Spec struct {
// GlobalConfig defines global configuration parameters
Expand All @@ -50,32 +41,10 @@ type Spec struct {
Jobs []Job `yaml:"jobs"`
}

// IndexerConfig holds the indexer configuration
type IndexerConfig struct {
// Type type of indexer
Type IndexerType `yaml:"type"`
// ESServers List of ElasticSearch instances
ESServers []string `yaml:"esServers"`
// DefaultIndex default index to send prometheus metrics
DefaultIndex string `yaml:"defaultIndex"`
// Port indexer port
Port int `yaml:"port"`
// InsecureSkipVerify disable TLS ceriticate verification
InsecureSkipVerify bool `yaml:"insecureSkipVerify"`
// Enabled enable indexer
Enabled bool `yaml:"enabled"`
// Directory to save metrics files in
MetricsDirectory string `yaml:"metricsDirectory"`
// Create tarball
CreateTarball bool `yaml:"createTarball"`
// TarBall name
TarballName string `yaml:"tarballName"`
}

// GlobalConfig holds the global configuration
type GlobalConfig struct {
// IndexerConfig contains a IndexerConfig definition
IndexerConfig IndexerConfig `yaml:"indexerConfig"`
IndexerConfig indexers.IndexerConfig `yaml:"indexerConfig"`
// Measurements describes a list of measurements kube-burner
// will take along with job
Measurements []mtypes.Measurement `yaml:"measurements"`
Expand Down
Loading

0 comments on commit 7de818f

Please sign in to comment.