detect local cluster states

This commit is contained in:
2026-03-29 22:26:54 +08:00
parent ecceff225f
commit 03a5e5bedb
7 changed files with 524 additions and 16 deletions

View File

@@ -7,9 +7,46 @@ import (
"undecided.project/monok8s/pkg/system"
)
type Step func(context.Context, *NodeContext) error
type NodeContext struct {
Config *monov1alpha1.MonoKSConfig
SystemRunner *system.Runner
Config *monov1alpha1.MonoKSConfig
SystemRunner *system.Runner
LocalClusterState *LocalClusterState
BootstrapState *BootstrapState
}
type Step func(context.Context, *NodeContext) error
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"
BootstrapActionJoinWorker BootstrapAction = "join-worker"
BootstrapActionJoinControlPlane BootstrapAction = "join-control-plane"
BootstrapActionReconcileWorker BootstrapAction = "reconcile-worker"
BootstrapActionReconcileControlPlane BootstrapAction = "reconcile-control-plane"
BootstrapActionUpgradeWorker BootstrapAction = "upgrade-worker"
BootstrapActionUpgradeControlPlane BootstrapAction = "upgrade-control-plane"
)
type BootstrapState struct {
Action BootstrapAction
DetectedClusterVersion string
UnsupportedWorkerVersionSkew bool
VersionSkewReason string
}