-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathconsts.go
More file actions
88 lines (75 loc) · 3.16 KB
/
consts.go
File metadata and controls
88 lines (75 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
/*
* Copyright 2025 The Kubernetes Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package consts
import (
"time"
resourceapi "k8s.io/api/resource/v1"
"k8s.io/apimachinery/pkg/util/wait"
"k8s.io/dynamic-resource-allocation/deviceattribute"
)
const (
GroupName = "sriovnetwork.k8snetworkplumbingwg.io"
DriverName = "sriovnetwork.k8snetworkplumbingwg.io"
DriverPluginCheckpointFile = "checkpoint.json"
MultusAttributePrefix = "k8s.cni.cncf.io"
AttributePciAddress = DriverName + "/pciAddress"
AttributePFName = DriverName + "/PFName"
AttributeEswitchMode = DriverName + "/EswitchMode"
AttributeVendorID = DriverName + "/vendor"
AttributeDeviceID = DriverName + "/deviceID"
AttributePFDeviceID = DriverName + "/pfDeviceID"
AttributeVFID = DriverName + "/vfID"
AttributeResourceName = DriverName + "/resourceName"
AttributeLinkType = DriverName + "/linkType"
AttributeRDMACapable = DriverName + "/rdmaCapable"
AttributeMultusDeviceID = MultusAttributePrefix + "/deviceID"
AttributeMultusResourceName = MultusAttributePrefix + "/resourceName"
// Use upstream Kubernetes standard attribute prefix for pciAddress
AttributeStandardPciAddress = deviceattribute.StandardDeviceAttributePrefix + "pciBusID"
// AttributePfPciAddress is for the PCI address of the Physical Function (PF).
AttributePfPciAddress = DriverName + "/pfPciAddress"
// this is the most-common nonstandard prefix, supported by dranet and dracpu
DraNetCompatPrefix = "dra.net"
AttributeNUMANode = DraNetCompatPrefix + "/numaNode"
// Network device constants
NetClass = 0x02 // Network controller class
SysBusPci = "/sys/bus/pci/devices"
// Link type constants
LinkTypeEth = "eth"
LinkTypeEthernet = "ethernet"
LinkTypeIB = "ib"
LinkTypeInfiniband = "infiniband"
LinkTypeUnknown = "unknown"
// RDMA device constants
SysClassInfiniband = "/sys/class/infiniband"
)
// Kubernetes standard attributes
var (
// AttributePCIeRoot identifies the PCIe root complex of the device
AttributePCIeRoot resourceapi.QualifiedName = deviceattribute.StandardDeviceAttributePCIeRoot
)
type ConfigurationMode string
const (
ConfigurationModeStandalone ConfigurationMode = "STANDALONE"
ConfigurationModeMultus ConfigurationMode = "MULTUS"
)
var Backoff = wait.Backoff{
Duration: 100 * time.Millisecond, // Initial delay
Factor: 2.0, // Exponential factor
Jitter: 0.1, // 10% jitter
Steps: 5, // Maximum 5 attempts
Cap: 2 * time.Second, // Maximum delay between attempts
}