npv

command module
v0.0.0-...-cec2b4b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2024 License: MIT Imports: 6 Imported by: 0

README

NPV - NetworkPolicyViewer

This project fetches NetworkPolicy resources from the Kubernetes cluster identified by the current KUBECONFIG environment variable and prints a PlantUML component diagram to stdout.

Install

go install github.com/mrxk/npv@latest

Usage

npv - Network Policy Visualizer

Usage:
        npv visualize [(--namespace=<namespace>...|--file=<file>...)] [--out=<out>] [(--ingress-only|--egress-only)]

Options:
        --namespace=<namespace> Namespace containing Network Policies to visualize
        --file=<file>           Path to file containing Network Policies to visualize
        --out=<out>             Path to write visualiztion (- for stdout) (default: -)
        --ingress-only          Visualize only ingress rules
        --egress-only           Visualize only egress rules

If not given --namespace or --file, all NetworkPolicy resources in the cluster identified by the current KUBECONFIG environment variable will be fetched. Multiple --namespace or --file options can be provided to include the NetworkPolicy resources from multiple namespaces or files in one graph. Globs can be passed to --file although care must be taken to ensure the shell does not expand the glob before executing npv. The output can be filtered to only ingress or egress rules with either --ingress-only or --egress-only options.

The output can be saved and processed with PlantUML or piped directly to it.

npv visualize --namespace default | java -jar plantuml-1.2024.8.jar -pipe > default.png

PlantUML can be downloaded from https://plantuml.com/download.

Build

  1. Clone the project
  2. Build with go build

Examples

allowToPod

allowToPod.ingress

allowToPod.egress

allowAll

denyToPod

denyAll

denyAllAndToPod

multiple

allInOne

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
maputils
Package maputils provides helper functions for maps.
Package maputils provides helper functions for maps.
visualize
Package visualize produces PlantUML diagrams of network policies in a Kubernetes cluseter.
Package visualize produces PlantUML diagrams of network policies in a Kubernetes cluseter.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL