github.com/kubewharf/katalyst-core@v0.5.3/pkg/config/agent/qrm/network_plugin.go (about)

     1  /*
     2  Copyright 2022 The Katalyst Authors.
     3  
     4  Licensed under the Apache License, Version 2.0 (the "License");
     5  you may not use this file except in compliance with the License.
     6  You may obtain a copy of the License at
     7  
     8      http://www.apache.org/licenses/LICENSE-2.0
     9  
    10  Unless required by applicable law or agreed to in writing, software
    11  distributed under the License is distributed on an "AS IS" BASIS,
    12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13  See the License for the specific language governing permissions and
    14  limitations under the License.
    15  */
    16  
    17  package qrm
    18  
    19  // NetworkQRMPluginConfig is the config of network QRM plugin
    20  type NetworkQRMPluginConfig struct {
    21  	// PolicyName is used to switch between several strategies
    22  	PolicyName string
    23  	NetClass   NetClassConfig
    24  	// Reserved network bandwidth in unit of Mbps for business-critical jobs (e.g. online services).
    25  	// In phase 1, we only support the reservation for business-critical jobs. The system component reservation might be added later.
    26  	// Also, we do not differentiate the egress and ingress reservation for now. That is, the reserved bandwidth on egress and ingress is supposed to be same
    27  	ReservedBandwidth uint32
    28  	// The ratio of available capacity to NIC line speed. For example, a 25Gbps NIC's max bandwidth is around 23.5Gbps.
    29  	// Please note, the ingress rate throttling may need additional virtual device like ifb, which results in lower capacity than egress
    30  	EgressCapacityRate  float32
    31  	IngressCapacityRate float32
    32  	// skip network state corruption and it will be used after updating state properties
    33  	SkipNetworkStateCorruption                      bool
    34  	PodLevelNetClassAnnoKey                         string
    35  	PodLevelNetAttributesAnnoKeys                   string
    36  	IPv4ResourceAllocationAnnotationKey             string
    37  	IPv6ResourceAllocationAnnotationKey             string
    38  	NetNSPathResourceAllocationAnnotationKey        string
    39  	NetInterfaceNameResourceAllocationAnnotationKey string
    40  	NetClassIDResourceAllocationAnnotationKey       string
    41  	NetBandwidthResourceAllocationAnnotationKey     string
    42  }
    43  
    44  type NetClassConfig struct {
    45  	// ReclaimedCores is the network class id for reclaimed_cores
    46  	ReclaimedCores uint32
    47  	// SharedCores is the network class id for shared_cores
    48  	SharedCores uint32
    49  	// DedicatedCores is the network class id for dedicated_cores
    50  	DedicatedCores uint32
    51  	// SystemCores is the network class id for system_cores
    52  	SystemCores uint32
    53  }
    54  
    55  // NewNetworkQRMPluginConfig returns a NetworkQRMPluginConfig
    56  func NewNetworkQRMPluginConfig() *NetworkQRMPluginConfig {
    57  	return &NetworkQRMPluginConfig{}
    58  }