From f719f53fa3249696be00ed5d0ed386acca8d6fd4 Mon Sep 17 00:00:00 2001 From: oscar Date: Wed, 1 Feb 2023 12:44:59 +0100 Subject: [PATCH] bug: fail fast with Ubuntu 22.04 clusters --- .../resources/operations/clustertasks.go | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/backend/resources/operations/clustertasks.go b/lib/backend/resources/operations/clustertasks.go index 92239eda3..565ba0eae 100755 --- a/lib/backend/resources/operations/clustertasks.go +++ b/lib/backend/resources/operations/clustertasks.go @@ -183,17 +183,34 @@ func (instance *Cluster) taskCreateCluster(inctx context.Context, params interfa if req.Flavor == clusterflavor.K8S { lowerOS := strings.ToLower(req.GatewaysDef.Image) if strings.Contains(lowerOS, "centos 7") { - return nil, fail.NewError("K8s with CentOS 7 not supported") + return nil, fail.NewError("Sorry, K8s with CentOS 7 not supported") } lowerOS = strings.ToLower(req.MastersDef.Image) if strings.Contains(lowerOS, "centos 7") { - return nil, fail.NewError("K8s with CentOS 7 not supported") + return nil, fail.NewError("Sorry, K8s with CentOS 7 not supported") } lowerOS = strings.ToLower(req.NodesDef.Image) if strings.Contains(lowerOS, "centos 7") { - return nil, fail.NewError("K8s with CentOS 7 not supported") + return nil, fail.NewError("Sorry, K8s with CentOS 7 not supported") + } + } + + if req.Flavor != 0 { + lowerOS := strings.ToLower(req.GatewaysDef.Image) + if strings.Contains(lowerOS, "ubuntu 22.04") { + return nil, fail.NewError("Sorry, Ubuntu 22.04 not supported") + } + + lowerOS = strings.ToLower(req.MastersDef.Image) + if strings.Contains(lowerOS, "ubuntu 22.04") { + return nil, fail.NewError("Sorry, Ubuntu 22.04 not supported") + } + + lowerOS = strings.ToLower(req.NodesDef.Image) + if strings.Contains(lowerOS, "ubuntu 22.04") { + return nil, fail.NewError("Sorry, Ubuntu 22.04 not supported") } }