Add a config .pre-commit-hooks.yaml
install hooks:
pre-commit install --install-hooks
The namespaced hook checks if Kubernetes manifests are namespaced.
It ignores Namespaces, ClusterRoles, ClusterRoleBindings, PersistentVolumes, StorageClasses, IngressClasses and CustomResourceDefinitions
by default.
It also ignores all kustomization.kustomize.config.k8s.io
objects.
You can define other ignored kinds by setting the argument --ignore-kind KINDNAME
(case insensitive).
fail_fast: false
repos:
- repo: https://github.com/containeroo/pre-commit-hooks
rev: v0.0.12
hooks:
- id: namespaced
args:
- --ignore-kind
- clusterpolicy
- -i
- GlobalNetworkPolicy
The forbidden_pattern hook checks if files contains not wanted patterns.
If the pattern contains ${VAR}
or $VAR
, it will be replaced.
fail_fast: false
repos:
- repo: https://github.com/containeroo/pre-commit-hooks
rev: v0.0.12
hooks:
- id: forbid_pattern
args:
- --forbidden-pattern
- secret
- -f
- "name:\s+super-secret"