Skip to content

Commit

Permalink
fix: project report. AZSeparatedToplogy does not provide any az (#627)
Browse files Browse the repository at this point in the history
* fix: project report. AZSeparatedToplogy does not provide any az

* also fix cluster report temporarely
  • Loading branch information
VoigtS authored Dec 13, 2024
1 parent 965b01f commit 8284712
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/reports/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,11 @@ func GetClusterResources(cluster *core.Cluster, now time.Time, dbi db.Interface,
// zero and there are other AZs
if len(resource.PerAZ) >= 2 {
capaInAny := resource.PerAZ[limes.AvailabilityZoneAny]
// TODO: implement a proper fix and create a test case
// AZSeparateToplogy does not contain ANY AZ.
if capaInAny == nil {
continue
}
if capaInAny.Capacity == 0 && capaInAny.Usage == nil && capaInAny.ProjectsUsage == 0 {
delete(resource.PerAZ, limes.AvailabilityZoneAny)
}
Expand Down
5 changes: 5 additions & 0 deletions internal/reports/project.go
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,11 @@ func finalizeProjectResourceReport(projectReport *limesresources.ProjectReport,
for _, resReport := range srvReport.Resources {
if len(resReport.PerAZ) >= 2 {
reportInAny := resReport.PerAZ[limes.AvailabilityZoneAny]
// TODO: implement a proper fix and isolate a test case
// AZSeparatedToplogy does not provide the any AZ.
if reportInAny == nil {
continue
}
if (reportInAny.Quota == nil || *reportInAny.Quota == 0) && reportInAny.Usage == 0 {
delete(resReport.PerAZ, limes.AvailabilityZoneAny)
}
Expand Down

0 comments on commit 8284712

Please sign in to comment.