Skip to content

Memory request/limit not correct when applying with Gi #1250

Closed as not planned
@Uranium2

Description

@Uranium2

What happened:
I am not getting the correct memory requested in memory request/limits when using Gi notation. I get 157286400m for 0.15Gi in request and 188743680m for 0.18Gi in limits

How to reproduce it (as minimally and precisely as possible):

apiVersion: batch/v1
kind: Job
metadata:
  name: job-testing
spec:
  backoffLimit: 0
  template:
    metadata:
      labels:
        app: job-testing
    spec:
      containers:
      - command:
        - /bin/bash
        - -c
        - python3 main.py
        env:
        - name: DEPLOY_ENV
          value: prd
        image: <IMAGE>
        imagePullPolicy: Always
        name: job-testing
        resources:
          limits:
            cpu: 0.18
            memory: 0.18Gi
          requests:
            cpu: 0.15
            memory: 0.15Gi
        securityContext:
          allowPrivilegeEscalation: false
      imagePullSecrets:
      - name: <DTR_SERVER>
      restartPolicy: Never
      securityContext:
        fsGroup: 11111
        runAsGroup: 11111
        runAsUser: 11111

My original YAML has volumes and secrets which i stripped here and using a corporate DTR/docker Image

kubectl apply -n my-namespace -f job.yaml

Anything else we need to know?:
The YAML file is generated with kubernetes-client in python. But when I print it, I get expected values of 0.15Gi and 0.18Gi. And the error is the same when the package applies the configuration or that I apply myself the YAML file. I am wondering if this could be changed by the server.

Environment:
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.5", GitCommit:"c285e781331a3785a7f436042c65c5641ce8a9e9", GitTreeState:"clean", BuildDate:"2022-03-16T15:58:47Z", GoVersion:"go1.17.8", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"20+", GitVersion:"v1.20.11-mirantis-1", GitCommit:"c0557aa1a9571c353503500cb7130a2f491d073f", GitTreeState:"clean", BuildDate:"2021-09-18T04:05:21Z", GoVersion:"go1.15.15", Compiler:"gc", Platform:"linux/amd64"}

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugCategorizes issue or PR as related to a bug.lifecycle/rottenDenotes an issue or PR that has aged beyond stale and will be auto-closed.needs-triageIndicates an issue or PR lacks a `triage/foo` label and requires one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions