From e2e39358969b920d6a456f2acac98e532382e851 Mon Sep 17 00:00:00 2001 From: Malte Poll <1780588+malt3@users.noreply.github.com> Date: Fri, 26 Jan 2024 16:37:36 +0100 Subject: [PATCH] image: use different replication regions for SNP and TDX --- internal/osimage/uplosi/uplosiupload.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/internal/osimage/uplosi/uplosiupload.go b/internal/osimage/uplosi/uplosiupload.go index 9ef43d7b1..0ef421645 100644 --- a/internal/osimage/uplosi/uplosiupload.go +++ b/internal/osimage/uplosi/uplosiupload.go @@ -208,6 +208,7 @@ func awsParseAMIARN(arn string) (region string, amiID string, retErr error) { } func extendAzureConfig(azureConfig map[string]any, version versionsapi.Version, attestationVariant string, timestamp time.Time) { + azureConfig["replicationRegions"] = azureReplicationRegions(attestationVariant) azureConfig["attestationVariant"] = attestationVariant azureConfig["sharedImageGallery"] = azureGalleryName(version, attestationVariant) azureConfig["imageDefinitionName"] = azureImageOffer(version) @@ -247,6 +248,16 @@ func azureImageOffer(version versionsapi.Version) string { return version.Ref() + "-" + version.Stream() } +func azureReplicationRegions(attestationVariant string) []string { + switch attestationVariant { + case "azure-tdx": + return []string{"northeurope", "westeurope", "centralus", "eastus2"} + case "azure-sev-snp": + return []string{"northeurope", "westeurope", "germanywestcentral", "eastus", "westus", "southeastasia"} + } + return nil +} + func extendGCPConfig(gcpConfig map[string]any, version versionsapi.Version, attestationVariant string) { gcpConfig["imageFamily"] = gcpImageFamily(version) gcpConfig["imageName"] = gcpImageName(version, attestationVariant)