Skip to content
This repository has been archived by the owner on Jun 21, 2022. It is now read-only.

Commit

Permalink
Merge branch 'main' into PMM-9968-pmm-admin-inventory-with-log-level
Browse files Browse the repository at this point in the history
  • Loading branch information
YaroslavPodorvanov authored Jun 6, 2022
2 parents 004fcaa + c1c142e commit fe0d2f4
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 19 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ require (
github.com/Azure/go-autorest/autorest/azure/auth v0.5.11
github.com/ClickHouse/clickhouse-go/v2 v2.0.14
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d
github.com/aws/aws-sdk-go v1.44.25
github.com/aws/aws-sdk-go v1.44.27
github.com/brianvoe/gofakeit/v6 v6.16.0
github.com/davecgh/go-spew v1.1.1
github.com/go-co-op/gocron v1.13.0
Expand Down Expand Up @@ -51,7 +51,7 @@ require (
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32
google.golang.org/genproto v0.0.0-20220414192740-2d67ff6cf2b4
google.golang.org/grpc v1.46.2
google.golang.org/grpc v1.47.0
google.golang.org/protobuf v1.28.0
gopkg.in/alecthomas/kingpin.v2 v2.2.6
gopkg.in/reform.v1 v1.5.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d h1:Byv0BzEl
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw=
github.com/aws/aws-sdk-go v1.38.35/go.mod h1:hcU610XS61/+aQV88ixoOzUoG7v3b31pl2zKMmprdro=
github.com/aws/aws-sdk-go v1.43.11/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go v1.44.25 h1:cJZ4gtEpWAD/StO9GGOAyv6AaAoZ9OJUhu96gF9qaio=
github.com/aws/aws-sdk-go v1.44.25/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/aws/aws-sdk-go v1.44.27 h1:8CMspeZSrewnbvAwgl8qo5R7orDLwQnTGBf/OKPiHxI=
github.com/aws/aws-sdk-go v1.44.27/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
Expand Down Expand Up @@ -914,8 +914,8 @@ google.golang.org/grpc v1.31.0/go.mod h1:N36X2cJ7JwdamYAgDz+s+rVMFjt3numwzf/HckM
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU=
google.golang.org/grpc v1.45.0/go.mod h1:lN7owxKUQEqMfSyQikvvk5tf/6zMPsrK+ONuO11+0rQ=
google.golang.org/grpc v1.46.2 h1:u+MLGgVf7vRdjEYZ8wDFhAVNmhkbJ5hmrA1LMWK1CAQ=
google.golang.org/grpc v1.46.2/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8=
google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
Expand Down
5 changes: 3 additions & 2 deletions services/management/dbaas/components_service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ func TestFilteringOutOfUnsupportedVersions(t *testing.T) {
}

const (
onePointTen = "1.10.0"
onePointNine = "1.9.0"
onePointEight = "1.8.0"
onePointSeven = "1.7.0"
Expand Down Expand Up @@ -688,11 +689,11 @@ func TestCheckForOperatorUpdate(t *testing.T) {
Product: "pmm-server",
Matrix: matrix{
PSMDBOperator: map[string]componentVersion{
onePointEight: {},
onePointEight: {Status: "recommended"},
onePointSeven: {},
},
PXCOperator: map[string]componentVersion{
onePointEight: {},
onePointEight: {Status: "recommended"},
onePointSeven: {},
},
},
Expand Down
12 changes: 6 additions & 6 deletions services/management/dbaas/version_service_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,24 +208,24 @@ func (c *VersionServiceClient) IsOperatorVersionSupported(ctx context.Context, o
return false, nil
}

func latest(m map[string]componentVersion) (*goversion.Version, error) {
func latestRecommended(m map[string]componentVersion) (*goversion.Version, error) {
if len(m) == 0 {
return nil, errNoVersionsFound
}
latest := goversion.Must(goversion.NewVersion("0.0.0"))
for version := range m {
for version, component := range m {
parsedVersion, err := goversion.NewVersion(version)
if err != nil {
return nil, err
}
if parsedVersion.GreaterThan(latest) {
if parsedVersion.GreaterThan(latest) && component.Status == "recommended" {
latest = parsedVersion
}
}
return latest, nil
}

// LatestOperatorVersion return latest PXC and PSMDB operators for given PMM version.
// LatestOperatorVersion return latest recommended PXC and PSMDB operators for given PMM version.
func (c *VersionServiceClient) LatestOperatorVersion(ctx context.Context, pmmVersion string) (*goversion.Version, *goversion.Version, error) {
if pmmVersion == "" {
return nil, nil, errors.New("given PMM version is empty")
Expand All @@ -242,11 +242,11 @@ func (c *VersionServiceClient) LatestOperatorVersion(ctx context.Context, pmmVer
return nil, nil, nil // no deps for the PMM version passed to c.Matrix
}
pmmVersionDeps := resp.Versions[0]
latestPSMDBOperator, err := latest(pmmVersionDeps.Matrix.PSMDBOperator)
latestPSMDBOperator, err := latestRecommended(pmmVersionDeps.Matrix.PSMDBOperator)
if err != nil {
return nil, nil, err
}
latestPXCOperator, err := latest(pmmVersionDeps.Matrix.PXCOperator)
latestPXCOperator, err := latestRecommended(pmmVersionDeps.Matrix.PXCOperator)
return latestPXCOperator, latestPSMDBOperator, err
}

Expand Down
5 changes: 3 additions & 2 deletions services/management/dbaas/version_service_client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,12 @@ func TestOperatorVersionGetting(t *testing.T) {
Product: "pmm-server",
Matrix: matrix{
PXCOperator: map[string]componentVersion{
onePointEight: {},
onePointEight: {Status: "recommended"},
onePointSeven: {},
},
PSMDBOperator: map[string]componentVersion{
onePointNine: {},
onePointTen: {Status: "available"},
onePointNine: {Status: "recommended"},
onePointEight: {},
onePointSeven: {},
},
Expand Down
5 changes: 4 additions & 1 deletion tools/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.18

require (
github.com/BurntSushi/go-sumtype v0.0.0-20190304192233-fcb4a6205bdc
github.com/daixiang0/gci v0.3.3
github.com/daixiang0/gci v0.3.4
github.com/go-delve/delve v1.8.3
github.com/golangci/golangci-lint v1.46.2
github.com/quasilyte/go-consistent v0.0.0-20200404105227-766526bf1e96
Expand Down Expand Up @@ -199,6 +199,9 @@ require (
gitlab.com/bosi/decorder v0.2.1 // indirect
go.opencensus.io v0.23.0 // indirect
go.starlark.net v0.0.0-20211203141949-70c0e40ae128 // indirect
go.uber.org/atomic v1.7.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.17.0 // indirect
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect
golang.org/x/build v0.0.0-20220125175651-da4f1d2313e4 // indirect
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 // indirect
Expand Down
7 changes: 5 additions & 2 deletions tools/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,8 @@ github.com/cpuguy83/go-md2man/v2 v2.0.1/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46t
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/creack/pty v1.1.15 h1:cKRCLMj3Ddm54bKSpemfQ8AtYFBhAI2MPmdys22fBdc=
github.com/daixiang0/gci v0.3.3 h1:55xJKH7Gl9Vk6oQ1cMkwrDWjAkT1D+D1G9kNmRcAIY4=
github.com/daixiang0/gci v0.3.3/go.mod h1:1Xr2bxnQbDxCqqulUOv8qpGqkgRw9RSCGGjEC2LjF8o=
github.com/daixiang0/gci v0.3.4 h1:+EZ83znNs73C9ZBTM7xhNagMP6gJs5wlptiFiuce5BM=
github.com/daixiang0/gci v0.3.4/go.mod h1:pB1j339Q+2sv/EyKd4dgvGXcaBGIErim+dlhLDtqeW4=
github.com/davecgh/go-spew v0.0.0-20161028175848-04cdfd42973b/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
Expand Down Expand Up @@ -996,14 +996,17 @@ go.starlark.net v0.0.0-20211203141949-70c0e40ae128/go.mod h1:t3mmBBPzAVvK0L0n1dr
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM=
go.uber.org/zap v1.17.0 h1:MTjgFu6ZLKvY6Pvaqk97GlxNBuMpV4Hy/3P6tRGlI2U=
go.uber.org/zap v1.17.0/go.mod h1:MXVU+bhUf/A7Xi2HNOnopQOrmycQ5Ih87HtOu4q5SSo=
golang.org/x/arch v0.0.0-20190927153633-4e8777c89be4/go.mod h1:flIaEI6LNU6xOCD5PaJvn9wGP0agmIOqjrtsKGRguv4=
golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU=
Expand Down

0 comments on commit fe0d2f4

Please sign in to comment.