github.com/kubewharf/katalyst-core@v0.5.3/pkg/consts/common.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 consts
    18  
    19  import (
    20  	"math"
    21  )
    22  
    23  const (
    24  	ControlKnobON  = "true"
    25  	ControlKnobOFF = "false"
    26  )
    27  
    28  const (
    29  	// OwnerReferenceIndex is the lookup name for the index function
    30  	OwnerReferenceIndex = "owner-reference-index"
    31  	// TargetReferenceIndex is the lookup name for the index function
    32  	TargetReferenceIndex = "target-reference-index"
    33  	// VPANameIndex is the lookup name for the index function
    34  	VPANameIndex = "vpa-name-index"
    35  )
    36  
    37  // const variables for pod eviction reason identifier in event.
    38  const (
    39  	EventReasonEvictFailed              = "EvictFailed"
    40  	EventReasonEvictCreated             = "EvictCreated"
    41  	EventReasonEvictExceededGracePeriod = "EvictExceededGracePeriod"
    42  	EventReasonEvictSucceeded           = "EvictSucceeded"
    43  
    44  	EventReasonContainerStopped = "ContainerStopped"
    45  )
    46  
    47  // const variable for pod eviction action identifier in event.
    48  const (
    49  	EventActionEvicting          = "Evicting"
    50  	EventActionContainerStopping = "ContainerStopping"
    51  )
    52  
    53  // KeySeparator : to split parts of a key
    54  const KeySeparator = "/"
    55  
    56  // KatalystNodeDomainPrefix domain prefix for taint, label, annotation keys.
    57  const KatalystNodeDomainPrefix = "node.katalyst.kubewharf.io"
    58  
    59  // KatalystComponent defines the component name that current process is running as.
    60  type KatalystComponent string
    61  
    62  const (
    63  	KatalystComponentAgent      KatalystComponent = "agent"
    64  	KatalystComponentController KatalystComponent = "controller"
    65  	KatalystComponentWebhook    KatalystComponent = "webhook"
    66  	KatalystComponentMetric     KatalystComponent = "metric"
    67  	KatalystComponentScheduler  KatalystComponent = "scheduler"
    68  )
    69  
    70  // common fields for ordinary k8s objects.
    71  const (
    72  	ObjectFieldNameSpec   = "spec"
    73  	ObjectFieldNameStatus = "status"
    74  )
    75  
    76  // common disk types.
    77  const (
    78  	DiskTypeUnknown = 0
    79  	DiskTypeHDD     = 1
    80  	DiskTypeSSD     = 2
    81  	DiskTypeNVME    = 3
    82  )
    83  
    84  var (
    85  	EXP1  = 1.0 / math.Exp(5.0/60.0)
    86  	EXP5  = 1.0 / math.Exp(5.0/300.0)
    87  	EXP15 = 1.0 / math.Exp(5.0/900.0)
    88  )