kubegraph

module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: MIT

README ΒΆ

kubegraph sample

Kubegraph

Status GitHub Issues GitHub Pull Requests License


Yet another kubernetes resource graph generator

πŸ“ Table of Contents

🧐 About

KubeGraph is a CLI tool that parses kubernetes resources and generates a graph with the relations between those. The graph is done using Graphviz, and can be further customized after generation.

🏁 Getting Started

Fetch the dependencies and build with

make build

Prerequisites

KubeGraph is done using Golang 1.15, using a pure Go graphviz implementation to generate the graph.

Everything is set as a direct dependency, and go mod vendor will install for you.

Installing

It can be installed using standard go install

go install ./...

Then, if you have GOPATH on your path, you can call kubepath directly anywhere.

πŸ”§ Running the tests

WIP, there's no tests yet 😞

🎈 Usage

kubegraph my-multidoc.yaml

or using the docker image

docker run --rm -it -v ${PWD}:/home/kubegraph wwmoraes/kubegraph:latest resources.yaml

How to add support for a single/suite of custom resource definitions

First, import the scheme and add it to client-go's scheme on internal/loader/getDecoder.go@init:

import (
  "k8s.io/client-go/kubernetes/scheme"
  // import the target scheme
  myAwesomeScheme "githost.com/owner/repository/pkg/client/clientset/scheme"
)

func init() {
  // add the scheme to client-go's scheme
  _ = myAwesomeScheme.AddToScheme(scheme.Scheme)
}

then:

  1. vendor it with go mod vendor to update go.mod and go.sum

  2. add adapters for the kinds on that scheme at internal/adapters/<api-group>/<api-version>. You can copy from an existing one, or use the internal/adapters/dummy/v1/dummy.go as a guide.

  3. import your API versions on the group level (check internal/adapters/dummy/dummy.go)

  4. import the group on the top level on internal/adapters/adapters.go

  5. [optional, recommended] add a SVG icon for the new kinds on icons/ and set it on your adapter's Create function, on the call to statefulGraph.AddStyledNode

  6. regenerate the icons embedded asset module with make icons

  7. commit and profit :D

⛏️ Built Using

✍️ Authors

πŸŽ‰ Acknowledgements

  • Kubernetes sigs members for the excellent abstractions and interfaces available on Golang
  • @damianopetrungaro for the honest reviews and patience

Jump to

Keyboard shortcuts

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