Skip to content
This repository was archived by the owner on Dec 9, 2025. It is now read-only.

Commit 7a1f6be

Browse files
committed
interface status
Change-Id: Iae669bee7f41dd13a67776cfdacc1759e725d75a
1 parent cf19a0c commit 7a1f6be

File tree

1 file changed

+74
-83
lines changed

1 file changed

+74
-83
lines changed

site/content/docs/concepts/interface-status.md

Lines changed: 74 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -3,100 +3,91 @@ title: "Interface Status"
33
date: 2025-05-25T11:30:40Z
44
---
55

6-
To configure network interfaces in DraNet, users can provide custom configurations through the parameters field of a ResourceClaim or ResourceClaimTemplate. This configuration adheres to the NetworkConfig structure, which defines the desired state for network interfaces and their associated routes.
6+
### Understanding Interface Status Output
77

8-
### Network Configuration Overview
8+
When DraNet allocates a network interface to a Pod via a `ResourceClaim`, it publishes the status of the allocated device within the `ResourceClaim`'s `status` field. This provides crucial insights into the readiness and configuration of the network interface from a Kubernetes perspective, adhering to the standardized device status defined in [KEP-4817](https://github.com/kubernetes/enhancements/blob/master/keps/sig-node/4817-resource-claim-device-status/README.md).
99

10-
The primary structure for custom network configuration is NetworkConfig. It encompasses settings for the network interface itself and any specific routes to be applied within the Pod's network namespace.
10+
After a `ResourceClaim` is processed and a network device is allocated, its status is reflected under `ResourceClaim.status.devices`. This section contains `conditions` and `networkData` for each allocated device.
1111

12-
```go
13-
type NetworkConfig struct {
14-
Interface InterfaceConfig `json:"interface"`
15-
Routes []RouteConfig `json:"routes"`
16-
}
17-
```
18-
19-
#### Interface Configuration
20-
21-
The InterfaceConfig structure allows you to specify details for a single network interface.
12+
#### Conditions
2213

23-
```go
24-
type InterfaceConfig struct {
25-
Name string `json:"name,omitempty"`
26-
Addresses []string `json:"addresses,omitempty"`
27-
MTU int32 `json:"mtu,omitempty"`
28-
HardwareAddr string `json:"hardwareAddr,omitempty"`
29-
}
30-
```
31-
32-
* **name** (string, optional): The logical name that the interface will have inside the Pod (e.g., "eth0", "enp0s3"). If not specified, DraNet will keep the original name if compliant.
33-
* **addresses** ([]string, optional): A list of IP addresses in CIDR format (e.g., "192.168.1.10/24", "2001:db8::1/64") to be assigned to the interface.
34-
* **mtu** (int32, optional): The Maximum Transmission Unit for the interface.
35-
* **hardwareAddr** (string, optional, Read-Only): The current hardware (MAC) address of the interface.
14+
The `conditions` array provides a timeline of the device's state and indicates whether specific aspects of its configuration and readiness have been met. DraNet reports the following conditions:
3615

37-
#### **Route Configuration (RouteConfig)**
16+
* **`Ready` (type `NetworkDeviceReady`)**: Indicates that the network device has been successfully moved into the Pod's network namespace and is configured.
17+
* **`NetworkReady`**: Signifies that the network interface within the Pod has been successfully configured with its IP addresses and routes.
18+
* **`RDMALinkReady`**: (Applies only when RDMA is used in exclusive mode) Indicates that the associated RDMA link device has been successfully moved into the Pod's network namespace.
3819

39-
The RouteConfig structure defines individual network routes to be added to the Pod's network namespace, associated with the configured interface.
20+
Each condition includes:
21+
* **`lastTransitionTime`**: The timestamp when the condition last changed.
22+
* **`message`**: A human-readable message about the condition.
23+
* **`reason`**: A single-word identifier for the reason for the condition's last transition.
24+
* **`status`**: "True", "False", or "Unknown" indicating the state of the condition.
25+
* **`type`**: The specific type of condition (e.g., "Ready", "NetworkReady").
4026

41-
```go
42-
type RouteConfig struct {
43-
Destination string `json:"destination,omitempty"`
44-
Gateway string `json:"gateway,omitempty"`
45-
Source string `json:"source,omitempty"`
46-
Scope uint8 `json:"scope,omitempty"`
47-
}
48-
```
27+
#### Network Data (`networkData`)
4928

