Files
monok8s/clitools/pkg/node/context.go
2026-03-30 17:40:27 +08:00

57 lines
1.7 KiB
Go

package node
import (
"context"
monov1alpha1 "undecided.project/monok8s/pkg/apis/monok8s/v1alpha1"
"undecided.project/monok8s/pkg/system"
)
type Step func(context.Context, *NodeContext) error
type NodeContext struct {
Config *monov1alpha1.MonoKSConfig
SystemRunner *system.Runner
LocalClusterState *LocalClusterState
BootstrapState *BootstrapState
}
type LocalMembershipKind string
const (
LocalMembershipFresh LocalMembershipKind = "fresh"
LocalMembershipExistingWorker LocalMembershipKind = "existing-worker"
LocalMembershipExistingControlPlane LocalMembershipKind = "existing-control-plane"
LocalMembershipPartial LocalMembershipKind = "partial"
)
type LocalClusterState struct {
HasAdminKubeconfig bool
HasKubeletKubeconfig bool
MembershipKind LocalMembershipKind
}
type BootstrapAction string
const (
BootstrapActionInitControlPlane BootstrapAction = "init-control-plane"
BootstrapActionJoinControlPlane BootstrapAction = "join-control-plane"
BootstrapActionManageControlPlane BootstrapAction = "manage-control-plane"
BootstrapActionJoinWorker BootstrapAction = "join-worker"
BootstrapActionManageWorker BootstrapAction = "manage-worker"
BootstrapActionReconcileControlPlane BootstrapAction = "reconcile-control-plane"
BootstrapActionUpgradeControlPlane BootstrapAction = "upgrade-control-plane"
BootstrapActionReconcileWorker BootstrapAction = "reconcile-worker"
BootstrapActionUpgradeWorker BootstrapAction = "upgrade-worker"
)
type BootstrapState struct {
Action BootstrapAction
DetectedClusterVersion string
UnsupportedWorkerVersionSkew bool
VersionSkewReason string
}