Azure / azure-libraries-for-net

Azure libraries for .Net
MIT License
379 stars 192 forks source link

[QUERY] How can I set the resource limit property for a container instance using the fluent SDK? #1319

Open paynecrl97 opened 2 years ago

paynecrl97 commented 2 years ago

Query/Question How can I set the resource limit property for a container instance using the fluent SDK?

According to the docs, I should be able to set an optional resource limit property when allocating resources to container instances within a container group, as well as setting the mandatory resource request property.

However, the only methods to define resources that I can find the fluent SDK areWithCpuCoreCount() and WithMemorySizeInGB(). I assume that these methods set the resource request property (because this property is mandatory). I can't find an equivalent method (or an overload) to set the resource limit property. e.g.

                IContainerGroup containerGroup = azure.ContainerGroups.Define(aciName)
                    .WithRegion(region)
                    .WithNewResourceGroup(rgName)
                    .WithLinux()
                    .WithPublicImageRegistryOnly()
                    .WithoutVolume()
                    .DefineContainerInstance(aciName + "-1")
                        .WithImage(containerImageName1)
                        .WithExternalTcpPort(80)
                        .WithCpuCoreCount(.5)
                        .WithCpuCoreCountLimit(1) // Something like this
                        .WithMemorySizeInGB(1)
                        .Attach()
                    .DefineContainerInstance(aciName + "-2")
                        .WithImage(containerImageName2)
                        .WithoutPorts()
                        .WithCpuCoreCount(request: .5, limit: 1) // Or maybe like this
                        .WithMemorySizeInGB(1)
                        .Attach()
                    .WithRestartPolicy(ContainerGroupRestartPolicy.Never)
                    .WithDnsPrefix(aciName)
                    .Create();

Why is this not a Bug or a feature Request? This might be a feature request, but I'm hoping this is already possible and I've overlooked something.

Setup (please complete the following information if applicable):

weidongxu-microsoft commented 2 years ago

Please plan to migrate to https://aka.ms/azsdk/dotnet/mgmt (ACI should release soon)

This lib is in maintenance, and new feature will not be added to it.