All Projects → viglesiasce → Kube Lint

viglesiasce / Kube Lint

Licence: apache-2.0
A linter for Kubernetes resources with a customizable rule set

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to Kube Lint

Eyo
🦔 CLI for restoring the letter «ё» (yo) in russian texts
Stars: ✭ 119 (-21.71%)
Mutual labels:  linter
Wsl Proxy
WSL proxy files for editor/linux interop
Stars: ✭ 134 (-11.84%)
Mutual labels:  linter
Bento
[DEPRECATED] Find Python web-app bugs delightfully fast, without changing your workflow. 🍱
Stars: ✭ 147 (-3.29%)
Mutual labels:  linter
Tsqllint
Configurable linting for TSQL
Stars: ✭ 123 (-19.08%)
Mutual labels:  linter
Rstcheck
Checks syntax of reStructuredText and code blocks nested within it
Stars: ✭ 130 (-14.47%)
Mutual labels:  linter
Errcheck
errcheck checks that you checked errors.
Stars: ✭ 1,763 (+1059.87%)
Mutual labels:  linter
Editorconfig Checker
A tool to verify that your files are in harmony with your .editorconfig
Stars: ✭ 119 (-21.71%)
Mutual labels:  linter
Gulp Stylelint
Gulp plugin for running Stylelint results through various reporters.
Stars: ✭ 149 (-1.97%)
Mutual labels:  linter
Drstring
DrString finds issues in your Swift docstrings and fixes them for you.
Stars: ✭ 133 (-12.5%)
Mutual labels:  linter
Rubocop
A Ruby static code analyzer and formatter, based on the community Ruby style guide.
Stars: ✭ 11,593 (+7526.97%)
Mutual labels:  linter
Ansible Lint Action
GitHub Action for running ansible-lint as part of your workflows! [ https://github.com/marketplace/actions/ansible-lint ]
Stars: ✭ 124 (-18.42%)
Mutual labels:  linter
Njsscan
njsscan is a semantic aware SAST tool that can find insecure code patterns in your Node.js applications.
Stars: ✭ 128 (-15.79%)
Mutual labels:  linter
Ale
Check syntax in Vim asynchronously and fix files, with Language Server Protocol (LSP) support
Stars: ✭ 11,380 (+7386.84%)
Mutual labels:  linter
Liche
Fast Link Checker for Markdown and HTML in Go
Stars: ✭ 123 (-19.08%)
Mutual labels:  linter
Cljstyle
A tool for formatting Clojure code
Stars: ✭ 148 (-2.63%)
Mutual labels:  linter
Lesshint
A tool to aid you in writing clean and consistent Less.
Stars: ✭ 119 (-21.71%)
Mutual labels:  linter
Nitpick
Enforce the same settings across multiple language-independent projects
Stars: ✭ 134 (-11.84%)
Mutual labels:  linter
Muffet
Fast website link checker in Go
Stars: ✭ 1,861 (+1124.34%)
Mutual labels:  linter
Jql
Java code analysis and linting with SQL
Stars: ✭ 148 (-2.63%)
Mutual labels:  linter
Protolint
A pluggable linter and fixer to enforce Protocol Buffer style and conventions.
Stars: ✭ 142 (-6.58%)
Mutual labels:  linter

kube-lint

A linter for Kubernetes resources with a customizable rule set.

Introduction

kube-lint hopes to make it easy to validate that your Kubernetes configuration files and your running resources adhere to a standard that you define. You define a list of rules that you would like to validate against your resources and kube-lint will evaluate those rules against them.

In many organizations you will want to have a standard for what is considered "correct" enough to be deployed into your Kubernetes clusters. You may have conventions for labels or restrictions on certain types of services being created. You can use kube-lint during your CI/CD pipeline to gate resources being created that do not adhere to your standards. Additionally you can use kube-lint to audit against a running set of resources in your cluster.

CONSIDER THIS A PROTOTYPE. PLEASE PROVIDE FEEDBACK IN THE ISSUES

Only Pod linting is currently implemented

Installation

  • Download a release from the releases page that matches your platform.
  • Extract the archive

For MacOS

wget https://github.com/viglesiasce/kube-lint/releases/download/v0.0.1-prototype/kube-lint-prototype-darwin.tgz
tar zxfv kube-lint-prototype-darwin.tgz
./darwin/kube-lint -h

For Linux

wget https://github.com/viglesiasce/kube-lint/releases/download/v0.0.1-prototype/kube-lint-prototype-linux.tgz
tar zxfv kube-lint-prototype-linux.tgz
./linux/kube-lint -h

Rule configuration

The rule configuration file is a YAML formatted list of KubernetesRules. An example config file is available at example/config.yaml in this repository.

A KubernetesRule has the following format:

name: app-label
description: Includes a label with key "app"
kind: Pod
field: .metadata.labels.app
operator: set
valueType: string
tags:
- operations
- security

name is an identifier for this rule.

description provides details about what the rule is checking for.

kind is the type of resource this check should be done against.

field is a jsonpath used to get the value you want to evaluate against.

operator is the check that youd like to do against your expected vs actual values (ie equal, matches, lessthan). For string type the available operators are equal, notequal, set, unset, matches. For bool type the available operators are equal, notequal, set, unset. For float64 type, the available operators are equal, notequal, set, unset, greaterthan, lessthan.

valueType is the type of the value that needs to be evaluated. string is the default. bool and float64 are also implemented.

tags is a list of strings that can be used to decide whether to run this rule or not via the CLI.

Running kube-lint

Basic operation

Once installed you can run kube-lint from this directory as follows:

kube-lint pods --config example/config.yaml

To change the rules edit example/config.yaml. You rulebender you.

Filtering rules by tag

You can evaluate a subset of rules by filtering down to only those that include certain tags. For example:

kube-lint pods --config example/config.yaml --tags security,operations

Filtering resources by namespace

You can also filter which resources are evaluated by passing the --namespace flag as follows:

kube-lint pods --config example/config.yaml --namespace kube-system

TODO if this seems like a reasonable approach to pursue

  • Replace panic everywhere with proper error handling
  • Add tests. Lots of tests.
  • Add docstrings to all exported functions/types/methods
  • Make -f be able to load a directories of yaml files (like kubectl)
  • Decide on how to deal with unset parameters
  • Choose a logging framework and use it
  • Add more resources (services/deployments/etc.)
  • Use ${HOME}/.kube-lint for config params
  • Develop standardized baseline of rules that are useful
  • Vendor dependencies using glide

Contributing

Add an issue to talk about what youd like to see changed. Lets talk about it then come up with a plan of action.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].