Skip to main content

helmreview

CI PyPI Python License: MIT

Revisión estática y local de Helm charts para Kubernetes y OpenShift. El chart se renderiza con helm template en tu propia estación: no se necesita acceso al cluster y no se sube nada a servicios externos.

A partir del render, la herramienta:

  • Mide la capacidad configurada: requests y limits de CPU/memoria por pod, totales con las réplicas base y con el máximo del HPA, DaemonSets por nodo y almacenamiento (PVC y volumeClaimTemplates).
  • Detecta problemas de alta disponibilidad, probes, seguridad, imágenes, RBAC, red, APIs eliminadas y metadatos del chart.
  • Valida compatibilidad con OpenShift (--ocp-version): SCC restricted-v2, Routes, DeploymentConfig y RBAC sobre SCC.
  • Genera reportes en consola, Markdown (para tickets o pull/merge requests) y JSON (para integraciones).
  • Integra con CI: --fail-on devuelve el exit code 2 si hay hallazgos a partir de la severidad indicada.

El catálogo completo de checks está en docs/checks.md.


Requisitos

Componente Versión Notas
Python 3.9 o superior
helm 3.x o 4.x en el PATH Solo se usa helm lint, helm template y helm show
kubeconform, kube-linter, trivy opcionales Solo si usas --external

Instalación

pip install helmreview                 # desde PyPI
# pipx install helmreview              # recomendado para CLIs: entorno aislado
helmreview --version

Otras formas:

# Directo desde el repositorio (GitHub, GitLab o Secure Source Manager), fijando un tag
pip install "git+https://github.com/IsaacMendezEcheverria/helmreview.git@v1.0.0"

# Desde el código fuente
git clone https://github.com/IsaacMendezEcheverria/helmreview.git && cd helmreview
python3 -m venv .venv
source .venv/bin/activate            # Windows: .\.venv\Scripts\Activate.ps1
pip install .                        # usuarios
# pip install -e ".[dev]"            # desarrolladores (tests, linter, pre-commit)

# Desde el wheel generado con `make build`
pip install dist/helmreview-1.0.0-py3-none-any.whl

Si tu organización publica el paquete en su registro interno (Package Registry de GitLab o Artifact Registry de Google Cloud), mira docs/ci-platforms.md para el --index-url correspondiente.

Uso rápido

# Kubernetes genérico con los values de producción
helmreview ./mychart -f values.yaml -f values-prod.yaml --kube-version 1.30 --report revision.md

# OpenShift 4.16 (fija la versión de K8s y activa los checks de SCC y Routes)
helmreview ./mychart -f values-ocp.yaml --ocp-version 4.16 --report revision.md

