report

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2018 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnnotateDiffReports

func AnnotateDiffReports(r []DiffReport, prefix string)

AnnotateDiffReports annotates every DiffReport with a prefix

func SplitGroupVersionSafe

func SplitGroupVersionSafe(groupversion string) (string, string)

SplitGroupVersionSafe is a helper to ensure that the sorting is done by group first. Fallback in error case: group: "" version: groupversion

Types

type Configuration

type Configuration struct {
	Namespaces      []string
	KubewireVersion string
}

Configuration defines the scanning configuration used

type DiffReport

type DiffReport struct {
	Element string
	A       string
	B       string
}

DiffReport defines the type for a single diffing result where A is the old and B is the new value of Element

func Diff

func Diff(a, b []Keyer) []DiffReport

Diff creates a difference report betweed a and b. It assumes that the elements in a and b are sorted by Key()

func DiffReports

func DiffReports(a Report, b Report) []DiffReport

DiffReports creates a DiffReport between a and b. Resources and ResourceObjects from a and b must be sorted

func (DiffReport) String

func (r DiffReport) String() string

type Keyer

type Keyer interface {
	Key() string
	Compare(b interface{}) []DiffReport
}

Keyer defines an interface which can uniquely identify and compare types together in order to diff them

type Report

type Report struct {
	ScanStart       time.Time
	ScanEnd         time.Time
	Server          Server
	Resources       []Resource
	ResourceObjects []ResourceObject
	Configuration   Configuration
}

Report defines a cluster snapshot

type Resource

type Resource struct {
	GroupVersion string
	Name         string
	Kind         string
	Namespaced   bool
	Verbs        []string
}

Resource defines a kubernetes api resource

func (Resource) Compare

func (a Resource) Compare(b interface{}) []DiffReport

Compare compares two Resources, while b must be a Resource or else it will panic

func (Resource) Key

func (a Resource) Key() string

Key returns a unique identifier for the Resource which can be used for sorting

type ResourceObject

type ResourceObject struct {
	GroupVersion string
	Resource     string // references Resource.Name
	Namespace    string
	Name         string
}

ResourceObject represent a persistent entity in the system

func (ResourceObject) Compare

func (a ResourceObject) Compare(b interface{}) []DiffReport

Compare compares two ResourceObjects, while b must be a ResourceObject or else it will panic

func (ResourceObject) Key

func (a ResourceObject) Key() string

Key returns a unique identifier for the ResourceObject which can be used for sorting

type ResourceObjectSort

type ResourceObjectSort []ResourceObject

ResourceObjectSort implements sorting for ResourceObjects by Key()

func (ResourceObjectSort) Len

func (r ResourceObjectSort) Len() int

func (ResourceObjectSort) Less

func (r ResourceObjectSort) Less(i, j int) bool

func (ResourceObjectSort) Swap

func (r ResourceObjectSort) Swap(i, j int)

type ResourceSort

type ResourceSort []Resource

ResourceSort implements sorting for Resources by Key()

func (ResourceSort) Len

func (r ResourceSort) Len() int

func (ResourceSort) Less

func (r ResourceSort) Less(i, j int) bool

func (ResourceSort) Swap

func (r ResourceSort) Swap(i, j int)

type Server

type Server struct {
	Version string
	Host    string
}

Server holds the information about the remote kubernetes instance

Jump to

Keyboard shortcuts

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