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

Unable to set Memory Limit of serivce to value of 2GB or greater #1185

Open
1Four1Two opened this issue Jul 16, 2024 · 1 comment
Open

Unable to set Memory Limit of serivce to value of 2GB or greater #1185

1Four1Two opened this issue Jul 16, 2024 · 1 comment
Labels
customer/feedback Feedback from customers kind/enhancement Improvements or new features

Comments

@1Four1Two
Copy link

1Four1Two commented Jul 16, 2024

Describe what happened

When trying to create a service with a memory limit of 2GB or higher it will fail. This is because the value must be represented in bytes and the input value is an int. max value being less that the required value

Sample program

using Pulumi;
using Pulumi.Docker;

class MyStack : Stack
{
    public MyStack()
    {
        var service = new Service("my-docker-service", new ServiceArgs
        {
            Name = "my-service",
            TaskSpec = new ServiceTaskSpecArgs
            {
                ContainerSpec = new ServiceTaskSpecContainerSpecArgs
                {
                    Image = "nginx:latest", // Replace with your desired image
                    Resources = new ServiceTaskSpecContainerSpecResourcesArgs
                    {
                        Limits = new ServiceTaskSpecContainerSpecResourcesLimitsArgs
                        {
                            MemoryBytes = 2 * 1024 * 1024 * 1024 // 2GB memory limit
                        }
                    }
                }
            },
            Mode = new ServiceModeArgs
            {
                Replicated = new ServiceModeReplicatedArgs
                {
                    Replicas = 1 // Number of replicas
                }
            },
            EndpointSpec = new ServiceEndpointSpecArgs
            {
                Ports = 
                {
                    new ServiceEndpointSpecPortsArgs
                    {
                        Protocol = "tcp",
                        TargetPort = 80,
                        PublishedPort = 8080
                    }
                }
            }
        });

        // Export the service ID
        this.ServiceId = service.Id;
    }

    [Output]
    public Output<string> ServiceId { get; set; }
}

class Program
{
    static Task<int> Main() => Deployment.RunAsync<MyStack>();
}

Log output

rror response from daemon: rpc error: code = InvalidArgument desc = invalid memory value -2147483648: Must be at least 4MiB

Affected Resource(s)

No response

Output of pulumi about

CLI
Version 3.124.0
Go Version go1.22.5
Go Compiler gc

Plugins
KIND NAME VERSION
resource aws 6.44.0
resource command 0.11.1
resource docker 4.5.4
language dotnet unknown

Host
OS ubuntu
Version 22.04
Arch x86_64

This project is written in dotnet: executable='/usr/bin/dotnet' version='7.0.119'

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@1Four1Two 1Four1Two added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jul 16, 2024
@blampe
Copy link
Contributor

blampe commented Jul 18, 2024

I don't think we can expose this as a long without pulumi/pulumi#14242 first.

Alternatively it would be reasonable to accept a string (e.g. "4GB").

Please give this a 👍 if you'd like to see it prioritized!

@blampe blampe added customer/feedback Feedback from customers kind/enhancement Improvements or new features and removed kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Jul 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
customer/feedback Feedback from customers kind/enhancement Improvements or new features
Projects
None yet
Development

No branches or pull requests

2 participants