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

Feature request: Add support for EmptyDir in New-AzContainerGroup command #17410

Closed
jaltin opened this issue Mar 8, 2022 · 14 comments · Fixed by #17802
Closed

Feature request: Add support for EmptyDir in New-AzContainerGroup command #17410

jaltin opened this issue Mar 8, 2022 · 14 comments · Fixed by #17802
Assignees
Labels
Container Instances customer-reported feature-request This issue requires a new behavior in the product in order be resolved. Investigate 🔍 question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@jaltin
Copy link

jaltin commented Mar 8, 2022

Description

I am trying to create ACI with the New-AzContainerGroup command.

I am trying to create a container with an EmptyDir volume mapped, but I can't get it to work.

I looked at the volume mount example at https://docs.microsoft.com/en-us/powershell/module/az.containerinstance/new-azcontainergroup?view=azps-7.3.0#example-6--create-a-container-group-that-mounts-azure-file-volume

However, I found an issue that says that the example is not complete (#17123).

I therefore tried to do the mount with that example as a base instead but I can't get it to work for EmptyDir.

$resourceGroupName = "myresroucegroup"
$containerGroupName = "test-1"
$capacity_cpu = 0.5
$capacity_memory = 1.5
$azure_region = "northeurope"

$volume = New-AzContainerGroupVolumeObject `
    -Name "myvolume"

$mount = New-AzContainerInstanceVolumeMountObject `
    -MountPath "/aci/logs" `
    -Name "myvolume"

$container = New-AzContainerInstanceObject `
    -Name $containerGroupName `
    -Image alpine `
    -VolumeMount $mount `
    -RequestCpu $capacity_cpu `
    -RequestMemoryInGb $capacity_memory

$containerGroup = New-AzContainerGroup `
    -ResourceGroupName $resourceGroupName `
    -Name $containerGroupName `
    -Location $azure_region `
    -Container $container `
    -Volume $volume `
    -RestartPolicy Never

That generates the following error:

image

So either I am not passing the necessary parameters or not doing this right. Can anyone provide a working example?

Related observation - EmptyDir not implemented?

Before posting this issue I also did a search in the repo, and at a first glance it looks like the EmptyDir code is not actually implemented. Or am I misunderstanding the code? See the code line in question here:

Script or Debug output

No response

Environment data

Name                           Value
----                           -----
PSVersion                      7.2.1
PSEdition                      Core
GitCommitId                    7.2.1
OS                             Darwin 21.3.0 Darwin Kernel Version 21.3.0: Wed Jan  5 21:37:58 PST 2022; root:xnu-8019.80.24~20/RELEASE_ARM64_T6000
Platform                       Unix
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
WSManStackVersion              3.0

Module versions

ModuleType Version    PreRelease Name                                ExportedCommands
---------- -------    ---------- ----                                ----------------
Script     2.7.3                 Az.Accounts                         {Add-AzEnvironment, Clear-AzContext, Clear-AzDefault, Connect-AzAccount…}
Script     3.0.1                 Az.ContainerInstance                {Add-AzContainerInstanceOutput, Get-AzContainerGroup, Get-AzContainerInstanceCachedImage, Get-AzContainerInstanceCapability…}

Error output

No response

@jaltin jaltin added needs-triage This is a new issue that needs to be triaged to the appropriate team. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Mar 8, 2022
@ghost ghost added customer-reported and removed needs-triage This is a new issue that needs to be triaged to the appropriate team. labels Mar 8, 2022
@jaltin jaltin changed the title How to mount an EmptyDir with A How to mount an EmptyDir with New-AzContainerGroup command Mar 8, 2022
@jaltin jaltin changed the title How to mount an EmptyDir with New-AzContainerGroup command How to mount an EmptyDir with New-AzContainerGroup command? Mar 8, 2022
@dingmeng-xue
Copy link
Member

@BethanyZhou , could you recollect the reason that we don't support Empty Dir? Is it incorrect on api spec?

@BethanyZhou
Copy link
Contributor

BethanyZhou commented Mar 9, 2022

The type of EmptyDir is defined as object in Swagger. In New-AzContainerGroupVolumeObject, the type of EmptyDir is IAny.

We consider the quality of this parameter may be not high as expected. That's why we hide EmptyDir.

https://github.com/Azure/azure-rest-api-specs/blob/9c2191a0d78b31c711f1a21b597894176cd2e06d/specification/containerinstance/resource-manager/Microsoft.ContainerInstance/stable/2021-09-01/containerInstance.json#L1065-L1069

@jaltin
Copy link
Author

jaltin commented Mar 9, 2022

Thanks for your comments. A couple of thoughts related to them:

Question 1
If you look at the Azur Resource Manager template examples provided, it seems that they just pass in an empty object (see for example https://docs.microsoft.com/en-us/azure/container-instances/container-instances-volume-emptydir). Could that also not be the passed in the call to azure rest api? So in my example volume declaration, it could look something like this:

$volume = New-AzContainerGroupVolumeObject `
    -Name "myvolume" `
    -EmptyDir true 

Question 2
If you enable the -EmptyDir functionality as I suggest in question 1 above, then I suggest an example is also added next to the current example (at https://docs.microsoft.com/en-us/powershell/module/az.containerinstance/new-azcontainergroup?view=azps-7.3.0#example-6--create-a-container-group-that-mounts-azure-file-volume). And if you decide to not implement it, then it would be reasonable to mention that it is not supported on that documentation page.

Thanks!

@BethanyZhou
Copy link
Contributor

Really appreciate for your suggestions.

I will try to pass an empty object to azure rest api first and verify whether it will work as expect. After that, I will update documentation page accordingly.

@jaltin
Copy link
Author

jaltin commented Mar 10, 2022

@BethanyZhou, thanks for giving it a try!

Do you have any idea of when you will be able to try? And if it works, when can it be expected to be rolled out in a future release?

I am asking this because I am depending on the EmptyDir feature in what I am building, and it helps me for my planning if I can have a rough idea about timelines.

Many thanks!

@BethanyZhou
Copy link
Contributor

Sorry for late response.

We are investigating the way to send -EmptyDir as "{}" to backend. In our previous behavior, we treat "{}" as null. And we need confirm with service team to know is there any impact if we send all "{}"s to backend. The estimated time is unclear by far.

@BethanyZhou
Copy link
Contributor

After investigated, we are unable to support sending -EmptyDir as "{}" to backend.

@CaptainFanZzz , could you help update the doc for New-AzContainerGroupVolumeObject to clarify EmptyDir is not supported?

@jaltin
Copy link
Author

jaltin commented Mar 17, 2022

@BethanyZhou,

Thank you for verifying this. It is a real pity this can not be supported in ACI. Especially since it is supported in other components such as Azure Resource Manager template.

Is the reason you can't do it a limit on your side or is it a limit in the rest api?

@BethanyZhou
Copy link
Contributor

I'm sorry for this pity. And I'm happy you have Azure Resource Manager template to workaround this issue.

The limitation is in our side and probably in rest api side.

  • For our side, current logic in our generator will treat null and {} same. This behavior limits us to send {} to backend.
  • For rest api side, We are suspecting service side may report {} is invalid value if we pass {} for some other parameters (may be from other RPs). If true, I think we need a flag in swagger to know whether this parameter could accept '{}'. I mean the flag should tell us whether '{}' is different with null for this parameter.

We are still investigating. Our next step depends on the investigation results. Thinking it wouldn't be a short term work, so we have to clarify EmptyDir is not supported by far.

@jaltin
Copy link
Author

jaltin commented Mar 18, 2022

I'm sorry for this pity. And I'm happy you have Azure Resource Manager template to workaround this issue.

Unfortunately I can't use ARM templates for my implementations, I am dependent on it being added in Powershell (for background, I am starting ACI instances in azure functions using Powershell).

So since you are still investigating, I suggest we do the following:

  1. Rename the title of this issue to 'Feature request: Add support for EmptyDir in New-AzContainerGroup command'. I leave it open so that you can provide updates as you progress with your investigation.
  2. The update to the documentation to mention that EmptyDir is not yet supported is tracked in pull request Update New-AzContainerGroup Example6 #17515.

Does that sound ok to you?

@BethanyZhou
Copy link
Contributor

Sure, many thanks for your suggestion.

@BethanyZhou BethanyZhou changed the title How to mount an EmptyDir with New-AzContainerGroup command? Feature request: Add support for EmptyDir in New-AzContainerGroup command Mar 18, 2022
@dingmeng-xue dingmeng-xue added the feature-request This issue requires a new behavior in the product in order be resolved. label Mar 18, 2022
@BethanyZhou
Copy link
Contributor

BethanyZhou commented Apr 14, 2022

Hi @jaltin ,

We are supporting empty directory volume and secret volume by #17802. If everything goes well, these features will available at the end of April.

@jaltin
Copy link
Author

jaltin commented Apr 14, 2022

@BethanyZhou ,

Thanks for the update! PR looks great!

@dingmeng-xue dingmeng-xue added this to the Apr 2022 (2022-04-26) milestone Apr 21, 2022
@dingmeng-xue
Copy link
Member

It will be available on April 26. Close it now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Container Instances customer-reported feature-request This issue requires a new behavior in the product in order be resolved. Investigate 🔍 question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
4 participants