github.com/kubewharf/katalyst-core@v0.5.3/pkg/config/agent/global/base.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 global
    18  
    19  type BaseConfiguration struct {
    20  	// Agents is the list of agent components to enable or disable
    21  	// '*' means "all enabled by default agents"
    22  	// 'foo' means "enable 'foo'"
    23  	// '-foo' means "disable 'foo'"
    24  	// first item for a particular name wins
    25  	Agents []string
    26  
    27  	NodeName    string
    28  	NodeAddress string
    29  
    30  	// LockFileName indicates the file used as unique lock
    31  	LockFileName string
    32  	// if LockWaitingEnabled set as true, will not panic and report agent as healthy instead
    33  	LockWaitingEnabled bool
    34  
    35  	// ReclaimRelativeRootCgroupPath is configurable since we may need to
    36  	// specify a customized path for reclaimed-cores to enrich qos-management ways
    37  	ReclaimRelativeRootCgroupPath string
    38  
    39  	*MachineInfoConfiguration
    40  	*KubeletConfiguration
    41  	*RuntimeConfiguration
    42  	*MalachiteConfiguration
    43  }
    44  
    45  type MachineInfoConfiguration struct {
    46  	// if NetMultipleNS set as true, we should collect network interfaces from multiple ns
    47  	NetMultipleNS   bool
    48  	NetNSDirAbsPath string
    49  
    50  	// SiblingNumaMemoryBandwidthCapacity is the max capacity of memory bandwidth can share
    51  	// among sibling NUMAs, and SiblingNumaMemoryBandwidthAllocatableRate is the rate of
    52  	// the allocatable to the capacity
    53  	SiblingNumaMemoryBandwidthCapacity        int64
    54  	SiblingNumaMemoryBandwidthAllocatableRate float64
    55  }
    56  
    57  type KubeletConfiguration struct {
    58  	KubeletReadOnlyPort      int
    59  	KubeletSecurePort        int
    60  	KubeletSecurePortEnabled bool
    61  
    62  	KubeletConfigEndpoint  string
    63  	KubeletPodsEndpoint    string
    64  	KubeletSummaryEndpoint string
    65  
    66  	APIAuthTokenFile string
    67  }
    68  
    69  type RuntimeConfiguration struct {
    70  	RuntimeEndpoint string
    71  }
    72  
    73  type MalachiteConfiguration struct {
    74  	// GeneralRelativeCgroupPaths and OptionalRelativeCgroupPaths are both paths of standalone services which not managed by kubernetes.
    75  	// If the former paths not existed, errors will occur, whereas the latter will not.
    76  	GeneralRelativeCgroupPaths  []string
    77  	OptionalRelativeCgroupPaths []string
    78  }
    79  
    80  func NewBaseConfiguration() *BaseConfiguration {
    81  	return &BaseConfiguration{
    82  		MachineInfoConfiguration: &MachineInfoConfiguration{},
    83  		KubeletConfiguration:     &KubeletConfiguration{},
    84  		RuntimeConfiguration:     &RuntimeConfiguration{},
    85  		MalachiteConfiguration:   &MalachiteConfiguration{},
    86  	}
    87  }