50-
* **destination** (string, optional): The destination network in CIDR format (e.g., "0.0.0.0/0" for a default route, "10.0.0.0/8" for a specific subnet).
51-
* **gateway** (string, optional): The IP address of the gateway for the route. This field is mandatory for routes with Universe scope (0).
52-
* **source** (string, optional): An optional source IP address for policy routing.
53-
* **scope** (uint8, optional): The scope of the route. Only Link (253) or Universe (0) are allowed.
54-
* Link (253): Routes directly to a device without a gateway (e.g., for directly connected subnets).
55-
* Universe (0): Routes to a network via a gateway.
29+
The `networkData` field provides standardized output about the network interface as it appears inside the Pod. This data is crucial for applications that need to dynamically discover their assigned network interfaces.
5630

57-
### **Example: Customizing a Network Interface and Routes**
31+
* **`interfaceName`**: The actual name of the network interface inside the Pod (e.g., "eth0", "eth99").
32+
* **`hardwareAddress`**: The MAC address of the network interface.
33+
* **`ips`**: A list of IP addresses (in CIDR format) assigned to the interface.
5834

59-
Below is an example of a ResourceClaim that allocates a dummy interface, renames it to "eth99", assigns a static IP address, and configures two routes: one to a subnet via a gateway and another link-scoped route.
35+
### Example Output
6036

37+
Here's an example of the `status` section from a `ResourceClaim` named `dummy-interface-static-ip-route`, showing the conditions and network data for an allocated network interface:
6138

6239
```yaml
63-
apiVersion: resource.k8s.io/v1beta1
64-
kind: ResourceClaim
65-
metadata:
66-
name: dummy-interface-static-ip-route
67-
spec:
68-
devices:
69-
requests:
70-
- name: req-dummy
71-
deviceClassName: dra.net
72-
selectors:
73-
- cel:
74-
expression: device.attributes["dra.net"].type == "dummy"
75-
config:
76-
- opaque:
77-
driver: dra.net
78-
parameters:
79-
interface:
80-
name: "eth99"
81-
addresses:
82-
- "169.254.169.13/32"
83-
routes:
84-
- destination: "169.254.169.0/24"
85-
gateway: "169.254.169.1"
86-
- destination: "169.254.169.1/32"
87-
scope: 253
88-
---
89-
apiVersion: v1
90-
kind: Pod
91-
metadata:
92-
name: pod3
93-
labels:
94-
app: pod
95-
spec:
96-
containers:
97-
- name: ctr1
98-
image: registry.k8s.io/e2e-test-images/agnhost:2.39
99-
resourceClaims:
100-
- name: dummy1
101-
resourceClaimName: dummy-interface-static-ip-route
40+
status:
41+
allocation:
42+
devices:
43+
config:
44+
- opaque:
45+
driver: dra.net
46+
parameters:
47+
interface:
48+
addresses:
49+
- 169.254.169.13/32
50+
name: eth99
51+
routes:
52+
- destination: 169.254.169.0/24
53+
gateway: 169.254.169.1
54+
- destination: 169.254.169.1/32
55+
scope: 253
56+
source: FromClaim
57+
results:
58+
- adminAccess: null
59+
device: dummy2
60+
driver: dra.net
61+
pool: dra-worker
62+
request: req-dummy
63+
nodeSelector:
64+
nodeSelectorTerms:
65+
- matchFields:
66+
- key: metadata.name
67+
operator: In
68+
values:
69+
- dra-worker
70+
devices:
71+
- conditions:
72+
- lastTransitionTime: "2025-05-24T10:25:51Z"
73+
message: ""
74+
reason: NetworkDeviceReady
75+
status: "True"
76+
type: Ready
77+
- lastTransitionTime: "2025-05-24T10:25:51Z"
78+
message: ""
79+
reason: NetworkReady
80+
status: "True"
81+
type: NetworkReady
82+
device: dummy2
83+
driver: dra.net
84+
networkData:
85+
hardwareAddress: 86:d7:86:e6:f3:dd
86+
interfaceName: eth99
87+
ips:
88+
- 169.254.169.13/32
89+
pool: dra-worker
90+
reservedFor:
91+
- name: pod3
92+
resource: pods
10293
```

0 commit comments

Comments
 (0)