This repository uses comprehensive validation to ensure changes don't break the cluster or expose secrets.
All pull requests that modify files in the kubernetes/ directory will trigger automated validation checks that must pass before merging.
- Validates YAML syntax and formatting
- Enforces consistent style across all files
- Configuration:
.yamllint.yaml
- Gitleaks: Scans for secrets in code
- TruffleHog: Verifies no credentials are exposed
- Automatic PR comments if secrets are found
- Builds all kustomizations to ensure they're valid
- Validates that all referenced files exist
- Checks component references
- Validates Kubernetes manifests against schemas
- Checks CRD compatibility
- Ensures resources follow Kubernetes API specifications
- Validates Flux configurations
- Tests HelmRelease and Kustomization resources
- Verifies source references
- Shows what changes will be applied to the cluster
- Generates PR comments with diffs
- Helps reviewers understand impact
- Validates HelmRelease values
- Checks for syntax errors in helm-values.yaml files
- Enforces organizational standards:
- Resource limits and requests required
- Security contexts mandatory
- No :latest tags
- Media workloads need node affinity
- Volsync apps need UID/GID configuration
- Validates all Flux dependencies exist
- Prevents broken dependency chains
- Checks for circular dependencies
Install pre-commit to run validation locally before pushing:
# Install pre-commit
pip install pre-commit
# Install the git hooks
pre-commit install
# Run manually on all files
pre-commit run --all-files# Validate specific kustomization
kustomize build kubernetes/apps/default/plex/app
# Run kubeconform
kubeconform -strict -ignore-missing-schemas kubernetes/apps/default/plex/app/helmrelease.yaml
# Test with flux-local
flux-local test -p kubernetes/flux/clusterAdd resource limits to your container:
resources:
requests:
cpu: 10m
memory: 128Mi
limits:
memory: 256MiAdd remediation configuration:
spec:
install:
remediation:
retries: 3
upgrade:
remediation:
strategy: rollback
retries: 3Use SOPS encryption or ExternalSecrets instead of plain text secrets.
Add UID/GID to postBuild substitutions:
postBuild:
substitute:
APP: *app
VOLSYNC_UID: "1000"
VOLSYNC_GID: "1000"
VOLSYNC_FSGROUP: "1000"The validation workflow is defined in .github/workflows/validate-pr.yaml.
Key features:
- Runs on all PRs to main branch
- Parallel job execution for speed
- Clear error messages with file locations
- Automatic PR comments for diffs
- OPA Policies: Edit
.github/policies/kubernetes.rego - Pre-commit Hooks: Update
.pre-commit-config.yaml - Workflow Jobs: Add to
.github/workflows/validate-pr.yaml
In rare cases where you need to bypass a check:
- OPA Policies: Add annotation
home-ops/allow-root: "true"for root containers - Resource Limits: Use
home-ops/skip-resource-validation: "true"