k8s

package
v0.0.0-...-c70b2fc Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 23, 2025 License: Apache-2.0, Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package k8s is using for the k8s operation.

Package k8s is using for the k8s operation.

Package k8s is using for the k8s operation.

Package k8s is using for the k8s operation.

Package k8s is using for the k8s operation.

Package k8s is using for the k8s operation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckConfigMapIsDeviceInfo

func CheckConfigMapIsDeviceInfo(cm *v1.ConfigMap) bool

CheckConfigMapIsDeviceInfo check configmap is device info

func CheckConfigMapIsNodeInfo

func CheckConfigMapIsNodeInfo(cm *v1.ConfigMap) bool

CheckConfigMapIsNodeInfo check whether the configmap is kube-system/node-info-

func CreateOrUpdateConfigMap

func CreateOrUpdateConfigMap(k8s kubernetes.Interface, cm *v1.ConfigMap, cmName, nameSpace string) error

CreateOrUpdateConfigMap Create or update configMap.

func FakeDeviceInfoCMDataByNode

func FakeDeviceInfoCMDataByNode(nodeName string, deviceList map[string]string) *v1.ConfigMap

FakeDeviceInfoCMDataByNode fake device info cm data

func FakeDeviceList

func FakeDeviceList() map[string]string

FakeDeviceList fake device list

func FakeNodeInfos

func FakeNodeInfos() map[string]string

FakeNodeInfos fake node infos

func FakeSwitchInfos

func FakeSwitchInfos() string

FakeSwitchInfos fake switch infos

func GetConfigMap

func GetConfigMap(client kubernetes.Interface, namespace, cmName string) (*v1.ConfigMap, error)

GetConfigMap Get config map from k8s.

func GetConfigMapWithRetry

func GetConfigMapWithRetry(client kubernetes.Interface, namespace, cmName string) (*v1.ConfigMap, error)

GetConfigMapWithRetry Get config map from k8s.

func GetDeviceInfosAndSetInformerStart

func GetDeviceInfosAndSetInformerStart(nodeList []*api.NodeInfo, useClusterD bool) map[string]NodeDeviceInfoWithID

GetDeviceInfosAndSetInformerStart get device Infos and check Informer health state

func GetNodeDInfos

func GetNodeDInfos(nodeList []*api.NodeInfo) map[string]NodeDNodeInfo

GetNodeDInfos is to get a copy of nodeInfo which is get from configmap of nodeD

func GetSwitchInfos

func GetSwitchInfos(nodeList []*api.NodeInfo) map[string]SwitchFaultInfo

GetSwitchInfos is to get a copy of switchInfo which is get from configmap of switch info

func GetTorNodeWithOneMinuteDelay

func GetTorNodeWithOneMinuteDelay(client kubernetes.Interface, namespace, cmName string) (*v1.ConfigMap, error)

GetTorNodeWithOneMinuteDelay get tor node configMap with one-minute delay

func InformerConfigmapFilter

func InformerConfigmapFilter(obj interface{}) bool

InformerConfigmapFilter is used to filter out cm need to be listened for ascend plugin

func InitCmInformer

func InitCmInformer(k8sClient kubernetes.Interface, useClusterD bool)

InitCmInformer init cm informer, support cluster info manager and device plugin

func IsConfigMapChanged

func IsConfigMapChanged(k8s kubernetes.Interface, cm *v1.ConfigMap, cmName, nameSpace string) bool

IsConfigMapChanged judge the cm wither is same. true is no change.

func UpdateConfigmapIncrementally

func UpdateConfigmapIncrementally(kubeClient kubernetes.Interface, ns, name string,
	newData map[string]string) (map[string]string, error)

UpdateConfigmapIncrementally update configmap Map data but keep the key value pair that new data does not have

Types

type ClusterInfoWitchCm

type ClusterInfoWitchCm struct {
	// contains filtered or unexported fields
}

ClusterInfoWitchCm cluster info whit different configmap

func NewClusterInfoWitchCm

func NewClusterInfoWitchCm() ClusterInfoWitchCm

NewClusterInfoWitchCm new empty cluster info with cm

type DeviceInfosWithMutex

type DeviceInfosWithMutex struct {
	sync.Mutex
	Devices map[string]NodeDeviceInfoWithID
}

DeviceInfosWithMutex information for the current plugin

type NodeDNodeInfo

type NodeDNodeInfo struct {
	FaultDevList []struct {
		DeviceType string
		DeviceId   int
		FaultCode  []string
		FaultLevel string
	}
	NodeStatus string
}

NodeDNodeInfo is node the information reported by noded

type NodeDeviceInfo

type NodeDeviceInfo struct {
	DeviceList map[string]string
	UpdateTime int64
}

NodeDeviceInfo like node annotation.

type NodeDeviceInfoWithDevPlugin

type NodeDeviceInfoWithDevPlugin struct {
	DeviceInfo  NodeDeviceInfo
	CheckCode   string
	SuperPodID  int32 `json:"SuperPodID,omitempty"`
	ServerIndex int32 `json:"ServerIndex,omitempty"`
}

NodeDeviceInfoWithDevPlugin a node has one by cm.

type NodeDeviceInfoWithID

type NodeDeviceInfoWithID struct {
	NodeDeviceInfo
	CacheUpdateTime int64
	SuperPodID      int32
}

NodeDeviceInfoWithID is node the information reported by cm.

type NodeInfoWithNodeD

type NodeInfoWithNodeD struct {
	NodeInfo  NodeDNodeInfo
	CheckCode string
}

NodeInfoWithNodeD is node the node information and checkCode reported by noded

type NodeInfosFromCmWithMutex

type NodeInfosFromCmWithMutex struct {
	sync.Mutex
	Nodes map[string]NodeDNodeInfo
}

NodeInfosFromCmWithMutex node info with mutex

type SwitchFaultInfo

type SwitchFaultInfo struct {
	FaultCode  []string
	FaultLevel string
	UpdateTime int64
	NodeStatus string
}

SwitchFaultInfo Switch Fault Info

type SwitchInfosFromCmWithMutex

type SwitchInfosFromCmWithMutex struct {
	sync.Mutex
	Switches map[string]SwitchFaultInfo
}

SwitchInfosFromCmWithMutex SwitchInfos From Cm WithMutex

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL