Documentation
¶
Index ¶
- Constants
- Variables
- func CPUManagerRegister(ctx context.Context, management *config.Management, options config.Options) error
- func DownRegister(ctx context.Context, management *config.Management, _ config.Options) error
- func GetCPUManagerRunningJobsOnNodes(jobCache ctlbatchv1.JobCache, nodeNames []string) ([]*batchv1.Job, error)
- func IsManagementRole(node *corev1.Node) bool
- func IsWitnessNode(node *corev1.Node, isManagement bool) bool
- func MaintainRegister(ctx context.Context, management *config.Management, _ config.Options) error
- func PromoteRegister(ctx context.Context, management *config.Management, options config.Options) error
- func RemoveRegister(ctx context.Context, management *config.Management, _ config.Options) error
- func VolumeDetachRegister(ctx context.Context, management *config.Management, _ config.Options) error
- type CPUManagerPolicy
- type CPUManagerStatus
- type CPUManagerUpdateStatus
- type PromoteHandler
Constants ¶
const ( CPUManagerControllerName = "cpu-manager-controller" // policy CPUManagerStaticPolicy CPUManagerPolicy = "static" CPUManagerNonePolicy CPUManagerPolicy = "none" // status CPUManagerRequestedStatus CPUManagerStatus = "requested" CPUManagerRunningStatus CPUManagerStatus = "running" CPUManagerSuccessStatus CPUManagerStatus = "success" CPUManagerFailedStatus CPUManagerStatus = "failed" CPUManagerRootMountPath string = "/host" CPUManagerScriptMountPath string = "/harvester-helpers" CPUManagerScriptPath string = CPUManagerScriptMountPath + "/cpu-manager.sh" CPUManagerWaitLabelTimeoutInSec int64 = 300 // 5 min CPUManagerJobTimeoutInSec int64 = CPUManagerWaitLabelTimeoutInSec * 2 CPUManagerJobTTLInSec int32 = 86400 * 7 // 7 day CPUManagerJobPrefix string = "update-cpu-manager" )
const ( MaintainStatusAnnotationKey = "harvesterhci.io/maintain-status" MaintainStatusComplete = "completed" MaintainStatusRunning = "running" )
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 ¶
var ( ConditionJobComplete = condition.Cond(batchv1.JobComplete) ConditionJobFailed = condition.Cond(batchv1.JobFailed) )
Functions ¶
func CPUManagerRegister ¶ added in v1.4.0
func CPUManagerRegister(ctx context.Context, management *config.Management, options config.Options) error
CPUManagerRegister registers the node controller
func DownRegister ¶ added in v1.1.2
DownRegister registers a controller to delete VMI when node is down
func GetCPUManagerRunningJobsOnNodes ¶ added in v1.4.0
func IsManagementRole ¶ added in v1.4.0
IsManagementRole determine whether it's an management node based on the node's label. Management Role included: master, control-plane, etcd
func MaintainRegister ¶
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
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 CPUManagerPolicy ¶ added in v1.4.0
type CPUManagerPolicy string
type CPUManagerStatus ¶ added in v1.4.0
type CPUManagerStatus string
type CPUManagerUpdateStatus ¶ added in v1.4.0
type CPUManagerUpdateStatus struct { Policy CPUManagerPolicy `json:"policy"` Status CPUManagerStatus `json:"status"` JobName string `json:"jobName,omitempty"` }
func GetCPUManagerUpdateStatus ¶ added in v1.4.0
func GetCPUManagerUpdateStatus(jsonString string) (*CPUManagerUpdateStatus, error)
type PromoteHandler ¶
type PromoteHandler struct {
// contains filtered or unexported fields
}
PromoteHandler
func (*PromoteHandler) OnJobChanged ¶
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 ¶
OnJobRemove If the running promote job is deleted, the node's promote status will be marked as unknown
func (*PromoteHandler) OnNodeChanged ¶
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.