Skip to main content

pre-commit rules for Kubernetes related files

Project description

pre-commit-k8s

An additional hook that can be used as a hook with (pre-commit)[https://pre-commit.com/] to validate Kubernetes objects.

Current hooks:

  • kubernetes-secrets - check if secrets are pushed

Usage

Install pre-commit

pip install pre-commit

Setup the .pre-commit-config.yaml config file:

# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/zwennesm/pre-commit-k8s
  rev: master
  hooks:
  - id: pre-commit-k8s
    entry: pre-commit-k8s

Install the pre-commit hooks:

pre-commit install

Local install

Alternatively pre-commit-k8s can be installed locally for testing.

pip install pre-commit-k8s

pre-commit-k8s expects a list of files to be passed to it:

➜ pre-commit-k8s LICENCE                                          
2020-12-07 14:50:06,636 - INFO - Validating the following rules:
2020-12-07 14:50:06,636 - INFO - ✓ Kubernetes Secret check
2020-12-07 14:50:06,636 - INFO - No validation errors found

Rules can also be excluded:

➜ pre-commit-k8s --exclude kubernetes-secrets kubernetes-secret.yaml 
2020-12-07 14:52:08,569 - WARNING - No rules activated to validate files
2020-12-07 14:52:08,569 - INFO - No validation errors found

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pre-commit-k8s-0.0.2.tar.gz (3.0 kB view details)

Uploaded Source

File details

Details for the file pre-commit-k8s-0.0.2.tar.gz.

File metadata

  • Download URL: pre-commit-k8s-0.0.2.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.1 CPython/3.8.6

File hashes

Hashes for pre-commit-k8s-0.0.2.tar.gz
Algorithm Hash digest
SHA256 7dbe8802cfda77a42a4045f8b1813f8237d37c915fe90e36fa6d76b6b7579a59
MD5 975f6c490d2ddbbf6035fd04a6da7e6c
BLAKE2b-256 fec7eaf0d12bdbd9d3a3e16a8fcfea9419e839e08297db08eac105f380b0fc7a

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page