Skip to content

Commit

Permalink
Merge pull request #7824 from voelzmo/enh/remove-requests-property
Browse files Browse the repository at this point in the history
Remove Request property from ContainerUsageSample
  • Loading branch information
k8s-ci-robot authored Feb 11, 2025
2 parents ce71abf + 4ceccf6 commit 6ef6f0f
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ func TestMergeContainerStateForCheckpointDropsRecentMemoryPeak(t *testing.T) {
container.AddSample(&model.ContainerUsageSample{
MeasureStart: timeNow,
Usage: model.MemoryAmountFromBytes(1024 * 1024 * 1024),
Request: testRequest[model.ResourceMemory],
Resource: model.ResourceMemory,
})
vpa := addVpa(t, cluster, testVpaID1, testSelectorStr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -483,15 +483,13 @@ func TestClusterStateFeeder_InitFromHistoryProvider(t *testing.T) {
{
MeasureStart: t0,
Usage: 10,
Request: 101,
Resource: model.ResourceCPU,
},
},
containerMem: {
{
MeasureStart: t0,
Usage: memAmount,
Request: 1024 * 1024 * 1024,
Resource: model.ResourceMemory,
},
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func addTestCPUSample(cluster *ClusterState, container ContainerID, cpuCores flo
ContainerUsageSample: ContainerUsageSample{
MeasureStart: testTimestamp,
Usage: CPUAmountFromCores(cpuCores),
Request: testRequest[ResourceCPU],
Resource: ResourceCPU,
},
}
Expand All @@ -57,7 +56,6 @@ func addTestMemorySample(cluster *ClusterState, container ContainerID, memoryByt
ContainerUsageSample: ContainerUsageSample{
MeasureStart: testTimestamp,
Usage: MemoryAmountFromBytes(memoryBytes),
Request: testRequest[ResourceMemory],
Resource: ResourceMemory,
},
}
Expand Down
2 changes: 0 additions & 2 deletions vertical-pod-autoscaler/pkg/recommender/model/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ func makeTestUsageSample() *ContainerUsageSampleWithKey {
return &ContainerUsageSampleWithKey{ContainerUsageSample{
MeasureStart: testTimestamp,
Usage: 1.0,
Request: testRequest[ResourceCPU],
Resource: ResourceCPU},
testContainerID}
}
Expand Down Expand Up @@ -276,7 +275,6 @@ func TestAddSampleAfterAggregateContainerStateGCed(t *testing.T) {
newUsageSample := &ContainerUsageSampleWithKey{ContainerUsageSample{
MeasureStart: gcTimestamp.Add(1 * time.Hour),
Usage: usageSample.Usage,
Request: usageSample.Request,
Resource: usageSample.Resource},
testContainerID}
// Add usage sample to the container again.
Expand Down
4 changes: 0 additions & 4 deletions vertical-pod-autoscaler/pkg/recommender/model/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ type ContainerUsageSample struct {
MeasureStart time.Time
// Average CPU usage in cores or memory usage in bytes.
Usage ResourceAmount
// CPU or memory request at the time of measurement.
Request ResourceAmount
// Which resource is this sample for.
Resource ResourceName
}
Expand Down Expand Up @@ -151,7 +149,6 @@ func (container *ContainerState) addMemorySample(sample *ContainerUsageSample, i
oldPeak := ContainerUsageSample{
MeasureStart: container.WindowEnd,
Usage: oldMaxMem,
Request: sample.Request,
Resource: ResourceMemory,
}
container.aggregator.SubtractSample(&oldPeak)
Expand All @@ -171,7 +168,6 @@ func (container *ContainerState) addMemorySample(sample *ContainerUsageSample, i
newPeak := ContainerUsageSample{
MeasureStart: container.WindowEnd,
Usage: sample.Usage,
Request: sample.Request,
Resource: ResourceMemory,
}
container.aggregator.AddSample(&newPeak)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ func newUsageSample(timestamp time.Time, usage int64, resource ResourceName) *Co
return &ContainerUsageSample{
MeasureStart: timestamp,
Usage: ResourceAmount(usage),
Request: TestRequest[resource],
Resource: resource,
}
}
Expand Down

0 comments on commit 6ef6f0f

Please sign in to comment.