Documentation
¶
Overview ¶
Package executor carries out an upgrade or rollback. It runs as a detached kubesolo process (kubesolo --upgrade-executor=<job>), outside the KubeSolo service it stops and restarts, and holds the upgrade lock from start to finish.
It needs SQLite and a Kubernetes client, so only the kubesolo binary links it. The parts kubesoloctl shares live in internal/upgrade.
Index ¶
- Constants
- func AgentProblem(ctx context.Context, kubeconfig string, configured bool) string
- func CheckDatastore(path string) error
- func CheckHealth(ctx context.Context, kubeconfig, wantVersion string) upgrade.Health
- func CloneFile(src, dst string, mode os.FileMode) error
- func Main(jobFile string) int
- func QuickCheck(path string) error
- func SnapshotDatastore(src, dst string) error
- func Summary(h upgrade.Health) string
Constants ¶
const ( CheckAPIServer = "apiserver" CheckNode = "node" CheckVersion = "version" CheckDNS = "coredns" )
Health check names, as they appear in upgrade.Health.Checks.
Variables ¶
This section is empty.
Functions ¶
func AgentProblem ¶ added in v1.2.3
AgentProblem says why the Portainer agent is not running: its pod is not ready, or does not yet run the Deployment's current template. It is "" when the agent is running, or when there is none and none is configured. configured is whether KubeSolo's configuration sets up an agent; an agent Deployment without one is left from an earlier configuration, which the answer says, with what to do.
func CheckDatastore ¶
CheckDatastore is the datastore dry-run, run by the *new* binary against a copy of the datastore: it opens the copy exactly as kine will, which applies kine's schema setup and data migration, then checks the result is intact and readable.
It catches the one failure that makes a rollback ugly — a binary that cannot open, or corrupts, the store it is about to be started on — while the real datastore is untouched and the old binary is still running.
func CheckHealth ¶
CheckHealth is KubeSolo's own view of whether it works: the API server is ready, the node is Ready, and CoreDNS — the first workload KubeSolo deploys, and so a fair test that the runtime, the network and the kubelet all work — has a ready pod.
wantVersion, when set, must be the KubeSolo version the kubelet reports. The node object outlives the process, so a Ready node alone does not show which binary is behind it.
func CloneFile ¶
CloneFile copies src to dst, sharing blocks when the filesystem supports it (FICLONE: btrfs, XFS with reflink, bcachefs, overlayfs on those). A clone is instant and takes no space until either file changes. Elsewhere it is an ordinary copy. dst is synced either way.
func Main ¶
Main runs the job in jobFile and returns the process exit code. It is the whole of `kubesolo --upgrade-executor`.
func QuickCheck ¶
QuickCheck runs SQLite's quick_check on a database file.
func SnapshotDatastore ¶
SnapshotDatastore writes a consistent copy of the live datastore at src to dst while kine keeps running.
VACUUM INTO reads the database inside one transaction, so the copy is a single point in time even with kine writing, and it folds the WAL in: the result is one self-contained file with no -wal or -shm to keep beside it. Copying state.db alone would lose every transaction still in the WAL.
Types ¶
This section is empty.