Skip to content

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

@paynecrl97

Description

@paynecrl97

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):

  • OS: Windows
  • IDE : Visual Studio
  • Microsoft.Azure.Management.ContainerInstance.Fluent v1.38.1

Information Checklist
Kindly make sure that you have added all the following information above and checkoff the required fields otherwise we will treat the issuer as an incomplete report

  • Query Added
  • Setup information Added

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions