mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-30 06:54:01 +00:00
[KEP-4817] Rename Addresses to IPs
Signed-off-by: Lionel Jouin <lionel.jouin@est.tech>
This commit is contained in:
parent
43d23b8994
commit
4b76ba1a87
@ -1046,15 +1046,15 @@ type NetworkDeviceData struct {
|
||||
// +optional
|
||||
InterfaceName string
|
||||
|
||||
// Addresses lists the network addresses assigned to the device's network interface.
|
||||
// IPs lists the network addresses assigned to the device's network interface.
|
||||
// This can include both IPv4 and IPv6 addresses.
|
||||
// The addresses are in the CIDR notation, which includes both the address and the
|
||||
// The IPs are in the CIDR notation, which includes both the address and the
|
||||
// associated subnet mask.
|
||||
// e.g.: "192.0.2.5/24" for IPv4 and "2001:db8::5/64" for IPv6.
|
||||
//
|
||||
// +optional
|
||||
// +listType=atomic
|
||||
Addresses []string
|
||||
IPs []string
|
||||
|
||||
// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
|
||||
//
|
||||
|
@ -789,7 +789,7 @@ func validateNetworkDeviceData(networkDeviceData *resource.NetworkDeviceData, fl
|
||||
allErrs = append(allErrs, field.TooLong(fldPath.Child("hardwareAddress"), "" /* unused */, hardwareAddressMaxLength))
|
||||
}
|
||||
|
||||
allErrs = append(allErrs, validateSet(networkDeviceData.Addresses, -1,
|
||||
allErrs = append(allErrs, validateSet(networkDeviceData.IPs, -1,
|
||||
func(address string, fldPath *field.Path) field.ErrorList {
|
||||
return validation.IsValidCIDR(fldPath, address)
|
||||
},
|
||||
@ -803,6 +803,6 @@ func validateNetworkDeviceData(networkDeviceData *resource.NetworkDeviceData, fl
|
||||
maskSize, _ := ipNet.Mask.Size()
|
||||
return fmt.Sprintf("%s/%d", ip.String(), maskSize), ""
|
||||
},
|
||||
fldPath.Child("addresses"))...)
|
||||
fldPath.Child("ips"))...)
|
||||
return allErrs
|
||||
}
|
||||
|
@ -1008,7 +1008,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
NetworkData: &resource.NetworkDeviceData{
|
||||
InterfaceName: strings.Repeat("x", 256),
|
||||
HardwareAddress: strings.Repeat("x", 128),
|
||||
Addresses: []string{
|
||||
IPs: []string{
|
||||
"10.9.8.0/24",
|
||||
"2001:db8::/64",
|
||||
"10.9.8.1/24",
|
||||
@ -1023,7 +1023,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
},
|
||||
"invalid-device-status-duplicate": {
|
||||
wantFailures: field.ErrorList{
|
||||
field.Duplicate(field.NewPath("status", "devices").Index(0).Child("networkData", "addresses").Index(1), "2001:db8::1/64"),
|
||||
field.Duplicate(field.NewPath("status", "devices").Index(0).Child("networkData", "ips").Index(1), "2001:db8::1/64"),
|
||||
field.Duplicate(field.NewPath("status", "devices").Index(1).Child("deviceID"), structured.MakeDeviceID(goodName, goodName, goodName)),
|
||||
},
|
||||
oldClaim: func() *resource.ResourceClaim { return validAllocatedClaim }(),
|
||||
@ -1034,7 +1034,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
Pool: goodName,
|
||||
Device: goodName,
|
||||
NetworkData: &resource.NetworkDeviceData{
|
||||
Addresses: []string{
|
||||
IPs: []string{
|
||||
"2001:db8::1/64",
|
||||
"2001:0db8::1/64",
|
||||
},
|
||||
@ -1054,7 +1054,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
wantFailures: field.ErrorList{
|
||||
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "interfaceName"), "", interfaceNameMaxLength),
|
||||
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "hardwareAddress"), "", hardwareAddressMaxLength),
|
||||
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)"),
|
||||
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)"),
|
||||
},
|
||||
oldClaim: func() *resource.ResourceClaim { return validAllocatedClaim }(),
|
||||
update: func(claim *resource.ResourceClaim) *resource.ResourceClaim {
|
||||
@ -1066,7 +1066,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
NetworkData: &resource.NetworkDeviceData{
|
||||
InterfaceName: strings.Repeat("x", interfaceNameMaxLength+1),
|
||||
HardwareAddress: strings.Repeat("x", hardwareAddressMaxLength+1),
|
||||
Addresses: []string{
|
||||
IPs: []string{
|
||||
"300.9.8.0/24",
|
||||
},
|
||||
},
|
||||
@ -1115,7 +1115,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
},
|
||||
"invalid-device-status-duplicate-disabled-feature-gate": {
|
||||
wantFailures: field.ErrorList{
|
||||
field.Duplicate(field.NewPath("status", "devices").Index(0).Child("networkData", "addresses").Index(1), "2001:db8::1/64"),
|
||||
field.Duplicate(field.NewPath("status", "devices").Index(0).Child("networkData", "ips").Index(1), "2001:db8::1/64"),
|
||||
field.Duplicate(field.NewPath("status", "devices").Index(1).Child("deviceID"), structured.MakeDeviceID(goodName, goodName, goodName)),
|
||||
},
|
||||
oldClaim: func() *resource.ResourceClaim { return validAllocatedClaim }(),
|
||||
@ -1126,7 +1126,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
Pool: goodName,
|
||||
Device: goodName,
|
||||
NetworkData: &resource.NetworkDeviceData{
|
||||
Addresses: []string{
|
||||
IPs: []string{
|
||||
"2001:db8::1/64",
|
||||
"2001:0db8::1/64",
|
||||
},
|
||||
@ -1146,7 +1146,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
wantFailures: field.ErrorList{
|
||||
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "interfaceName"), "", interfaceNameMaxLength),
|
||||
field.TooLong(field.NewPath("status", "devices").Index(0).Child("networkData", "hardwareAddress"), "", hardwareAddressMaxLength),
|
||||
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)"),
|
||||
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)"),
|
||||
},
|
||||
oldClaim: func() *resource.ResourceClaim { return validAllocatedClaim }(),
|
||||
update: func(claim *resource.ResourceClaim) *resource.ResourceClaim {
|
||||
@ -1158,7 +1158,7 @@ func TestValidateClaimStatusUpdate(t *testing.T) {
|
||||
NetworkData: &resource.NetworkDeviceData{
|
||||
InterfaceName: strings.Repeat("x", interfaceNameMaxLength+1),
|
||||
HardwareAddress: strings.Repeat("x", hardwareAddressMaxLength+1),
|
||||
Addresses: []string{
|
||||
IPs: []string{
|
||||
"300.9.8.0/24",
|
||||
},
|
||||
},
|
||||
|
@ -1057,15 +1057,15 @@ type NetworkDeviceData struct {
|
||||
// +optional
|
||||
InterfaceName string `json:"interfaceName,omitempty" protobuf:"bytes,1,opt,name=interfaceName"`
|
||||
|
||||
// Addresses lists the network addresses assigned to the device's network interface.
|
||||
// IPs lists the network addresses assigned to the device's network interface.
|
||||
// This can include both IPv4 and IPv6 addresses.
|
||||
// The addresses are in the CIDR notation, which includes both the address and the
|
||||
// The IPs are in the CIDR notation, which includes both the address and the
|
||||
// associated subnet mask.
|
||||
// e.g.: "192.0.2.5/24" for IPv4 and "2001:db8::5/64" for IPv6.
|
||||
//
|
||||
// +optional
|
||||
// +listType=atomic
|
||||
Addresses []string `json:"addresses,omitempty" protobuf:"bytes,2,opt,name=addresses"`
|
||||
IPs []string `json:"ips,omitempty" protobuf:"bytes,2,opt,name=ips"`
|
||||
|
||||
// HardwareAddress represents the hardware address (e.g. MAC Address) of the device's network interface.
|
||||
//
|
||||
|
@ -441,7 +441,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
|
||||
Data: runtime.RawExtension{Raw: []byte(`{"foo":"bar"}`)},
|
||||
NetworkData: &resourceapi.NetworkDeviceData{
|
||||
InterfaceName: "inf1",
|
||||
Addresses: []string{"10.9.8.0/24", "2001:db8::/64"},
|
||||
IPs: []string{"10.9.8.0/24", "2001:db8::/64"},
|
||||
HardwareAddress: "bc:1c:b6:3e:b8:25",
|
||||
},
|
||||
})
|
||||
@ -460,7 +460,7 @@ var _ = framework.SIGDescribe("node")("DRA", feature.DynamicResourceAllocation,
|
||||
Data: runtime.RawExtension{Raw: []byte(`{"bar":"foo"}`)},
|
||||
NetworkData: &resourceapi.NetworkDeviceData{
|
||||
InterfaceName: "inf2",
|
||||
Addresses: []string{"10.9.8.1/24", "2001:db8::1/64"},
|
||||
IPs: []string{"10.9.8.1/24", "2001:db8::1/64"},
|
||||
HardwareAddress: "bc:1c:b6:3e:b8:26",
|
||||
},
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
|
||||
},
|
||||
NetworkData: &v1alpha3.NetworkDeviceData{
|
||||
InterfaceName: "net-1",
|
||||
Addresses: []string{
|
||||
IPs: []string{
|
||||
"10.9.8.0/24",
|
||||
"2001:db8::/64",
|
||||
},
|
||||
@ -158,7 +158,7 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
|
||||
},
|
||||
NetworkData: &v1alpha3.NetworkDeviceData{
|
||||
InterfaceName: "net-1",
|
||||
Addresses: []string{
|
||||
IPs: []string{
|
||||
"10.9.8.0/24",
|
||||
"2001:db8::/64",
|
||||
},
|
||||
@ -194,7 +194,7 @@ func TestEnableDisableDRAResourceClaimDeviceStatus(t *testing.T) {
|
||||
},
|
||||
NetworkData: &v1alpha3.NetworkDeviceData{
|
||||
InterfaceName: "net-1",
|
||||
Addresses: []string{
|
||||
IPs: []string{
|
||||
"10.9.8.0/24",
|
||||
"2001:db8::/64",
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user