Skip to content

Commit

Permalink
fix: missing capacity instantiation for resource pair (#188)
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Troian <[email protected]>
  • Loading branch information
troian authored Feb 13, 2025
1 parent a34e9fb commit b2e5c47
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ require (
k8s.io/apimachinery v0.31.5
)

retract (
v0.0.74
)

replace (
// use cosmos fork of keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
Expand Down
4 changes: 4 additions & 0 deletions go/inventory/v1/resourcepair.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,10 @@ func (m *ResourcePair) SubMilliNLZ(val types.ResourceValue) bool {
allocated.Add(*resource.NewMilliQuantity(int64(val.Value()), resource.DecimalSI)) // nolint: gosec

allocatable := m.Allocatable.DeepCopy()
capacity := m.Capacity.DeepCopy()

*m = ResourcePair{
Capacity: &capacity,
Allocatable: &allocatable,
Allocated: &allocated,
}
Expand All @@ -98,8 +100,10 @@ func (m *ResourcePair) SubNLZ(val types.ResourceValue) bool {
allocated.Add(*resource.NewQuantity(int64(val.Value()), resource.DecimalSI)) // nolint: gosec

allocatable := m.Allocatable.DeepCopy()
capacity := m.Capacity.DeepCopy()

*m = ResourcePair{
Capacity: &capacity,
Allocatable: &allocatable,
Allocated: &allocated,
}
Expand Down

0 comments on commit b2e5c47

Please sign in to comment.