penguin/monok8s

k8s image for Mono Gateway Dev Kit

clitools/pkg/node/context.go

raw ยท 1716 bytes

package node

import (
	"context"

	monov1alpha1 "example.com/monok8s/pkg/apis/monok8s/v1alpha1"
	"example.com/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
}