Module pragma

Module pragma 

Source
Expand description

Annotation-based rule ignoring (pragma). Annotation-based rule ignoring for k8s-optimize.

Supports ignore-check.k8s-optimize.io/<check-code> annotations to disable specific optimization checks for individual objects.

§Example

apiVersion: apps/v1
kind: Deployment
metadata:
  name: my-app
  annotations:
    # Ignore the high CPU request check for this deployment
    ignore-check.k8s-optimize.io/K8S-OPT-005: "Batch processing requires high CPU"
    # Ignore the excessive CPU ratio check
    ignore-check.k8s-optimize.io/K8S-OPT-007: ""
spec:
  # ...

Constants§

IGNORE_ANNOTATION_PREFIX
Prefix for k8s-optimize ignore annotations.

Functions§

extract_annotations
Extract annotations from a YAML value’s metadata.
get_ignore_reason
Get the reason for ignoring a rule (if provided in the annotation value).
get_ignored_rules
Extract the set of ignored rule codes from an object’s annotations.
should_ignore_rule
Check if a specific rule should be ignored for an object.