INNER CODE UNIT · Go

compareVersionNumbers

kubesphere/kubekey · builtin/core/upgrade_path.go:258

func compareVersionNumbers(a, b string) int {
	va, aerr := semver.NewVersion(a)
	vb, berr := semver.NewVersion(b)
	if aerr == nil && berr == nil {
		return va.Compare(vb)
	}
	// Fallback: lexical ordering on unparseable values (alphabetical, so "v3" <
	// "v10" is slightly off, but such values should not appear in the version set).
	return strings.Compare(a, b)
}

// ValidateTerminalVersions checks that every per-minor version field the user
// explicitly pinned in the terminal config is not lower than the value required by
// any intermediate hop of an auto-step upgrade.
//
// Component upgrades (etcd, helm, sandbox, containerd, calico, ...) are
// monotonic: the auto-step path only ever advances them, and kubeadm/etcd upgrades
// refuse to downgrade. If a field pinned in the terminal config is lower than the

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…