Skip to content

Commit

Permalink
Remove bash scripts
Browse files Browse the repository at this point in the history
Signed-off-by: Sergen Yalçın <yalcinsergen97@gmail.com>
  • Loading branch information
sergenyalcin committed Apr 5, 2022
1 parent edf9fff commit e146dda
Show file tree
Hide file tree
Showing 15 changed files with 235 additions and 212 deletions.
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ jobs:
uses: golangci/golangci-lint-action@v2
with:
version: ${{ env.GOLANGCI_VERSION }}
skip-go-installation: true

check-diff:
runs-on: ubuntu-18.04
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ require (
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.7.1
github.com/prometheus/common v0.10.0
github.com/sirupsen/logrus v1.6.0
github.com/spf13/cobra v1.1.1
github.com/spf13/pflag v1.0.5
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.20.2
k8s.io/apiextensions-apiserver v0.20.1
k8s.io/apimachinery v0.20.2
k8s.io/client-go v0.20.2
k8s.io/utils v0.0.0-20210111153108-fddb29f9d009
sigs.k8s.io/controller-runtime v0.8.3
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvW
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.3 h1:CE8S1cTafDpPvMhIxNJKvHsGVBgn1xWYf1NbHQhywc8=
github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
Expand Down Expand Up @@ -497,6 +498,7 @@ github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeV
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0 h1:UBcNElsrwanuuMsnGSlYmtmgbb23qDR5dG+6X6Oo89I=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
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=
Expand Down
2 changes: 0 additions & 2 deletions internal/providerScale/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,4 @@ provider-scale --mrs ./internal/providerScale/manifests/virtualnetwork.yaml=2

With this input, two virtualnetwork & loadbalancer MRs will be deployed to the cluster.

**_Note: In template manifests the name must be: `test-{{SUFFIX}}`_**

[one-pager]: https://github.com/crossplane/crossplane/pull/2983
14 changes: 11 additions & 3 deletions internal/providerScale/cmd/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"strconv"
"time"

log "github.com/sirupsen/logrus"

"github.com/prometheus/common/model"

"github.com/prometheus/client_golang/api"
Expand All @@ -36,6 +38,7 @@ type Data struct {
type Result struct {
Data []Data
Metric string
MetricUnit string
Peak, Average float64
}

Expand Down Expand Up @@ -63,13 +66,11 @@ func ConstructTimeRange(startTime, endTime time.Time, stepDuration time.Duration
}

// ConstructResult creates a Result object from collected data
func ConstructResult(value model.Value) (*Result, error) {
func ConstructResult(value model.Value, metric, unit string) (*Result, error) {
result := &Result{}
matrix := value.(model.Matrix)

for _, m := range matrix {
result.Metric = m.Metric.String()

for _, v := range m.Values {
valueNum, err := strconv.ParseFloat(v.Value.String(), 64)
if err != nil {
Expand All @@ -80,6 +81,8 @@ func ConstructResult(value model.Value) (*Result, error) {
}

result.Average, result.Peak = CalculateAverageAndPeak(result.Data)
result.Metric = metric
result.MetricUnit = unit
return result, nil
}

Expand All @@ -95,3 +98,8 @@ func CalculateAverageAndPeak(data []Data) (float64, float64) {
}
return sum / float64(len(data)), peak
}

func (r Result) String() {
log.Info(fmt.Sprintf("Average %s: %f %s \n", r.Metric, r.Average, r.MetricUnit))
log.Info(fmt.Sprintf("Peak %s: %f %s \n", r.Metric, r.Peak, r.MetricUnit))
}
24 changes: 0 additions & 24 deletions internal/providerScale/cmd/managed/checkDeletion.sh

This file was deleted.

24 changes: 0 additions & 24 deletions internal/providerScale/cmd/managed/checkReadiness.sh

This file was deleted.

24 changes: 0 additions & 24 deletions internal/providerScale/cmd/managed/getCreationTime.sh

This file was deleted.

24 changes: 0 additions & 24 deletions internal/providerScale/cmd/managed/getReadinessTime.sh

This file was deleted.

27 changes: 0 additions & 27 deletions internal/providerScale/cmd/managed/manage-mr.sh

This file was deleted.

Loading

0 comments on commit e146dda

Please sign in to comment.