# Todos los charts de un directorio, mostrando solo severidad media o alta
helmreview ./charts/* --ocp-version 4.16 --min-severity medium --json revision.json

# Chart remoto en un registry OCI (requiere `helm registry login` antes)
helmreview oci://harbor.local/charts/app --chart-version 1.4.2 -f prod.yaml

# Analizar un YAML ya renderizado, sin ejecutar helm
helmreview ./mychart --rendered render.yaml

# Omitir checks aceptados como excepción
helmreview ./mychart --ignore serviceaccount,chart-schema

También se puede ejecutar como python -m helmreview ....

Opciones principales

Opción Descripción
-f, --values Archivo de values. Se puede repetir y se aplica en orden, igual que en helm
--set Valor --set de helm (repetible)
-n, --namespace Namespace del render (default: default)
--kube-version Versión de Kubernetes objetivo (afecta .Capabilities)
--ocp-version Versión de OpenShift. Implica --platform openshift y fija --kube-version
--platform kubernetes (default) u openshift
--api-versions API adicional disponible en el cluster, por ejemplo monitoring.coreos.com/v1 (repetible)
--chart-version Versión del chart en charts remotos u OCI
--dep-update Ejecuta helm dependency build/update antes del render
--rendered Analiza un YAML ya renderizado (un solo chart)
--external Ejecuta kubeconform, kube-linter y trivy si están instalados
--ignore IDs de checks a omitir, separados por coma
--min-severity high, medium, low (default) o info
--report / --json Escribe el reporte Markdown o JSON
--save-rendered Guarda el YAML renderizado en un directorio
--fail-on high, medium, low o none (default). Exit code 2 si se cumple

Códigos de salida

Código Significado
0 Revisión completada; no se alcanzó el umbral de --fail-on
1 Error de ejecución: helm no instalado, render fallido o archivo de values inexistente
2 Hay hallazgos con severidad igual o mayor a --fail-on

Lectura del reporte

  • Capacidad configurada:
    • Req total = request por pod × réplicas base.
    • Req total a máx. HPA = request por pod × maxReplicas. Este es el valor que hay que cubrir con cuota o con nodos.
    • Los DaemonSets se muestran por nodo.
    • Si un contenedor no define request pero sí limit, se usa el limit, igual que hace Kubernetes.
    • Los initContainers cuentan como el máximo, no como la suma.
  • Hallazgos: cada uno incluye severidad, recurso, contenedor, ID del check y el template de origen (# Source:), para ir directo al archivo a corregir.

OpenShift: qué valida y qué no

La herramienta valida lo que se ve en los manifiestos: compatibilidad con restricted-v2 (UID/GID fijos, capabilities, privileged, host*, puertos < 1024), Routes y RBAC sobre SCC.

No puede validar la imagen. Para funcionar con UID arbitrario, los directorios donde la aplicación escribe deben pertenecer al grupo 0 con permisos g=u. Eso se revisa en el Dockerfile o probando el pod en un namespace con restricted-v2.

Integración en CI

--fail-on hace fallar el job si hay hallazgos a partir de la severidad indicada, y el reporte Markdown queda como artefacto para revisarlo en el PR/MR.

GitHub Actions

jobs:
  helm-review:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
      - uses: actions/setup-python@v7
        with: { python-version: "3.12" }
      - uses: azure/setup-helm@v5
      - run: pip install helmreview==1.0.0
      - run: helmreview charts/* --ocp-version 4.16 -f values-prod.yaml --report revision.md --fail-on high
      - uses: actions/upload-artifact@v7
        if: always()
        with: { name: helm-review, path: revision.md }

GitLab CI

helm-review:
  image: python:3.12-slim
  before_script:
    - apt-get update -qq && apt-get install -y -qq curl > /dev/null
    - curl -fsSL https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz | tar xz -C /tmp && mv /tmp/linux-amd64/helm /usr/local/bin/
    - pip install helmreview==1.0.0
  script:
    - helmreview charts/* --ocp-version 4.16 -f values-prod.yaml --report revision.md --fail-on high
  artifacts:
    when: always
    paths: [revision.md]

Google Cloud Build

steps:
  - name: python:3.12-slim
    entrypoint: bash
    args:
      - -ceu
      - |
        apt-get update -qq && apt-get install -y -qq curl > /dev/null
        curl -fsSL https://get.helm.sh/helm-v3.16.2-linux-amd64.tar.gz | tar xz -C /tmp && mv /tmp/linux-amd64/helm /usr/local/bin/
        pip install -q helmreview==1.0.0
        helmreview charts/* --ocp-version 4.16 -f values-prod.yaml --report revision.md --fail-on high
options:
  logging: CLOUD_LOGGING_ONLY

Uso como librería

from helmreview.options import ReviewOptions
from helmreview.review import review_chart

rep = review_chart("./mychart", ReviewOptions(values=["prod.yaml"], platform="openshift", kube_version="1.29"))
for f in rep.filtered("MEDIUM"):
    print(f.severity, f.check, f.resource, f.message)

Desarrollo y mantenimiento

Documento Contenido
CONTRIBUTING.md Entorno de desarrollo, convenciones de commits y ramas, flujo de pull/merge requests
CODE_OF_CONDUCT.md Código de conducta de la comunidad
SECURITY.md Cómo reportar vulnerabilidades
docs/ci-platforms.md CI y publicación en GitHub, GitLab y Google Cloud; espejos entre plataformas
docs/architecture.md Estructura del código y flujo de ejecución
docs/adding-a-check.md Cómo agregar o modificar un check, paso a paso
docs/checks.md Catálogo de checks con sus IDs
docs/releasing.md Cómo publicar una nueva versión
CHANGELOG.md Historial de cambios

Comandos frecuentes:

make dev      # crea .venv e instala dependencias de desarrollo + pre-commit
make test     # pytest con cobertura
make lint     # ruff check + ruff format --check
make build    # wheel y sdist en dist/

Versionado

Se usa Semantic Versioning. La versión vive en un solo lugar: src/helmreview/__init__.py. Los cambios se registran en CHANGELOG.md.

Contribuir

Las contribuciones son bienvenidas: reportes de bugs, checks nuevos, soporte para nuevas versiones de Kubernetes/OpenShift y mejoras en la documentación. Lee CONTRIBUTING.md antes de abrir un pull request y respeta el código de conducta. Para temas de seguridad, sigue SECURITY.md.

Mantenedores

Licencia

Distribuido bajo la licencia MIT. © 2026 Isaac Mendez.

Metadata

Release files for helmreview 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for helmreview 1.0.2
File Size Uploaded
helmreview-1.0.2.tar.gz 36.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for helmreview 1.0.2
File Interpreter ABI Platform
helmreview-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 70.5 kB

Release files / helmreview-1.0.2.tar.gz

Download URL helmreview-1.0.2.tar.gz
Size 36.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f1538cec11f6149153cfc90dee029a14476e8b0a3d1807f4b10f635db316083f
BLAKE2b-256 checksum
How to use checksums
98af06e95915b239c04b90d8569ef6061e56d1c1cbd95f5eb2ea35de08c6fcfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release files / helmreview-1.0.2-py3-none-any.whl

Download URL helmreview-1.0.2-py3-none-any.whl
Size 33.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f6718003e9416790742ac9101bf48b5ae78e905ec554e3b78de8c1593d8ec21
BLAKE2b-256 checksum
How to use checksums
2155fa1fe2e9c26ff510c8e41f18c24d3660e6b5377cc6cb155e24546108897c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 30, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page