model

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TrackEventContainerStart    = "ContainerStart"    // Represents the event of a container starting.
	TrackEventContainerShutdown = "ContainerShutdown" // Represents the event of a container shutting down.
	TrackEventVPodDelete        = "PodDelete"         // Represents the event of a vPod being deleted.
	TrackEventVPodUpdate        = "PodUpdate"         // Represents the event of a vPod being updated.
)

These constants are used to identify specific events in the system, allowing for better monitoring and logging capabilities.

View Source
const (
	// LabelKeyOfTraceID is a constant string used as a key for trace ID in Kubernetes objects.
	LabelKeyOfTraceID = "trace.koupleless.io/id"
	// LabelKeyOfComponent is a constant string used as a key for component in Kubernetes objects.
	LabelKeyOfComponent = "virtual-kubelet.koupleless.io/component"
	// LabelKeyOfEnv is a constant string used as a key for environment in Kubernetes objects.
	LabelKeyOfEnv = "virtual-kubelet.koupleless.io/env"
	// LabelKeyOfBaseName is a constant string used as a key for base name.
	LabelKeyOfBaseName = "base.koupleless.io/name"
	// LabelKeyOfBaseVersion is a constant string used as a key for base version.
	LabelKeyOfBaseVersion = "base.koupleless.io/version"
	// LabelKeyOfBaseClusterName is the constant string used as a key for base cluster name.
	LabelKeyOfBaseClusterName = "base.koupleless.io/cluster-name"
)
View Source
const (
	// TaintKeyOfVnode is a constant string used as a key for taints related to virtual nodes in Kubernetes objects.
	TaintKeyOfVnode = "schedule.koupleless.io/virtual-node"
	// TaintKeyOfEnv is a constant string used as a key for taints related to node environments in Kubernetes objects.
	TaintKeyOfEnv = "schedule.koupleless.io/node-env"
)
View Source
const (
	// ComponentVNode is a constant string used to identify the vnode component in the system.
	ComponentVNode = "vnode"
	// ComponentVNodeLease is a constant string used to identify the vnode lease component in the system.
	ComponentVNodeLease = "vnode-lease"
)
View Source
const (
	// NodeLeaseDurationSeconds is the duration of a node lease in seconds.
	NodeLeaseDurationSeconds = 40
	// NodeLeaseUpdatePeriodSeconds is the period of updating a node lease in seconds.
	NodeLeaseUpdatePeriodSeconds = 10
	// NodeLeaseMaxRetryTimes is the maximum number of times to retry updating a node lease.
	NodeLeaseMaxRetryTimes = 5
)
View Source
const (
	TrackSceneVPodDeploy = "vpod_deploy"
)

TrackSceneVPodDeploy is a constant string used to track the deployment of a vPod.

View Source
const (
	VNodePrefix = "vnode"
)

VNodePrefix is a constant string used to prefix vnode names.

Variables

This section is empty.

Functions

This section is empty.

Types

type BizState added in v0.3.4

type BizState string

BizState is the state of a container, will set to pod state and show on k8s

const (
	// BizStateResolved means container starting
	BizStateResolved BizState = "RESOLVED" // Waiting
	// BizStateUnResolved means uninstall succeed
	BizStateUnResolved BizState = "UNRESOLVED" // -> Terminated
	// BizStateActivated means container ready
	BizStateActivated BizState = "ACTIVATED" // -> Running
	// BizStateDeactivated means container down or broken
	BizStateDeactivated BizState = "DEACTIVATED" // -> Waiting
	// BizStateBroken means install or uninstall failed
	BizStateBroken BizState = "BROKEN" // Waiting
	// BizStateStopped means biz stopped
	BizStateStopped BizState = "STOPPED" // Terminated
)

BizStateActivated, BizStateResolved, BizStateDeactivated, and ContainerStateWaiting are constant BizState values representing different states of a container.

type BizStatusData added in v0.3.4

type BizStatusData struct {
	Key        string    // Key generated by tunnel, must be the same as Tunnel GetBizUniqueKey of same container
	Name       string    // Container name
	PodKey     string    // Key of pod which contains this container ,you can set it to PodKeyAll to present a shared container
	State      string    // State of the biz
	ChangeTime time.Time // Time of state change
	Reason     string    // Reason for state change
	Message    string    // Message for state change
}

BizStatusData is the status data of a container

type BuildVNodeConfig added in v0.2.0

