Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug Report]: Missing properties for Compute/Gallery for Bicep when creating images #4540

Open
Binimow opened this issue Apr 26, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Binimow
Copy link

Binimow commented Apr 26, 2024

Describe the bug

When trying to create a Compute/Gallery with images in array, the properties "isAcceleratedNetworkSupported" and "isHibernateSupported" aren't passed.

They exist as parameters for Compute/Gallery/Image but when comes the moment to create images from Compute/Gallery the properties are just not passed.

It is a fairly simple bug to solve, as a lot of the stuff surrounding the solution is already in place.

To reproduce

Deploy a Compute/Gallery via Bicep with an image array specifying isAccelereatedNetworkSupported to true.

You will that the property is not applied!

I believe the explanation of this bug is quite simple. The Compute/Gallery main.json doesn't pass the property.

Screenshot 2024-04-26 at 9 25 49 AM

galleries_images is missing the params for "isAcceleratedNetworkSupported" and "isHibernateSupported".

Code snippet

param galImages = [
  {
    hyperVGeneration: 'V2'
    maxRecommendedMemory: 16
    maxRecommendedvCPUs: 8
    minRecommendedMemory: 4
    minRecommendedvCPUs: 2
    isAcceleratedNetworkSupported: true
    name: 'xrserver-devkit'
    offer: 'xrserver-devkit'
    osState: 'Generalized'
    securityType: 'TrustedLaunch'
    osType: 'Linux'
    publisher: 'example'
    sku: 'xrserver_devkit'
  }
  {
    hyperVGeneration: 'V2'
    maxRecommendedMemory: 16
    maxRecommendedvCPUs: 8
    minRecommendedMemory: 4
    minRecommendedvCPUs: 2
    isAcceleratedNetworkSupported: true
    name: 'xrserver-scaleset'
    offer: 'xrserver-scaleset'
    securityType: 'TrustedLaunch'
    osState: 'Generalized'
    osType: 'Linux'
    publisher: 'example'
    sku: 'xrserver_scaleset'
  }
]

module gallery '../../modules/compute/gallery/main.bicep' = {
  name: '${uniqueString(deployment().name, location)}-dev-cgcom'
  params: {
    name: galName
    location: location
    enableDefaultTelemetry: true
    images: galImages
    roleAssignments: [
      {
        principalIds: [
          galUserAssignedIdentity.outputs.principalId
        ]
        principalType: 'ServicePrincipal'
        roleDefinitionIdOrName: 'Reader'
      }
    ]
    lock: ''
  }
}

Relevant log output

No response

@Binimow Binimow added the bug Something isn't working label Apr 26, 2024
@Binimow
Copy link
Author

Binimow commented Apr 26, 2024

Here is the fix, but I am not able to create a branch on the origin.

// Images
module galleries_images 'image/main.bicep' = [for (image, index) in images: {
  name: '${uniqueString(deployment().name, location)}-Gallery-Image-${index}'
  params: {
    name: image.name
    galleryName: gallery.name
    osType: contains(image, 'osType') ? image.osType : 'Windows'
    osState: contains(image, 'osState') ? image.osState : 'Generalized'
    publisher: contains(image, 'publisher') ? image.publisher : 'MicrosoftWindowsServer'
    offer: contains(image, 'offer') ? image.offer : 'WindowsServer'
    sku: contains(image, 'sku') ? image.sku : '2019-Datacenter'
    minRecommendedvCPUs: contains(image, 'minRecommendedvCPUs') ? image.minRecommendedvCPUs : 1
    maxRecommendedvCPUs: contains(image, 'maxRecommendedvCPUs') ? image.maxRecommendedvCPUs : 4
    minRecommendedMemory: contains(image, 'minRecommendedMemory') ? image.minRecommendedMemory : 4
    maxRecommendedMemory: contains(image, 'maxRecommendedMemory') ? image.maxRecommendedMemory : 16
    hyperVGeneration: contains(image, 'hyperVGeneration') ? image.hyperVGeneration : 'V1'
    securityType: contains(image, 'securityType') ? image.securityType : 'Standard'
    isHibernateSupported: contains(image, 'isHibernateSupported') ? image.isHibernateSupported : 'false'
    isAcceleratedNetworkSupported: contains(image, 'isAcceleratedNetworkSupported') ? image.isisAcceleratedNetworkSupported : 'false'
    description: contains(image, 'description') ? image.description : ''
    eula: contains(image, 'eula') ? image.eula : ''
    privacyStatementUri: contains(image, 'privacyStatementUri') ? image.privacyStatementUri : ''
    releaseNoteUri: contains(image, 'releaseNoteUri') ? image.releaseNoteUri : ''
    productName: contains(image, 'productName') ? image.productName : ''
    planName: contains(image, 'planName') ? image.planName : ''
    planPublisherName: contains(image, 'planPublisherName') ? image.planPublisherName : ''
    endOfLife: contains(image, 'endOfLife') ? image.endOfLife : ''
    excludedDiskTypes: contains(image, 'excludedDiskTypes') ? image.excludedDiskTypes : []
    roleAssignments: contains(image, 'roleAssignments') ? image.roleAssignments : []
    tags: image.?tags ?? tags
    enableDefaultTelemetry: enableReferencedModulesTelemetry
  }
}]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Needs triage
Development

No branches or pull requests

2 participants