node-operator: fix setting Azure node image (#2788)

This commit is contained in:
Adrian Stobbe 2024-01-03 12:12:16 +01:00 committed by GitHub
parent 45479b307e
commit 9826ab2e89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -165,7 +165,7 @@ func imageReferenceFromImage(img string) (*armcompute.ImageReference, error) {
} }
// expecting image to not be a marketplace image // expecting image to not be a marketplace image
if strings.HasPrefix(img, "/CommunityGalleries") { if strings.HasPrefix(strings.ToLower(img), "/communitygalleries") {
ref.CommunityGalleryImageID = to.Ptr(img) ref.CommunityGalleryImageID = to.Ptr(img)
} else { } else {
ref.ID = to.Ptr(img) ref.ID = to.Ptr(img)

View File

@ -49,13 +49,13 @@ func TestGetScalingGroupImage(t *testing.T) {
VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{ VirtualMachineProfile: &armcompute.VirtualMachineScaleSetVMProfile{
StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{ StorageProfile: &armcompute.VirtualMachineScaleSetStorageProfile{
ImageReference: &armcompute.ImageReference{ ImageReference: &armcompute.ImageReference{
CommunityGalleryImageID: to.Ptr("/CommunityGalleries/gallery-name/Images/image-name/Versions/1.2.3"), CommunityGalleryImageID: to.Ptr("/communityGalleries/gallery-name/Images/image-name/Versions/1.2.3"),
}, },
}, },
}, },
}, },
}, },
wantImage: "/CommunityGalleries/gallery-name/Images/image-name/Versions/1.2.3", wantImage: "/communityGalleries/gallery-name/Images/image-name/Versions/1.2.3",
}, },
"splitting scalingGroupID fails": { "splitting scalingGroupID fails": {
scalingGroupID: "invalid", scalingGroupID: "invalid",
@ -299,8 +299,8 @@ func TestImageReferenceFromImage(t *testing.T) {
wantID: to.Ptr("/subscriptions/0d202bbb-4fa7-4af8-8125-58c269a05435/resourceGroups/constellation-images/providers/Microsoft.Compute/galleries/Constellation/images/constellation/versions/1.5.0"), wantID: to.Ptr("/subscriptions/0d202bbb-4fa7-4af8-8125-58c269a05435/resourceGroups/constellation-images/providers/Microsoft.Compute/galleries/Constellation/images/constellation/versions/1.5.0"),
}, },
"Community": { "Community": {
img: "/CommunityGalleries/ConstellationCVM-728bd310-e898-4450-a1ed-21cf2fb0d735/Images/feat-azure-cvm-sharing/Versions/2022.0826.084922", img: "/communityGalleries/ConstellationCVM-728bd310-e898-4450-a1ed-21cf2fb0d735/Images/feat-azure-cvm-sharing/Versions/2022.0826.084922",
wantCommunityID: to.Ptr("/CommunityGalleries/ConstellationCVM-728bd310-e898-4450-a1ed-21cf2fb0d735/Images/feat-azure-cvm-sharing/Versions/2022.0826.084922"), wantCommunityID: to.Ptr("/communityGalleries/ConstellationCVM-728bd310-e898-4450-a1ed-21cf2fb0d735/Images/feat-azure-cvm-sharing/Versions/2022.0826.084922"),
}, },
"Marketplace": { "Marketplace": {
img: "constellation-marketplace-image://Azure?offer=constellation&publisher=edgelesssystems&sku=constellation&version=1.2.3", img: "constellation-marketplace-image://Azure?offer=constellation&publisher=edgelesssystems&sku=constellation&version=1.2.3",