type BuildVNodeConfig struct {
	Client            client.Client     // Runtime client instance
	KubeCache         cache.Cache       // Cache of kube resources
	NodeIP            string            // IP of the node
	NodeHostname      string            // Hostname of the node
	NodeName          string            // NodeName of the node
	NodeVersion       string            // NodeVersion of the node
	VPodType          string            // VPodType of the node
	ClusterName       string            // ClusterName of the node
	Env               string            // Environment of the node
	CustomTaints      []v1.Taint        // Custom taints set by the tunnel
	CustomLabels      map[string]string // Custom labels set by the tunnel
	CustomAnnotations map[string]string // Custom annotations set by the tunnel
	WorkerNum         int               // Worker num, if num is 1, means execute Container events serially
}

type BuildVNodeControllerConfig added in v0.2.0

type BuildVNodeControllerConfig struct {
	KubeClient       client.Client // Runtime client instance
	KubeCache        cache.Cache   // Cache of kube resources
	ClientID         string        // Identity of vk instance, recommended to set it to pod name
	Env              string        // Environment of the vk instance
	VPodType         string        // VPod special value of model.LabelKeyOfComponent
	IsCluster        bool          // Whether the deployment is in a cluster
	WorkloadMaxLevel int           // Maximum workload level
	VNodeWorkerNum   int           // VNode container event processor worker num, default 1, means execute Container events serially
}

type ErrorCode added in v0.2.0

type ErrorCode string
const (
	CodeSuccess               ErrorCode = "00000"
	CodeTimeout               ErrorCode = "00001"
	CodeContainerStartTimeout ErrorCode = "00002"
	CodeContainerStartFailed  ErrorCode = "01002"
	CodeContainerStopFailed   ErrorCode = "01003"
)

CodeSuccess, CodeTimeout, CodeContainerStartTimeout, CodeContainerStartFailed, and CodeContainerStopFailed are constant ErrorCode values representing different error scenarios.

type NetworkInfo

type NetworkInfo struct {
	NodeIP   string // IP address of the node
	HostName string // Hostname of the node
}

NetworkInfo is the network of vnode, will be set into node addresses

type NodeInfo added in v0.2.0

type NodeInfo struct {
	Metadata          NodeMetadata      // Metadata of the node
	NetworkInfo       NetworkInfo       // Network information of the node
	CustomTaints      []v1.Taint        // Custom taints set by the tunnel
	CustomLabels      map[string]string // Custom labels set by the tunnel
	CustomAnnotations map[string]string // Custom annotations set by the tunnel
	State             NodeState         // Current state of the vnode
}

NodeInfo is the data of node info.

type NodeMetadata added in v0.2.0

type NodeMetadata struct {
	Name        string // Name of the vnode
	Version     string // Version of the vnode
	ClusterName string // ClusterName of the cluster the vnode belongs to
}

NodeMetadata is the base data of a vnode, will be transfer to default labels of a vnode

type NodeResource added in v0.2.0

type NodeResource struct {
	Capacity    resource.Quantity // Capacity of the node
	Allocatable resource.Quantity // Allocatable resources of the node
}

NodeResource is the data of node resource

type NodeState added in v0.3.5

type NodeState string

NodeState is the node curr status

const (
	// NodeStateActivated node activated, will start vnode if not being started
	NodeStateActivated NodeState = "ACTIVATED"

	// NodeStateDeactivated node deactivated, will shut down vnode if started
	NodeStateDeactivated NodeState = "DEACTIVATED"
)

NodeStateActivated and NodeStateDeactivated are constant NodeState values representing the activation or deactivation of a node.

type NodeStatusData added in v0.2.0

type NodeStatusData struct {
	Resources         map[v1.ResourceName]NodeResource // Resources of the node
	CustomLabels      map[string]string                // Custom labels set by the tunnel
	CustomAnnotations map[string]string                // Custom annotations set by the tunnel
	CustomConditions  []v1.NodeCondition               // Custom conditions set by the tunnel
}

NodeStatusData is the status of a node, you can set some custom attributes in this data structure

type QueryBaselineRequest added in v0.3.5

type QueryBaselineRequest struct {
	Name         string            `json:"name"`         // Name to filter by
	Version      string            `json:"version"`      // Version to filter by
	CustomLabels map[string]string `json:"customLabels"` // Additional label filters
}

QueryBaselineRequest is the request parameters of query baseline func Used to query baseline configuration with filters

Jump to

Keyboard shortcuts

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