From a1f4a947c5d177a32602eaafaa900ac82a9dd3ee Mon Sep 17 00:00:00 2001 From: Richard Case Date: Wed, 17 Jan 2024 14:44:05 +0000 Subject: [PATCH] fix: installation on eks There is an issue installing Rancher Turtles on EKS using the chart as the kubernetes version in EKS doesn't follow semver. For example, EKS will return a version like `v1.26.12-eks-5e0fdde` and this means that we then try and pull the `docker.io/rancher/kubectl:v1.26.12-eks-5e0fdde` image when performing the cleanup tasks. The function to strip the suffix from the kubernetes version has been updated to handle EKS, AKS and GKE. Signed-off-by: Richard Case --- charts/rancher-turtles/templates/_helpers.tpl | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/charts/rancher-turtles/templates/_helpers.tpl b/charts/rancher-turtles/templates/_helpers.tpl index c364b26f..f9b0ebe6 100644 --- a/charts/rancher-turtles/templates/_helpers.tpl +++ b/charts/rancher-turtles/templates/_helpers.tpl @@ -1,9 +1,22 @@ {{/* This removes the part after the + in the kubernetes version string. v1.27.4+k3s1 -> v1.27.4 + v1.26.12-eks-5e0fdde -> v1.26.12 + v1.26.12-gke.1 -> v1.26.12 v1.28.0 -> v1.28.0 */}} {{- define "strippedKubeVersion" -}} -{{- $parts := split "+" .Capabilities.KubeVersion.Version -}} -{{- print $parts._0 -}} + {{- if (.Capabilities.KubeVersion.Version | contains "-eks-") -}} + {{- $parts := split "-eks-" .Capabilities.KubeVersion.Version -}} + {{- print $parts._0 -}} + {{- else if (.Capabilities.KubeVersion.Version | contains "-gke.") -}} + {{- $parts := split "-gke." .Capabilities.KubeVersion.Version -}} + {{- print $parts._0 -}} + {{- else if (.Capabilities.KubeVersion.Version | contains "-aks") -}} + {{- $parts := split "-aks" .Capabilities.KubeVersion.Version -}} + {{- print $parts._0 -}} + {{- else -}} + {{- $parts := split "+" .Capabilities.KubeVersion.Version -}} + {{- print $parts._0 -}} + {{- end -}} {{- end -}}