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

[Python-based kubelet] Parse resources with exponent notation #17280

Merged
merged 3 commits into from
Mar 26, 2024

Conversation

tbavelier
Copy link
Member

@tbavelier tbavelier commented Mar 26, 2024

What does this PR do?

Limits and requests for memory are measured in bytes. You can express memory as a plain integer or as a fixed-point number using one of these quantity suffixes: E, P, T, G, M, k. You can also use the power-of-two equivalents: Ei, Pi, Ti, Gi, Mi, Ki. For example, the following represent roughly the same value:
128974848, 129e6, 129M, 128974848000m, 123Mi

Motivation

  • Customer case where the current parsing provides exabytes value for kubernetes.memory.requests due to the current parsing function : CONS-6245

Additional Notes

apiVersion: v1
kind: Pod
metadata:
  name: exponent-pod
spec:
  containers:
    - name: redis
      image: redis:latest
      ports:
        - containerPort: 6379
      resources:
        requests:
          memory: "1.181116006E9"
          cpu: "250m"
        limits:
          memory: "1.181116006E9"
          cpu: "500m"
    - name: nginx
      image: nginx:latest
      resources:
        requests:
          memory: "1.181116006e9"
          cpu: "250m"
        limits:
          memory: "1.181116006e9"
          cpu: "500m"

Both memory.limits and memory.requests should be 1.1 GiB

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests (unit, integration, e2e)
  • Changelog entries must be created for modifications to shipped code
  • Add the qa/skip-qa label if the PR doesn't need to be tested during QA.

Copy link

codecov bot commented Mar 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 90.48%. Comparing base (3bd07bb) to head (646c3e0).
Report is 5 commits behind head on master.

Additional details and impacted files
Flag Coverage Δ
activemq ?
cassandra ?
confluent_platform ?
hive ?
hivemq ?
hudi ?
ignite ?
jboss_wildfly ?
kafka ?
kubelet 91.01% <100.00%> (+0.01%) ⬆️
presto ?
solr ?
weblogic ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Copy link

Test Results

  2 files    2 suites   6s ⏱️
 72 tests  72 ✅ 0 💤 0 ❌
144 runs  144 ✅ 0 💤 0 ❌

Results for commit 646c3e0.

@FlorentClarret FlorentClarret added this to the 7.54.0 milestone Mar 26, 2024
@FlorentClarret FlorentClarret merged commit 73611fb into master Mar 26, 2024
37 checks passed
@FlorentClarret FlorentClarret deleted the tbavelier/python_kubelet_memory_parsing branch March 26, 2024 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants