volcano.sh/apis@v1.8.2/pkg/apis/nodeinfo/v1alpha1/numatopo_types.go (about)

     1  /*
     2  Copyright 2021 The Volcano 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 v1alpha1
    18  
    19  import (
    20  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
    21  )
    22  
    23  // EDIT THIS FILE!  THIS IS SCAFFOLDING FOR YOU TO OWN!
    24  // NOTE: json tags are required.  Any new fields you add must have json tags for the fields to be serialized.
    25  
    26  // ResourceInfo is the sets about resource capacity and allocatable
    27  type ResourceInfo struct {
    28  	Allocatable string `json:"allocatable,omitempty"`
    29  	Capacity    int    `json:"capacity,omitempty"`
    30  }
    31  
    32  // CPUInfo is the cpu topology detail
    33  type CPUInfo struct {
    34  	NUMANodeID int `json:"numa,omitempty"`
    35  	SocketID   int `json:"socket,omitempty"`
    36  	CoreID     int `json:"core,omitempty"`
    37  }
    38  
    39  // PolicyName is the policy name type
    40  type PolicyName string
    41  
    42  const (
    43  	// CPUManagerPolicy shows cpu manager policy type
    44  	CPUManagerPolicy PolicyName = "CPUManagerPolicy"
    45  	// TopologyManagerPolicy shows topology manager policy type
    46  	TopologyManagerPolicy PolicyName = "TopologyManagerPolicy"
    47  )
    48  
    49  // NumatopoSpec defines the desired state of Numatopology
    50  type NumatopoSpec struct {
    51  	// Specifies the policy of the manager
    52  	// +optional
    53  	Policies map[PolicyName]string `json:"policies,omitempty"`
    54  
    55  	// Specifies the reserved resource of the node
    56  	// Key is resource name
    57  	// +optional
    58  	ResReserved map[string]string `json:"resReserved,omitempty"`
    59  
    60  	// Specifies the numa info for the resource
    61  	// Key is resource name
    62  	// +optional
    63  	NumaResMap map[string]ResourceInfo `json:"numares,omitempty"`
    64  
    65  	// Specifies the cpu topology info
    66  	// Key is cpu id
    67  	// +optional
    68  	CPUDetail map[string]CPUInfo `json:"cpuDetail,omitempty"`
    69  }
    70  
    71  // +genclient
    72  // +genclient:nonNamespaced
    73  // +kubebuilder:object:root=true
    74  // +kubebuilder:resource:shortName=numatopo,scope=Cluster
    75  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    76  
    77  // Numatopology is the Schema for the Numatopologies API
    78  type Numatopology struct {
    79  	metav1.TypeMeta   `json:",inline"`
    80  	metav1.ObjectMeta `json:"metadata,omitempty"`
    81  
    82  	// Specification of the numa information of the worker node
    83  	Spec NumatopoSpec `json:"spec,omitempty"`
    84  }
    85  
    86  // +kubebuilder:object:root=true
    87  // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
    88  
    89  // NumatopologyList contains a list of Numatopology
    90  type NumatopologyList struct {
    91  	metav1.TypeMeta `json:",inline"`
    92  	metav1.ListMeta `json:"metadata,omitempty"`
    93  	Items           []Numatopology `json:"items"`
    94  }