node

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 14, 2024 License: Apache-2.0 Imports: 36 Imported by: 4

Documentation

Index

Constants

View Source
const (
	MaintainStatusAnnotationKey = "harvesterhci.io/maintain-status"
	MaintainStatusComplete      = "completed"
	MaintainStatusRunning       = "running"
)
View Source
const (
	KubeNodeRoleLabelPrefix      = "node-role.kubernetes.io/"
	KubeMasterNodeLabelKey       = KubeNodeRoleLabelPrefix + "master"
	KubeControlPlaneNodeLabelKey = KubeNodeRoleLabelPrefix + "control-plane"
	KubeEtcdNodeLabelKey         = KubeNodeRoleLabelPrefix + "etcd"

	// promote rules:
	// w/o role definition: promote the ready worker node randomly
	// w/ role definition:
	//   1. promote the witness node to etcd node. (maxmimum: 1)
	//   2. promote the mgmt node to mgmt node.
	//   3. do not promote the worker node.
	HarvesterNodeRoleLabelPrefix = "node-role.harvesterhci.io/"
	HarvesterWitnessNodeLabelKey = HarvesterNodeRoleLabelPrefix + "witness"
	HarvesterMgmtNodeLabelKey    = HarvesterNodeRoleLabelPrefix + "management"
	HarvesterWorkerNodeLabelKey  = HarvesterNodeRoleLabelPrefix + "worker"

	HarvesterLabelAnnotationPrefix      = "harvesterhci.io/"
	HarvesterManagedNodeLabelKey        = HarvesterLabelAnnotationPrefix + "managed"
	HarvesterPromoteNodeLabelKey        = HarvesterLabelAnnotationPrefix + "promote-node"
	HarvesterPromoteStatusAnnotationKey = HarvesterLabelAnnotationPrefix + "promote-status"

	PromoteStatusComplete = "complete"
	PromoteStatusRunning  = "running"
	PromoteStatusUnknown  = "unknown"
	PromoteStatusFailed   = "failed"
)

Variables

View Source
var (
	ConditionJobComplete = condition.Cond(batchv1.JobComplete)
	ConditionJobFailed   = condition.Cond(batchv1.JobFailed)
)

Functions

func DownRegister added in v1.1.2

func DownRegister(ctx context.Context, management *config.Management, _ config.Options) error

DownRegister registers a controller to delete VMI when node is down

func MaintainRegister

func MaintainRegister(ctx context.Context, management *config.Management, _ config.Options) error

MaintainRegister registers the node controller

func PromoteRegister

func PromoteRegister(ctx context.Context, management *config.Management, options config.Options) error

PromoteRegister registers the node controller

func RemoveRegister added in v1.3.0

func RemoveRegister(ctx context.Context, management *config.Management, _ config.Options) error

RemoveRegister registers a controller to remove machine when node is removed

func VolumeDetachRegister added in v1.1.2

func VolumeDetachRegister(ctx context.Context, management *config.Management, _ config.Options) error

VolumeDetachRegister registers the node volume detach controller

Types

type PromoteHandler

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

PromoteHandler

func (*PromoteHandler) OnJobChanged

func (h *PromoteHandler) OnJobChanged(_ string, job *batchv1.Job) (*batchv1.Job, error)

OnJobChanged If the node corresponding to the promote job has been removed, delete the job. If the promote job executes successfully, the node's promote status will be marked as complete and schedulable If the promote job fails, the node's promote status will be marked as failed.

func (*PromoteHandler) OnJobRemove

func (h *PromoteHandler) OnJobRemove(_ string, job *batchv1.Job) (*batchv1.Job, error)

OnJobRemove If the running promote job is deleted, the node's promote status will be marked as unknown

func (*PromoteHandler) OnNodeChanged

func (h *PromoteHandler) OnNodeChanged(_ string, node *corev1.Node) (*corev1.Node, error)

OnNodeChanged automate the upgrade of node roles If the number of managements in the cluster is less than spec number, the harvester oldest node will be automatically promoted to be management.

Jump to

Keyboard shortcuts

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