Skip to content

Using a non-valid cpus value, silently ignores it #11634

@stavros-k

Description

@stavros-k

Description

Compose is in general rejecting non-valid configurations, even unknown keys are rejected (except x- prefixed).
But providing a non-valid formatted value for cpus silently ignores the parsing error.

eg try to set deploy.resources.limits.cpus to 1000m, it will ignore it (not even a warning) and will not apply any limits.
As someone that uses k8s and docker frequently I mix them up sometimes. Not having at least a warning, creates issues like containers abusing resources unexpectedly. (Though is a user error in this case).

Code point that ignores the parsing error:

if f, err := strconv.ParseFloat(limits.NanoCPUs, 64); err == nil {

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions