Skip to content

Commit

Permalink
Remove everything related to bursting
Browse files Browse the repository at this point in the history
  • Loading branch information
SuperSandro2000 committed May 17, 2024
1 parent 1580bb7 commit 98c40f1
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 30 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased](https://github.com/sapcc/limesctl/compare/v3.3.2...HEAD)

### Removed

- Removed everything related to Bursting

## 3.3.2 - 2024-01-03

### Changed
Expand Down
6 changes: 3 additions & 3 deletions internal/core/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type ClusterReport struct {

var csvHeaderClusterLong = []string{
"cluster id", "area", "service", "category", "resource", "capacity",
"domains quota", "usage", "physical usage", "burst usage", "unit", "scraped at (UTC)",
"domains quota", "usage", "physical usage", "unit", "scraped at (UTC)",
}

var csvHeaderClusterDefault = []string{
Expand Down Expand Up @@ -75,13 +75,13 @@ func (c ClusterReport) render(opts *OutputOpts) CSVRecords {

valToStr, unit := getValToStrFunc(opts.Humanize, cSrvRes.Unit, []uint64{
zeroIfNil(capacity), zeroIfNil(physU), zeroIfNil(domsQ),
cSrvRes.Usage, cSrvRes.BurstUsage,
cSrvRes.Usage,
})

if opts.CSVRecFmt == CSVRecordFormatLong {
r = append(r, c.ID, cSrv.Area, string(cSrv.Type), cSrvRes.Category, string(cSrvRes.Name), emptyStrIfNil(capacity, valToStr),
emptyStrIfNil(domsQ, valToStr), valToStr(cSrvRes.Usage), emptyStrIfNil(physU, valToStr),
valToStr(cSrvRes.BurstUsage), string(unit), timestampToString(cSrv.MinScrapedAt),
string(unit), timestampToString(cSrv.MinScrapedAt),
)
} else {
r = append(r, c.ID, string(cSrv.Type), string(cSrvRes.Name), emptyStrIfNil(capacity, valToStr),
Expand Down
6 changes: 3 additions & 3 deletions internal/core/domain.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ var csvHeaderDomainDefault = []string{"domain id", "service", "resource", "quota

var csvHeaderDomainLong = []string{
"domain id", "domain name", "area", "service", "category", "resource",
"quota", "projects quota", "usage", "physical usage", "burst usage", "unit", "scraped at (UTC)",
"quota", "projects quota", "usage", "physical usage", "unit", "scraped at (UTC)",
}

const domainName = "domain name"
Expand Down Expand Up @@ -90,13 +90,13 @@ func (d DomainReport) render(opts *OutputOpts) CSVRecords {

valToStr, unit := getValToStrFunc(opts.Humanize, dSrvRes.Unit, []uint64{
zeroIfNil(physU), zeroIfNil(domQ), zeroIfNil(projectsQ),
dSrvRes.Usage, dSrvRes.BurstUsage,
dSrvRes.Usage,
})

if opts.CSVRecFmt == CSVRecordFormatLong {
r = append(r, d.UUID, d.Name, dSrv.Area, string(dSrv.Type), dSrvRes.Category, string(dSrvRes.Name),
emptyStrIfNil(domQ, valToStr), emptyStrIfNil(projectsQ, valToStr), valToStr(dSrvRes.Usage),
emptyStrIfNil(physU, valToStr), valToStr(dSrvRes.BurstUsage), string(unit), timestampToString(dSrv.MinScrapedAt),
emptyStrIfNil(physU, valToStr), string(unit), timestampToString(dSrv.MinScrapedAt),
)
} else {
nameOrID := d.UUID
Expand Down
6 changes: 3 additions & 3 deletions internal/core/fixtures/domain-list-filtered.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
domain id;domain name;area;service;category;resource;quota;projects quota;usage;physical usage;burst usage;unit;scraped at (UTC)
uuid-for-france;france;shared;shared;;things;0;10;2;;0;;1970-01-01T00:01:06Z
uuid-for-germany;germany;shared;shared;;things;30;20;4;;0;;1970-01-01T00:00:22Z
domain id;domain name;area;service;category;resource;quota;projects quota;usage;physical usage;unit;scraped at (UTC)
uuid-for-france;france;shared;shared;;things;0;10;2;;;1970-01-01T00:01:06Z
uuid-for-germany;germany;shared;shared;;things;30;20;4;;;1970-01-01T00:00:22Z
6 changes: 3 additions & 3 deletions internal/core/fixtures/project-list-filtered.csv
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
domain id;domain name;project id;project name;area;service;category;resource;quota;burst quota;usage;physical usage;burst usage;unit;scraped at (UTC)
uuid-for-germany;germany;uuid-for-berlin;berlin;shared;shared;;things;10;;2;;0;;1970-01-01T00:00:22Z
uuid-for-germany;germany;uuid-for-dresden;dresden;shared;shared;;things;10;;2;;0;;1970-01-01T00:00:44Z
domain id;domain name;project id;project name;area;service;category;resource;quota;usage;physical usage;unit;scraped at (UTC)
uuid-for-germany;germany;uuid-for-berlin;berlin;shared;shared;;things;10;2;;;1970-01-01T00:00:22Z
uuid-for-germany;germany;uuid-for-dresden;dresden;shared;shared;;things;10;2;;;1970-01-01T00:00:44Z
22 changes: 4 additions & 18 deletions internal/core/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var csvHeaderProjectDefault = []string{"domain id", "project id", "service", "re

var csvHeaderProjectLong = []string{
"domain id", "domain name", "project id", "project name", "area", "service",
"category", "resource", "quota", "burst quota", "usage", "physical usage", "burst usage", "unit", "scraped at (UTC)",
"category", "resource", "quota", "usage", "physical usage", "unit", "scraped at (UTC)",
}

// GetHeaderRow implements the LimesReportRenderer interface.
Expand Down Expand Up @@ -99,28 +99,14 @@ func (p ProjectResourcesReport) render(opts *OutputOpts) CSVRecords {
quota := pSrvRes.Quota
usage := pSrvRes.Usage

// We use a *uint64 for burstQuota instead of an uint64 for
// consistency with Limes' API, i.e. if quota has a null value
// then burstQuota should also be null instead of zero.
var burstQuota *uint64
var burstUsage uint64
if quota != nil && p.Bursting != nil && p.Bursting.Enabled {
q := *quota
bq := p.Bursting.Multiplier.ApplyTo(q, pSrvRes.QuotaDistributionModel)
burstQuota = &bq
if usage > q {
burstUsage = usage - q
}
}

valToStr, unit := getValToStrFunc(opts.Humanize, pSrvRes.Unit, []uint64{
zeroIfNil(burstQuota), burstUsage, zeroIfNil(physU), zeroIfNil(quota), usage,
zeroIfNil(physU), zeroIfNil(quota), usage,
})

if opts.CSVRecFmt == CSVRecordFormatLong {
r = append(r, p.DomainID, p.DomainName, p.UUID, p.Name, pSrv.Area, string(pSrv.Type), pSrvRes.Category,
string(pSrvRes.Name), emptyStrIfNil(quota, valToStr), emptyStrIfNil(burstQuota, valToStr), valToStr(usage),
emptyStrIfNil(physU, valToStr), valToStr(burstUsage), string(unit), timestampToString(pSrv.ScrapedAt),
string(pSrvRes.Name), emptyStrIfNil(quota, valToStr), valToStr(usage),
emptyStrIfNil(physU, valToStr), string(unit), timestampToString(pSrv.ScrapedAt),
)
} else {
projectNameOrID := p.UUID
Expand Down

0 comments on commit 98c40f1

Please sign in to comment.