Skip to content

Commit

Permalink
fix missing CommitmentConfig on NoQuota resources in cluster/domain r…
Browse files Browse the repository at this point in the history
…eports
  • Loading branch information
majewsky authored and VoigtS committed Mar 13, 2024
1 parent 244f62c commit 2d119c2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions internal/reports/cluster.go
Expand Up @@ -478,14 +478,14 @@ func findInClusterReport(cluster *core.Cluster, report *limesresources.ClusterRe
if !cluster.HasResource(serviceType, *resourceName) {
return service, nil
}
globalBehavior := cluster.BehaviorForResource(serviceType, *resourceName, "")
resource = &limesresources.ClusterResourceReport{
ResourceInfo: cluster.InfoForResource(serviceType, *resourceName),
ResourceInfo: cluster.InfoForResource(serviceType, *resourceName),
CommitmentConfig: globalBehavior.ToCommitmentConfig(now),
}
if !resource.ResourceInfo.NoQuota {
qdConfig := cluster.QuotaDistributionConfigForResource(serviceType, *resourceName)
resource.QuotaDistributionModel = qdConfig.Model
globalBehavior := cluster.BehaviorForResource(serviceType, *resourceName, "")
resource.CommitmentConfig = globalBehavior.ToCommitmentConfig(now)
//We need to set a default value here. Otherwise zero values will never
//be reported when there are no `domain_resources` entries to aggregate
//over.
Expand Down
8 changes: 4 additions & 4 deletions internal/reports/domain.go
Expand Up @@ -381,14 +381,14 @@ func (d domains) Find(cluster *core.Cluster, domainUUID, domainName string, serv
localBehavior := cluster.BehaviorForResource(*serviceType, *resourceName, domainName)
globalBehavior := cluster.BehaviorForResource(*serviceType, *resourceName, "")
resource = &limesresources.DomainResourceReport{
ResourceInfo: cluster.InfoForResource(*serviceType, *resourceName),
Scaling: globalBehavior.ToScalingBehavior(),
Annotations: localBehavior.Annotations,
ResourceInfo: cluster.InfoForResource(*serviceType, *resourceName),
Scaling: globalBehavior.ToScalingBehavior(),
Annotations: localBehavior.Annotations,
CommitmentConfig: globalBehavior.ToCommitmentConfig(now),
}
if !resource.NoQuota {
qdConfig := cluster.QuotaDistributionConfigForResource(*serviceType, *resourceName)
resource.QuotaDistributionModel = qdConfig.Model
resource.CommitmentConfig = globalBehavior.ToCommitmentConfig(now)
//this default is used when no `domain_resources` entry exists for this resource
defaultQuota := uint64(0)
resource.DomainQuota = &defaultQuota
Expand Down

0 comments on commit 2d119c2

Please sign in to comment.