yaml.kubernetes.best-practice.no-fractional-cpu-limits.kubernetes.best-practice.no-fractional-cpu-limits

225
Download Count*

When you set a fractional CPU limit on a container, the CPU cycles available will be throttled, even though most nodes can handle processes alternating between using 100% of the CPU.

Run Locally

Run in CI

Defintion

rules:
  - id: kubernetes.best-practice.no-fractional-cpu-limits
    patterns:
      - pattern-inside: |
          limits:
            ...
      - pattern: |
          cpu: $CPU_LIMIT
      - metavariable-regex:
          metavariable: $CPU_LIMIT
          regex: \d{0,3}m
    fix: "cpu: 1000m"
    message: |
      When you set a fractional CPU limit on a container,
      the CPU cycles available will be throttled,
      even though most nodes can handle processes
      alternating between using 100% of the CPU.
    severity: WARNING
    languages:
      - yaml