Skip to content

Commit 4b76ba1

Browse files
committed
[KEP-4817] Rename Addresses to IPs
Signed-off-by: Lionel Jouin <[email protected]>
1 parent 43d23b8 commit 4b76ba1

File tree

6 files changed

+22
-22
lines changed

6 files changed

+22
-22
lines changed

pkg/apis/resource/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1046,15 +1046,15 @@ type NetworkDeviceData struct {
10461046
// +optional
10471047
InterfaceName string
10481048

1049-
// Addresses lists the network addresses assigned to the device's network interface.
1049+
// IPs lists the network addresses assigned to the device's network interface.
10501050
// This can include both IPv4 and IPv6 addresses.
1051-
// The addresses are in the CIDR notation, which includes both the address and the
1051+
// The IPs are in the CIDR notation, which includes both the address and the
10521052
// associated subnet mask.
10531053
// e.g.: "192.0.2.5/24" for IPv4 and "2001:db8::5/64" for IPv6.
10541054
//
10551055
// +optional
10561056
// +listType=atomic
1057-
Addresses []string
1057+
IPs []string
10581058

10591059
// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
10601060
//

pkg/apis/resource/validation/validation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,7 +789,7 @@ func validateNetworkDeviceData(networkDeviceData *resource.NetworkDeviceData, fl
789789
allErrs = append(allErrs, field.TooLong(fldPath.Child("hardwareAddress"), "" /* unused */, hardwareAddressMaxLength))
790790
}
791791

792-
allErrs = append(allErrs, validateSet(networkDeviceData.Addresses, -1,
792+
allErrs = append(allErrs, validateSet(networkDeviceData.IPs, -1,
793793
func(address string, fldPath *field.Path) field.ErrorList {
794794
return validation.IsValidCIDR(fldPath, address)
795795
},
@@ -803,6 +803,6 @@ func validateNetworkDeviceData(networkDeviceData *resource.NetworkDeviceData, fl
803803
maskSize, _ := ipNet.Mask.Size()
804804
return fmt.Sprintf("%s/%d", ip.String(), maskSize), ""
805805
},
806-
fldPath.Child("addresses"))...)
806+
fldPath.Child("ips"))...)
807807
return allErrs
808808
}

pkg/apis/resource/validation/validation_resourceclaim_test.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
10081008
NetworkData: &resource.NetworkDeviceData{
10091009
InterfaceName: strings.Repeat("x", 256),
10101010
HardwareAddress: strings.Repeat("x", 128),
1011-
Addresses: []string{
1011+
IPs: []string{
10121012
"10.9.8.0/24",
10131013
"2001:db8::/64",
10141014
"10.9.8.1/24",
@@ -1023,7 +1023,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
10231023
},
10241024
"invalid-device-status-duplicate": {
10251025
wantFailures: field.ErrorList{
1026-
field.Duplicate(field.NewPath("status", "devices").Index(0).Child("networkData", "addresses").Index(1), "2001:db8::1/64"),
1026+
field.Duplicate(field.NewPath("status", "devices").Index(0).Child("networkData", "ips").Index(1), "2001:db8::1/64"),
10271027
field.Duplicate(field.NewPath("status", "devices").Index(1).Child("deviceID"), structured.MakeDeviceID(goodName, goodName, goodName)),
10281028
},
10291029
oldClaim: func() *resource.ResourceClaim { return validAllocatedClaim }(),
@@ -1034,7 +1034,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
10341034
Pool: goodName,
10351035
Device: goodName,
10361036
NetworkData: &resource.NetworkDeviceData{
1037-
Addresses: []string{
1037+
IPs: []string{
10381038
"2001:db8::1/64",
10391039
"2001:0db8::1/64",
10401040
},
@@ -1054,7 +1054,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
10541054
wantFailures: field.ErrorList{
10551055
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "interfaceName"), "", interfaceNameMaxLength),
10561056
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "hardwareAddress"), "", hardwareAddressMaxLength),
1057-
field.Invalid(field.NewPath("status", "devices").Index(0).Child("networkData", "addresses").Index(0), "300.9.8.0/24", "must be a valid CIDR value, (e.g. 10.9.8.0/24 or 2001:db8::/64)"),
1057+
field.Invalid(field.NewPath("status", "devices").Index(0).Child("networkData", "ips").Index(0), "300.9.8.0/24", "must be a valid CIDR value, (e.g. 10.9.8.0/24 or 2001:db8::/64)"),
10581058
},
10591059
oldClaim: func() *resource.ResourceClaim { return validAllocatedClaim }(),
10601060
update: func(claim *resource.ResourceClaim) *resource.ResourceClaim {
@@ -1066,7 +1066,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
10661066
NetworkData: &resource.NetworkDeviceData{
10671067
InterfaceName: strings.Repeat("x", interfaceNameMaxLength+1),
10681068
HardwareAddress: strings.Repeat("x", hardwareAddressMaxLength+1),
1069-
Addresses: []string{
1069+
IPs: []string{
10701070
"300.9.8.0/24",
10711071
},
10721072
},
@@ -1115,7 +1115,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
11151115
},
11161116
"invalid-device-status-duplicate-disabled-feature-gate": {
11171117
wantFailures: field.ErrorList{
1118-
field.Duplicate(field.NewPath("status", "devices").Index(0).Child("networkData", "addresses").Index(1), "2001:db8::1/64"),
1118+
field.Duplicate(field.NewPath("status", "devices").Index(0).Child("networkData", "ips").Index(1), "2001:db8::1/64"),
11191119
field.Duplicate(field.NewPath("status", "devices").Index(1).Child("deviceID"), structured.MakeDeviceID(goodName, goodName, goodName)),
11201120
},
11211121
oldClaim: func() *resource.ResourceClaim { return validAllocatedClaim }(),
@@ -1126,7 +1126,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
11261126
Pool: goodName,
11271127
Device: goodName,
11281128
NetworkData: &resource.NetworkDeviceData{
1129-
Addresses: []string{
1129+
IPs: []string{
11301130
"2001:db8::1/64",
11311131
"2001:0db8::1/64",
11321132
},
@@ -1146,7 +1146,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
11461146
wantFailures: field.ErrorList{
11471147
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "interfaceName"), "", interfaceNameMaxLength),
11481148
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "hardwareAddress"), "", hardwareAddressMaxLength),
1149-
field.Invalid(field.NewPath("status", "devices").Index(0).Child("networkData", "addresses").Index(0), "300.9.8.0/24", "must be a valid CIDR value, (e.g. 10.9.8.0/24 or 2001:db8::/64)"),
1149+
field.Invalid(field.NewPath("status", "devices").Index(0).Child("networkData", "ips").Index(0), "300.9.8.0/24", "must be a valid CIDR value, (e.g. 10.9.8.0/24 or 2001:db8::/64)"),
11501150
},
11511151
oldClaim: func() *resource.ResourceClaim { return validAllocatedClaim }(),
11521152
update: func(claim *resource.ResourceClaim) *resource.ResourceClaim {
@@ -1158,7 +1158,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
11581158
NetworkData: &resource.NetworkDeviceData{
11591159
InterfaceName: strings.Repeat("x", interfaceNameMaxLength+1),
11601160
HardwareAddress: strings.Repeat("x", hardwareAddressMaxLength+1),
1161-
Addresses: []string{
1161+
IPs: []string{
11621162
"300.9.8.0/24",
11631163
},
11641164
},

staging/src/k8s.io/api/resource/v1alpha3/types.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1057,15 +1057,15 @@ type NetworkDeviceData struct {
10571057
// +optional
10581058
InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"`
10591059

1060-
// Addresses lists the network addresses assigned to the device's network interface.
1060+
// IPs lists the network addresses assigned to the device's network interface.
10611061
// This can include both IPv4 and IPv6 addresses.
1062-
// The addresses are in the CIDR notation, which includes both the address and the
1062+
// The IPs are in the CIDR notation, which includes both the address and the
10631063
// associated subnet mask.
10641064
// e.g.: "192.0.2.5/24" for IPv4 and "2001:db8::5/64" for IPv6.
10651065
//
10661066
// +optional
10671067
// +listType=atomic
1068-
Addresses []string `json:"addresses,omitempty" protobuf:"bytes,2,opt,name=addresses"`
1068+
IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"`
10691069

10701070
// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
10711071
//

test/e2e/dra/dra.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
441441
Data: runtime.RawExtension{Raw: []byte(`{"foo":"bar"}`)},
442442
NetworkData: &resourceapi.NetworkDeviceData{
443443
InterfaceName: "inf1",
444-
Addresses: []string{"10.9.8.0/24", "2001:db8::/64"},
444+
IPs: []string{"10.9.8.0/24", "2001:db8::/64"},
445445
HardwareAddress: "bc:1c:b6:3e:b8:25",
446446
},
447447
})
@@ -460,7 +460,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
460460
Data: runtime.RawExtension{Raw: []byte(`{"bar":"foo"}`)},
461461
NetworkData: &resourceapi.NetworkDeviceData{
462462
InterfaceName: "inf2",
463-
Addresses: []string{"10.9.8.1/24", "2001:db8::1/64"},
463+
IPs: []string{"10.9.8.1/24", "2001:db8::1/64"},
464464
HardwareAddress: "bc:1c:b6:3e:b8:26",
465465
},
466466
}

test/integration/resourceclaim/feature_enable_disable_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
8686
},
8787
NetworkData: &v1alpha3.NetworkDeviceData{
8888
InterfaceName: "net-1",
89-
Addresses: []string{
89+
IPs: []string{
9090
"10.9.8.0/24",
9191
"2001:db8::/64",
9292
},
@@ -158,7 +158,7 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
158158
},
159159
NetworkData: &v1alpha3.NetworkDeviceData{
160160
InterfaceName: "net-1",
161-
Addresses: []string{
161+
IPs: []string{
162162
"10.9.8.0/24",
163163
"2001:db8::/64",
164164
},
@@ -194,7 +194,7 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
194194
},
195195
NetworkData: &v1alpha3.NetworkDeviceData{
196196
InterfaceName: "net-1",
197-
Addresses: []string{
197+
IPs: []string{
198198
"10.9.8.0/24",
199199
"2001:db8::/64",
200200
},

0 commit comments

Comments
 (0)