Simplify Cluster spec (#193)

* removed some required parameters, adding defaults

* add hostVersion in Status field

* fix tests
This commit is contained in:
Enrico Candino
2025-01-21 21:19:44 +01:00
committed by GitHub
parent 3f49593f96
commit b0aa22b2f4
6 changed files with 218 additions and 9 deletions
+13 -1
View File
@@ -27,9 +27,21 @@ var Backoff = wait.Backoff{
Jitter: 0.1,
}
// K3SImage returns the rancher/k3s image tagged with the specified Version.
// If Version is empty it will use with the same k8s version of the host cluster,
// stored in the Status object. It will return the untagged version as last fallback.
func K3SImage(cluster *v1alpha1.Cluster) string {
return k3SImageName + ":" + cluster.Spec.Version
if cluster.Spec.Version != "" {
return k3SImageName + ":" + cluster.Spec.Version
}
if cluster.Status.HostVersion != "" {
return k3SImageName + ":" + cluster.Status.HostVersion
}
return k3SImageName
}
func nodeAddress(node *v1.Node) string {
var externalIP string
var internalIP string