Skip to content

Commit 30f5282

Browse files
committed
DRA API: rename DeviceCapacity.Quantity to DeviceCapacity.Value
Based on review feedback (kubernetes#127511 (comment)).
1 parent 0b8a85c commit 30f5282

File tree

23 files changed

+164
-165
lines changed

23 files changed

+164
-165
lines changed

api/openapi-spec/swagger.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/openapi-spec/v3/apis__resource.k8s.io__v1beta1_openapi.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/resource/types.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,10 +219,10 @@ type BasicDevice struct {
219219

220220
// DeviceCapacity describes a quantity associated with a device.
221221
type DeviceCapacity struct {
222-
// Quantity defines how much of a certain device capacity is available.
222+
// Value defines how much of a certain device capacity is available.
223223
//
224224
// +required
225-
Quantity resource.Quantity
225+
Value resource.Quantity
226226

227227
// potential future addition: fields which define how to "consume"
228228
// capacity (= share a single device between different consumers).

pkg/apis/resource/v1alpha3/conversion.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ func addConversionFuncs(scheme *runtime.Scheme) error {
4242
}
4343

4444
func Convert_resource_DeviceCapacity_To_resource_Quantity(in *resourceapi.DeviceCapacity, out *resource.Quantity, s conversion.Scope) error {
45-
*out = in.Quantity
45+
*out = in.Value
4646
return nil
4747
}
4848

4949
func Convert_resource_Quantity_To_resource_DeviceCapacity(in *resource.Quantity, out *resourceapi.DeviceCapacity, s conversion.Scope) error {
50-
out.Quantity = *in
50+
out.Value = *in
5151
return nil
5252
}

pkg/apis/resource/v1beta1/zz_generated.conversion.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/apis/resource/validation/validation_resourceslice_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func testAttributes() map[resourceapi.QualifiedName]resourceapi.DeviceAttribute
4040

4141
func testCapacity() map[resourceapi.QualifiedName]resourceapi.DeviceCapacity {
4242
return map[resourceapi.QualifiedName]resourceapi.DeviceCapacity{
43-
"memory": {Quantity: resource.MustParse("1Gi")},
43+
"memory": {Value: resource.MustParse("1Gi")},
4444
}
4545
}
4646

@@ -418,7 +418,7 @@ func TestValidateResourceSlice(t *testing.T) {
418418
slice.Spec.Devices[1].Basic.Attributes = map[resourceapi.QualifiedName]resourceapi.DeviceAttribute{}
419419
slice.Spec.Devices[1].Basic.Capacity = map[resourceapi.QualifiedName]resourceapi.DeviceCapacity{}
420420
quantity := resource.MustParse("1Gi")
421-
capacity := resourceapi.DeviceCapacity{Quantity: quantity}
421+
capacity := resourceapi.DeviceCapacity{Value: quantity}
422422
for i := 0; i < resourceapi.ResourceSliceMaxAttributesAndCapacitiesPerDevice; i++ {
423423
slice.Spec.Devices[1].Basic.Capacity[resourceapi.QualifiedName(fmt.Sprintf("cap_%d", i))] = capacity
424424
}

pkg/apis/resource/zz_generated.deepcopy.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/generated/openapi/zz_generated.openapi.go

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)