From d3469e5d80d6a502a59867979713781c87573c7b Mon Sep 17 00:00:00 2001 From: mrrishi Date: Sun, 8 Dec 2024 21:06:08 +0530 Subject: [PATCH] feat bottlerocket --- internal/controller/cluster.go | 1 + internal/controller/controller.go | 4 ++++ pkg/providerConfigs/detokenize.go | 1 + pkg/providerConfigs/types.go | 1 + pkg/types/cluster.go | 3 ++- 5 files changed, 9 insertions(+), 1 deletion(-) diff --git a/internal/controller/cluster.go b/internal/controller/cluster.go index 3c1387a9..9764fc6d 100644 --- a/internal/controller/cluster.go +++ b/internal/controller/cluster.go @@ -255,6 +255,7 @@ func (clctrl *ClusterController) CreateTokens(kind string) interface{} { gitopsTemplateTokens.Kubeconfig = clctrl.ProviderConfig.Kubeconfig gitopsTemplateTokens.KubefirstArtifactsBucket = clctrl.KubefirstArtifactsBucketName gitopsTemplateTokens.AtlantisWebhookURL = clctrl.AtlantisWebhookURL + gitopsTemplateTokens.AMIType = clctrl.AMIType if clctrl.ECR { gitopsTemplateTokens.ContainerRegistryURL = fmt.Sprintf("%s.dkr.ecr.%s.amazonaws.com", *iamCaller.Account, clctrl.CloudRegion) diff --git a/internal/controller/controller.go b/internal/controller/controller.go index cefb0470..9e4db2bb 100644 --- a/internal/controller/controller.go +++ b/internal/controller/controller.go @@ -62,6 +62,7 @@ type ClusterController struct { K3sAuth types.K3sAuth AwsAccessKeyID string AwsSecretAccessKey string + AMIType string NodeType string NodeCount int PostInstallCatalogApps []types.GitopsCatalogApp @@ -227,6 +228,9 @@ func (clctrl *ClusterController) InitController(def *types.ClusterDefinition) er clctrl.ECR = def.ECR + if def.CloudProvider == "aws" { + clctrl.AMIType = def.AMIType + } if def.GitopsTemplateBranch != "" { clctrl.GitopsTemplateBranch = def.GitopsTemplateBranch } else { diff --git a/pkg/providerConfigs/detokenize.go b/pkg/providerConfigs/detokenize.go index 86213192..accf575d 100644 --- a/pkg/providerConfigs/detokenize.go +++ b/pkg/providerConfigs/detokenize.go @@ -83,6 +83,7 @@ func detokenizeGitops(tokens *GitopsDirectoryValues, gitProtocol string, useClou newContents = strings.ReplaceAll(newContents, "", strconv.Itoa(tokens.NodeCount)) // AWS + newContents = strings.ReplaceAll(newContents, "", tokens.AMIType) newContents = strings.ReplaceAll(newContents, "", tokens.AwsAccountID) newContents = strings.ReplaceAll(newContents, "", tokens.AwsIamArnAccountRoot) newContents = strings.ReplaceAll(newContents, "", tokens.AwsNodeCapacityType) diff --git a/pkg/providerConfigs/types.go b/pkg/providerConfigs/types.go index a2c56eb5..f9e23255 100644 --- a/pkg/providerConfigs/types.go +++ b/pkg/providerConfigs/types.go @@ -50,6 +50,7 @@ type GitopsDirectoryValues struct { AwsKmsKeyID string AwsNodeCapacityType string AwsAccountID string + AMIType string AzureStorageResourceGroup string AzureStorageContainerName string diff --git a/pkg/types/cluster.go b/pkg/types/cluster.go index 043e78e6..369f38ae 100644 --- a/pkg/types/cluster.go +++ b/pkg/types/cluster.go @@ -36,7 +36,8 @@ type ClusterDefinition struct { GitProtocol string `json:"git_protocol" binding:"required,oneof=ssh https"` // AWS - ECR bool `json:"ecr,omitempty"` + ECR bool `json:"ecr,omitempty"` + AMIType string `json:"ami_type" binding:"required"` // Azure AzureDNSZoneResourceGroup string `json:"azure_dns_zone_resource_group,omitempty"`